text: # Computing the Jacobian and Hessian of function
  
  I need some help to compute the Jacobian and Hessian of a function $f : \mathbb{R}^n \rightarrow \mathbb{R}^n$ which takes as input a vector $x$ of length $n > 0$. The other symbols can be assumed to be constant.
  
  $$f(x) = \sum_{i,j=1}^{n}\rho_{ij}\sigma_i\sigma_j x_i x_j$$
  
  For the Jacobian do I just make $x_i=0$ for $\frac{\partial}{\partial x_i}f$? How does the Hessian differ once the first derivative of $x_i$ is already $0$?
  
  • 1. What are your $\sigma_k$ and $\rho_{ij}$? 2. Isn‘t your $f$ a real valued function instead of one with range in $\mathbb{R}^n$? Commented Apr 8, 2018 at 23:11
  
  Recall the definitions of the Hadamard $(\circ)$ and Frobenius $(:)$ products \eqalign{ B &= C\circ A &\implies B_{ik} = C_{ik}A_{ik} \cr \beta &= C:A &\implies \beta = \sum_{i}\sum_{k} C_{ik}A_{ik} } Using these, you can express the function in pure matrix notation (after replacing the Greek symbols with easier to type Latin ones) \eqalign{ f &= P\circ ss^T:xx^T\cr } Find the differential and gradient \eqalign{ df &= P\circ ss^T:(dx\,x^T+x\,dx^T) \cr &= (P\circ ss^T+P^T\circ ss^T):dx\,x^T \cr &= (P\circ ss^T+P^T\circ ss^T)x:dx \cr g=\frac{\partial f}{\partial x} &= (P\circ ss^T+P^T\circ ss^T)x \cr } To calculate the Hessian, start with the differential of the gradient \eqalign{ dg &= (P\circ ss^T+P^T\circ ss^T)\,dx \cr H=\frac{\partial g}{\partial x} &= (P\circ ss^T+P^T\circ ss^T) \cr &= (P+P^T)\circ ss^T \cr } And you're done.
  
  • This is exceptionally helpful. Do you have a good reference for this material? I'm struggling to find accessible tutorial sources with examples for dealing with differentials. Commented Jul 24, 2018 at 8:26
  
  Let $A=(a_{ij})$ be the matrix with entries $a_{ij}=\rho_{ij}\sigma_i\sigma_j.$ Then $$f(x)=\langle Ax,x\rangle,$$so $$f(x+h)=\langle A(x+h),x+h\rangle=\langle Ax,x\rangle +\langle A ,h\rangle+ \langle Ah,x\rangle+\langle Ah,h\rangle=f(x)+\langle (A+A^t)x,h\rangle+\langle Ah,h\rangle$$ and therefore the Hessian matrix is just $A$ itself.