Calculating the determinant of the Hessian of a function Suppose one is given a function
\begin{equation}
f(x_1,\dots,x_n) = g\bigg(x_1,\bigg(\sum_{i=2}^n x_i^2\bigg)^{1/2}\bigg),
\end{equation}
and denote
\begin{equation}
t:=x_1 \quad \text{and}\quad r:= \bigg(\sum_{i=2}^n x_i^2\bigg)^{1/2}.
\end{equation}
I am told that the determinant of the Hessian of $f$ is given by
\begin{equation}
\det D^2f = (g_{tt}g_{rr}-g_{tr}^2)\bigg(\frac{g_r}{r}\bigg)^{n-2},
\end{equation}
and it seems there must be an easy way to see this, but I cannot work it out. I have tried to derive this by computing the Hessian: the first partial derivatives are given by
\begin{align}
\frac{\partial f}{\partial x_i} & = \frac{\partial g}{\partial t}\frac{\partial t}{\partial x_i} + \frac{\partial g}{\partial r}\frac{\partial r}{\partial x_i} = \begin{cases}g_t & \text{if } i=1 \\
g_r\frac{x_i}{r} & \text{if } i\not=1
\end{cases}
\end{align}
and then the second partial derivatives are given by
\begin{equation}
\frac{\partial^2 f}{\partial x_i\partial x_j} = \begin{cases}g_{tt} & \text{if } i=j=1 \\
g_{tr}\frac{x_j}{r} & \text{if }i=1, j\not=1 \\
g_{tr}\frac{x_i}{r} & \text{if }i\not=1, j=1 \\
g_{rr}\frac{x_i x_j}{r^2} + g_r\frac{\delta_{ij}}{r} - g_r\frac{x_ix_j}{r^2} & \text{if }i\not=1, j\not=1. 
\end{cases}
\end{equation}
I was hoping the Hessian would be of a nice form (block diagonal or something) so I could compute the determinant easily, but this doesn't seem to be the case, unless I've calculated something wrong. Any help would be much appreciated! Thanks
 A: Solution
Chain rule for Hessian (Corollary 1, [1]):
Let $n, m$ be two positive integers.
Denote $x = (x_1, x_2, \cdots, x_n)$ and $y = (y_1, y_2, \cdots, y_m)$.
Let $p(y): \mathbb{R}^m \to \mathbb{R}$
and $q_i(x): \mathbb{R}^n \to \mathbb{R}$ for $i=1, 2, \cdots, m$ be twice continuously differentiable functions.
Let $J$ denote the Jacobian.
Then, the Hessian of $p(q_1, q_2, \cdots, q_m)$ is given by
\begin{align}
&H(p(q_1, q_2, \cdots, q_m))\\
=\ & (J(q_1, q_2, \cdots, q_m))^T H(p(y)) J(q_1, q_2, \cdots, q_m) + 
\sum_{i=1}^m \frac{\partial p}{\partial y_i}H(q_i). \tag{1}
\end{align}
$\phantom{2}$
The case $n=2$ is trivial. In the following, we deal with the case $n\ge 3$.
Applying the chain rule for Hessian for our problem, by denoting $x = (x_1, x_2, \cdots, x_n)$, we have (more details are given later)
\begin{align}
H(f(x)) &= J_1^T H_1 J_1 + g_r \Big( - \tfrac{1}{r^3} uu^T
+ \mathrm{diag}(0, \tfrac{1}{r}, \cdots, \tfrac{1}{r})\Big) \tag{2}\\
&= J_1^T\big(H_1 - \frac{g_r}{r}I_2\big)J_1 + \frac{g_r}{r}I_n \tag{3}
\end{align}
where $I_k$ is the $k\times k$ identity matrix, $u = [0, x_2, x_3, \cdots, x_n]^T$,
$$J_1 = \left(
        \begin{array}{ccccc}
          1 & 0 & 0 & \cdots & 0 \\
          0 & \frac{x_2}{r} & \frac{x_3}{r} & \cdots & \frac{x_n}{r} \\
        \end{array}
      \right),
$$
and
$$H_1 = \left(
          \begin{array}{cc}
            g_{tt} & g_{tr} \\
            g_{rt} & g_{rr} \\
          \end{array}
        \right).
$$
Here, in (3), we have used the fact that
$$\frac{1}{r} J_1^T J_1 = \frac{1}{r^3} uu^T
+ \mathrm{diag}(\tfrac{1}{r}, 0, \cdots, 0). \tag{4}$$
From (3), we have
$$\det H(f(x)) = \det \Big(J_1^T\big(H_1 - \frac{g_r}{r}I_2\big)J_1 + \frac{g_r}{r}I_n\Big). \tag{5}$$
If $g_r \ne 0$, by using Weinstein-Aronszajn identity $\det (I_n +AB) = \det(I_m+BA)$ [2], we have
\begin{align}
\det H(f(x)) &= (\tfrac{g_r}{r})^n \det \Big(\tfrac{r}{g_r}J_1^T\big(H_1 - \tfrac{g_r}{r}I_2\big)J_1 + I_n\Big)\\
&= (\tfrac{g_r}{r})^n \det \Big(\tfrac{r}{g_r}\big(H_1 - \tfrac{g_r}{r}I_2\big)J_1J_1^T + I_2\Big)\\
&= (\tfrac{g_r}{r})^n \det \Big(\tfrac{r}{g_r}\big(H_1 - \tfrac{g_r}{r}I_2\big) + I_2\Big)\\
&= (\tfrac{g_r}{r})^n \det (\tfrac{r}{g_r} H_1)\\
&= (\tfrac{g_r}{r})^n (\tfrac{r}{g_r})^2 \det H_1\\
&= (g_{tt}g_{rr} - g_{tr}g_{rt})(\tfrac{g_r}{r})^{n-2} \tag{6}
\end{align}
where we have used the fact that $J_1J_1^T = I_2$. 
If $g_r = 0$ and $n\ge 3$, we have 
$$\det H(f(x)) = \det (J_1^T H_1 J_1) = 0$$
since $\mathrm{rank}(J_1^T H_1 J_1) < 3$. We also have $\det H(f(x)) = (g_{tt}g_{rr} - g_{tr}g_{rt})(\tfrac{g_r}{r})^{n-2}$.
We are done.
Reference
[1] Maciej Skorski, "Chain Rules for Hessian and Higher Derivatives Made Easy by Tensor Calculus", 
https://arxiv.org/pdf/1911.13292.pdf
[2] Weinstein-Aronszajn identity, https://en.wikipedia.org/wiki/Weinstein%E2%80%93Aronszajn_identity
$\phantom{2}$
More details about (2):
$$H(f(x)) = J(t(x), r(x))^T H(g(t,r))J(t(x), r(x)) + g_t H(t(x)) + g_r H(r(x)) \tag{7}$$
where $H(t(x)) = 0$,
$$H(r(x)) =  - \tfrac{1}{r^3} [0, x_2, x_3, \cdots, x_n]^T[0, x_2, x_3, \cdots, x_n]
+ \mathrm{diag}(0, \tfrac{1}{r}, \cdots, \tfrac{1}{r}),\tag{8}$$
$$J(t(x), r(x)) = \left(
        \begin{array}{ccccc}
          1 & 0 & 0 & \cdots & 0 \\
          0 & \frac{x_2}{r} & \frac{x_3}{r} & \cdots & \frac{x_n}{r} \\
        \end{array}
      \right) ,$$
and
$$H(g(t,r)) = \left(
          \begin{array}{cc}
            g_{tt} & g_{tr} \\
            g_{rt} & g_{rr} \\
          \end{array}
        \right) .$$
