Let $f:\mathbb R^d \to \mathbb R, x \mapsto |x|^2$. Then $\nabla f (x) = 2x$ and $\operatorname{H} f (x) = 2I_d$. For $p \in \mathbb N^*$, let $g_p : \mathbb R^d \to \mathbb R, x \mapsto |x|^{2p}$. Then $g_p = f^p$. By chain rule, $\nabla g_p (x) = p f^{p-1} (x) \nabla f (x)$.
My goal is to compute the Hessian matrix of $g_p$. Every vector is considered as column vector. We need the following lemma
Lemma Let $f:\mathbb R^d \to \mathbb R^d$ and $g:\mathbb R^d \to \mathbb R$ be differentiable. Let $\mathrm J f (x)$ be the Jacobian of $f$ at $x$. Let $\nabla g (x)$ be the gradient of $g$ at $x$. Then $\mathrm J (fg)(x) = f (x) (\nabla g (x))^\top + g(x) \mathrm J f (x)$.
It follows that $$ \begin{align} \operatorname{H} g_p (x) &= \operatorname{J} (\nabla g_p) (x) \\ &= p \operatorname{J} (f^{p-1} \nabla f) (x) \\ &= p \big [ \nabla f (x) (\nabla f^{p-1} (x))^\top + f^{p-1} (x) \operatorname{J} (\nabla f) (x) \big ] \quad \text{by Lemma}\\ &= p \big [ \nabla f (x) (\nabla f^{p-1} (x))^\top + f^{p-1} (x) \operatorname{H} f (x) \big ] \\ &= 2p \big [ (p-1)f^{p-2} (x) x ( \nabla f (x))^\top + f^{p-1} (x) I_d \big ] \quad \text{by} \quad \nabla f^{p-1} = \nabla g_{p-1}. \end{align} $$
Could you confirm if my above computation is fine?