Simple 2d example illustrating the role of the Jacobian determinant in the change of variables formula. Inspired by Ari Seff in https://youtu.be/i7LjDvsLWCg?t=250.
Edit and compile if you like:
% Convolution operator. % Adapted from https://github.com/PetarV-/TikZ/tree/master/2D%20Convolution \documentclass[tikz]{standalone} \usetikzlibrary{matrix, positioning} \begin{document} \begin{tikzpicture}[ 2d-arr/.style={matrix of nodes, row sep=-\pgflinewidth, column sep=-\pgflinewidth, nodes={draw}} ] \matrix (mtr) [2d-arr] { 0 & 1 & 1 & |[fill=orange!30]| 1 & |[fill=orange!30]| 0 & |[fill=orange!30]| 0 & 0\\ 0 & 0 & 1 & |[fill=orange!30]| 1 & |[fill=orange!30]| 1 & |[fill=orange!30]| 0 & 0\\ 0 & 0 & 0 & |[fill=orange!30]| 1 & |[fill=orange!30]| 1 & |[fill=orange!30]| 1 & 0\\ 0 & 0 & 0 & 1 & 1 & 0 & 0\\ 0 & 0 & 1 & 1 & 0 & 0 & 0\\ 0 & 1 & 1 & 0 & 0 & 0 & 0\\ 1 & 1 & 0 & 0 & 0 & 0 & 0\\ }; \node[below=of mtr-5-4] {$\mathbf I$}; \node[right=0.2em of mtr] (str) {$*$}; \matrix (K) [2d-arr, right=0.2em of str, nodes={draw, fill=teal!30}] { 1 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 1 \\ }; \node[below=of K-3-2] {$\mathbf K$}; \node[right=0.2em of K] (eq) {$=$}; \matrix (ret) [2d-arr, right=0.2em of eq] { 1 & 4 & 3 & |[fill=blue!80!black!30]| 4 & 1\\ 1 & 2 & 4 & 3 & 3\\ 1 & 2 & 3 & 4 & 1\\ 1 & 3 & 3 & 1 & 1\\ 3 & 3 & 1 & 1 & 0\\ }; \node[below=of ret-4-3] {$\mathbf{I * K}$}; \draw[dashed, teal] (mtr-1-6.north east) -- (K-1-1.north west); \draw[dashed, teal] (mtr-3-6.south east) -- (K-3-1.south west); \draw[dashed, blue!80!black] (K-1-3.north east) -- (ret-1-4.north west); \draw[dashed, blue!80!black] (K-3-3.south east) -- (ret-1-4.south west); \foreach \i in {1,2,3} { \foreach \j in {4,5,6} { \node[font=\tiny, scale=0.6, shift={(-1.2ex,-2ex)}] at (mtr-\i-\j) {$\times \pgfmathparse{int(mod(\i+\j,2))}\pgfmathresult$}; } } \end{tikzpicture} \end{document}
Click to download: conv2d.tex
Open in Overleaf: conv2d.tex
This file is available on tikz.netlify.app and on GitHub and is MIT licensed.
See more on the author page of Janosh Riebesell..