# how do I calculate Hessian of this function?

I have a function $f(x) = (\mathbf x ^ \top \mathbf x) ^ {p/2}$.

Its gradient is $\nabla f(x) = 2p (\mathbf x ^ \top \mathbf x) ^ {(p-2)/2} \mathbf x$

How do I compute its Hessian $\nabla^2f(x)$? Should I use product rule? Can someone show me how to do it or refer me to some resource?

Thanks

-
The factor 2 in the gradient should not be there! – Fabian Feb 12 '12 at 9:49
Note also that $\nabla^2$ is conventionally used to denote the Laplacian $\Delta$. In a way $\Delta = \nabla \cdot \nabla$ whereas the Hessian is given by the dyadic product $\nabla \otimes \nabla$. – Fabian Feb 12 '12 at 10:00

Let's do it with indexes: $$\frac{\partial^2}{\partial x_i \partial x_j} \left( x_k x_k \right)^{p/2} = \frac{\partial}{\partial x_i} \left\{ p \left( x_k x_k \right)^{p/2-1} x_j \right\} = p \left( x_k x_k \right)^{p/2-1} \delta_{i,j} - p(p-2) \left( x_k x_k \right)^{p/2-2} x_i x_j$$ Now rewriting this in coordinate free notations: $$\nabla \otimes \nabla f(x) = p \left( x^\top x \right)^{p/2-1} \mathbb{I} - p(p-2) \left( x^\top x \right)^{p/2-2} x \otimes x^\top$$