TITLE: About the inverse of the Jacobian matrix
QUESTION [6 upvotes]: I have a doubt on Jacobian matrices. Consider the non linear transformation
$$
\left[
\begin{array}{c}
x\\
y\\
z
\end{array}\right]
 = \mathbf{G}\left(
 \left[
\begin{array}{c}
\hat{x}\\
\hat{y}\\
\hat{z}
\end{array}\right]
\right) = 
 \left[
\begin{array}{c}
\hat{x}g(\hat{z})\\
\hat{y}g(\hat{z})\\
\hat{z}
\end{array}\right]
$$
whose Jacobian reads
$$
\text{J} = 
\left[
\begin{array}{ccc}
g & 0 & \hat{x}g'\\
0 & g & \hat{y}g'\\
0 & 0 & 1
\end{array}
\right]
$$
If I invert this matrix I get
$$
\text{J}^{-1} = 
\left[
\begin{array}{ccc}
1/g & 0 & -\hat{x}g'/g\\
0 & 1/g & -\hat{y}g'/g\\
0 & 0 & 1
\end{array}
\right]
$$
which I thought should be the same as the Jacobian of the inverse transformation. However, solving for $\hat{x}, \hat{y}, \hat{z}$ in the definition of the transformation, I get
$$
\left[
\begin{array}{c}
\hat{x}\\
\hat{y}\\
\hat{z}
\end{array}\right]
 = \mathbf{G}^{-1}\left(
 \left[
\begin{array}{c}
x\\
y\\
z
\end{array}\right]
\right) = 
 \left[
\begin{array}{c}
x/g(z)\\
y/g(z)\\
z
\end{array}\right]
$$
whose Jacobian now reads
$$
\text{J}^{-1} = 
\left[
\begin{array}{ccc}
1/g & 0 & -\hat{x}g'/g^2\\
0 & 1/g & -\hat{y}g'/g^2\\
0 & 0 & 1
\end{array}
\right]
$$
which is slightly different. My question is: which one is the correct Jacobian for the inverse? Weren't they supposed to be the same? If so, where's my mistake?
Thank you in advance!

REPLY [6 votes]: $G$ maps a point $p$ to $G(p)$. The Jacobian maps a tangent vector at $p$ to one at $G(p)$. The inverse is the Jacobian for $G^{-1}$ at $G(p)$. So, in the second formula you should substitute $x g(z)$ for $x$, $yg(z)$ for $y$, and $z$ for $z$ to recover the first. All consistent (modulo the typo I mentioned in the comment), well done!