# Iterative injective change of variable formula application question

Let $$g_1:\mathbb{R}^{d_1} \rightarrow \mathbb{R}^{d_2}$$ and $$g_2:\mathbb{R}^{d_2} \rightarrow \mathbb{R}^{d_3}$$ be injective and differentiable with $$d_1 < d_2 < d_3$$. Let $$g = g_2 \circ g_1$$ and $$A \in \mathbb{R}^{d_1}$$. I am interested in computing the volume of $$A$$: $$\begin{equation} \displaystyle \int_A dx \end{equation}$$ using the change of variable formula, and derived this in two different ways, arriving at two different results which I do not think match in general. I would appreciate any help pointing out what I am doing wrong.

First way: By the change of variable formula and then applying the chain rule, \begin{align} \displaystyle \int_A dx & = \int_{g(A)}|\det J_g^\top(g^{-1}(z))J_g(g^{-1}(z))|^{-1/2}dz\\ & = \int_{g(A)} |\det J_{g_1}^\top(g^{-1}(z))J_{g_2}^\top(g_2^{-1}(z))J_{g_2}(g_2^{-1}(z))J_{g_1}(g^{-1}(z))|^{-1/2}dz \end{align} where $$J_g(x)$$ denotes the Jacobian matrix of $$g$$ evaluated at $$x$$, and $$g^{-1}$$ is well defined over $$g(A)$$.

Second way: Again, by the change of variable formula, but this time applying it twice, \begin{align} \displaystyle \int_A dx & = \int_{g_1(A)}|\det J_{g_1}^\top(g_1^{-1}(y))J_{g_1}(g_1^{-1}(y))|^{-1/2}dy \\ & = \int_{g_2(g_1(A))} |\det J_{g_1}^\top(g_1^{-1}(g_2^{-1}(z)))J_{g_1}(g_1^{-1}(g_2^{-1}(z)))|^{-1/2} |\det J_{g_2}^\top(g_2^{-1}(z))J_{g_2}(g_2^{-1}(z))|^{-1/2}dz\\ & = \int_{g(A)} |\det J_{g_1}^\top(g^{-1}(z))J_{g_1}(g^{-1}(z))|^{-1/2} |\det J_{g_2}^\top(g_2^{-1}(z))J_{g_2}(g_2^{-1}(z))|^{-1/2}dz\\ \end{align}

Now, because this holds for any $$A$$, it would imply the integrands are equal almost surely and thus: $$\begin{equation} |\det J_1^\top J_2^\top J_2 J_1| = |\det J_1^\top J_1||\det J_2^\top J_2| \end{equation}$$ where I simplified notation for clarity. I don't think the above equation is true for arbitrary $$J_1 \in \mathbb{R}^{d_2 \times d_1}$$ and $$J_2 \in \mathbb{R}^{d_3 \times d_2}$$ (or even if $$J_1$$ and $$J_2$$ are full rank as would be the case due to injectivity). Any help is very appreciated!

The problem is in the "second way", the second equal sign. The term $$\text{det}J_2^TJ_2$$ contains too much information, e.g. how $$d_2$$-dimensional volume is being deformed by map $$g_2$$ from $${\mathbb R}^{d_2}$$ to $${\mathbb R}^{d_3}$$. But in reality we only need to check how the $$d_1$$-dimensional volume in the direction of $$g_1(A)$$, which is a $$d_1$$-dimensional submanifold of $${\mathbb R}^{d_2}$$, is being deformed by $$g_2$$.
$$\text{det}J_2^TJ_2$$ brings in information like, among other things, how the geometry in the direction perpendicular to $$g_1(A)$$, is being deformed by $$g_2$$; this information is totally irrelevant for our purpose.