How to use the chain rule in this tricky situation I take funtions $\varphi: \mathbb{R}^n\rightarrow \mathbb{R}$ and $\gamma:\mathbb{R}^n \rightarrow \mathbb{R}^n $ such that $$\varphi \circ \gamma(x)=\frac{1}{2}(x_1^2+\ldots+x_r^2-x_{r+1}^2-\ldots -x_{n}^2)$$
I would like to prove that $$|\det(\gamma'(0))|=|\det (H\varphi)|^{-\frac{1}{2}}$$
Where $H\varphi$ is the Hessian matrix $$(\partial^2_{i,j} \varphi)$$
I think it's quite easy with the chain rule but I can't see how to use it propperly.
 A: The result follows from the following:

Proposition. Let $f\colon\mathbb{R}^n\rightarrow\mathbb{R}$ and $\varphi\colon\mathbb{R}^n\rightarrow\mathbb{R}^n$ be smooth maps such that $\varphi(0)$ is a critical point of $f$, then one has the following equality:
  $$\textrm{Hess}_0(f\circ\varphi)={}^\intercal\textrm{Jac}_0(\varphi)\textrm{Hess}_{\varphi(0)}(f)\textrm{Jac}_0(\varphi).$$

Proof. Let us write $\varphi\colon (x_1,\ldots,x_n)\mapsto (u_1,\ldots,u_n)$ and let define the following smooth map $g:=f\circ\varphi$. For all $(i,j)\in\{1,\ldots,n\}^2$, using twice the chain rule and once the product rule, one has:
$$\begin{align}\frac{\partial^2g}{\partial x_i\partial x_j}(0)&=\frac{\partial}{\partial x_i}\left(\frac{\partial g}{\partial x_j}\right)(0),\\&=\frac{\partial}{\partial x_i}\left(\sum_{k=1}^n\frac{\partial f}{\partial u_k}\circ\varphi\frac{\partial u_k}{\partial x_j}\right)(0),\\&=\sum_{k=1}^n\frac{\partial}{\partial x_i}\left(\frac{\partial f}{\partial u_k}\circ\varphi\right)(0)\frac{\partial u_k}{\partial x_j}(0),\\&=\sum_{k=1}^n\sum_{\ell=1}^n\frac{\partial^2f}{\partial u_\ell u_k}(\varphi(0))\frac{\partial u_\ell}{\partial x_i}(0)\frac{\partial u_k}{\partial x_j}(0).\end{align}$$
Whence the result. $\Box$
Remark. The above formula does not hold if $\varphi(0)$ is not a critical point of $f$. Can you spot where I used this assumption?
Let us distinguish the two following cases:


*

*If $\gamma$ is a local diffeomorphism in a neighbourhood of $0$, by assumption and from the chain rule, one has:
$$\mathrm{d}_{\gamma(0)}\varphi\circ\mathrm{d}_0\gamma=0.$$
Hence, $\gamma(0)$ is a critical point of $\varphi$ and taking the determinant on both side in the proposition, one gets:
$$\det(\textrm{Hess}_0(\varphi\circ\gamma))=\det(\textrm{Jac}_0(\gamma))^2\det(\textrm{Hess}_{\gamma(0)}(\varphi)).$$
To conclude, notice that by assumption, one has:
$$\det(\textrm{Hess}_0(\varphi\circ\gamma))=\det\left(\begin{pmatrix}I_r&0\\0&-I_{n-r}\end{pmatrix}\right)=(-1)^{n-r}.$$

*If $\gamma$ is not a local diffeomorphism in a neighbourhood of $0$, one should have:
$$|\det(\textrm{Hess}_{\gamma(0)}(\varphi))|^{-1/2}=0,$$
which is impossible as $1\neq 0$.
