I have the following multi-variable function: $\ h(x)=(x^Tx)^2=||x||^4$ where $x=[x_1 ... x_n]^T$. I am trying to find the Hessian matrix. First I find the gradient vector $g(x)=2(x_{1}^2+...+x_{n}^2)2x_1=(4x^Tx)x$. I am pretty confident in this part. Then I need to take the derivative again to get the Hessian so I do it piece meal and get $\frac{d^2h}{dx_1^2}=4(3x_{1}^2+x_{2}^2+...+x_{n}^2)$ which will be along the diagonals changing the position of the factor of 3 respectively and I get $\frac{d^2h}{dx_jdx_i}=8x_ix_j$ for all $i \neq j$.

My issue now is how to write this thing as a vector valued function like I did for the gradient which just happened to work out easier.

  • $\begingroup$ How did you get ${d^2h\over dx_1^2}$? I get ${d^2h\over dx_i^2}=4\|x\|^2+8x_i$ by deriving twice $\endgroup$ – John Cataldo Apr 2 '18 at 20:56
  • $\begingroup$ I got $\frac{dh}{dx_{1}}=4(x_{1}^3+x_{1}x_{2}^2+...+x_{1}x_{n}^2)$ so then $\frac{d^2h}{dx_{1}^2}=4(3x_{1}^2+x_{2}^2+...+x_{n}^2)$. $\endgroup$ – BryanEhlers Apr 2 '18 at 21:02
  • $\begingroup$ But $h(x)=\|x\|^4=(x_1^2+...+x_n^2)^2$ so ${dh\over dx_i}=2(2x_i)(x_1^2+...+x_ n^2)$ $\endgroup$ – John Cataldo Apr 2 '18 at 21:05
  • $\begingroup$ Shouldn't the $x_n$ in your derivative be squared? And then multiplying out for $i=1$ I believe we are getting the same. $\endgroup$ – BryanEhlers Apr 2 '18 at 21:08
  • $\begingroup$ yeah so what's the problem? $\endgroup$ – John Cataldo Apr 2 '18 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.