Theorem: (Change of Variables Theorem). Let $\Omega\subset\Bbb R^n$ be a region and let $U$ be an open set containing $\Omega$ so that ${\bf g}:U\to\Bbb R^n$ is one-to-one and ${\cal C}^1$ with invertible derivative at each point. Suppose $f:{\bf g}(\Omega)\to\Bbb R$ and $(f\circ{\bf g})\lvert\det D{\bf g}\rvert:\Omega\to\Bbb R$ are both integrable. Then $$\int_{{\bf g}(\Omega)}f({\bf y}) \operatorname d\!V_{\bf y} = \int_\Omega(f\circ{\bf g})(x) \lvert\det D{\bf g}\rvert \operatorname d\!V_{\bf x}.$$
Remark . One can strengthen the theorem, in particular by allowing $D{\bf g}(x)$ to fail to be invertible on a set of volume $0$. This is important for many applications—e.g., polar, cylindrical, and spherical coordinates. But we won’t bother justifying it here.
What happens if $D{\bf g}(x)$ fails to be invertible on a set of positive measure? I can't come up with a counterexample in that case. Why is that hypothesis necessary?