Calculating Hessian matrix symbolically.

52 Views Asked by At

Consider the matrix $\mathbf{B}\in\mathbb{R}^{2\times 2}$ and vector $\vec{b}\in\mathbb{R}^2$ given by $$ \mathbf{B} = \left(\begin{array}{c c}8 & \alpha \\ \alpha & 2\end{array}\right),\quad\vec{b} = \left(\begin{array}{c}6 \\ \beta \end{array}\right), $$ and hence define $$ f(x) = x^\intercal \mathbf{B} x + b\cdot x,\quad x\in\mathbb{R}^2, $$ I'm trying to evaluate the Hessian of this matrix without explicitly calculating the second order partial derivatives of $f$. To this end, we note that the Jacobian matrix of $f$, $f'$, is given by $$ f'(x) = 2x^\intercal \mathbf{B} + \vec{b}^\intercal,\quad x\in\mathbb{R}^2. $$ I was simply wondering whether or not, from here, to determine the Hessian matrix of $f$, $f''$, we can simply differentiate symbolically again to obtain $$ f''(x) = 2\mathbf{B},\quad x\in\mathbb{R}^2. $$ I've double-checked by explicitly calculating the second-order partial derivatives of $f$, and it seems the Hessian of $f$ is indeed $2\mathbf{B}$, although I was also wondering whether or not the above approach is valid in general? Thanks in advance.

1

There are 1 best solutions below

0
On

In general, for constant matrix $B$, you have

$${\partial^2 \over \partial x\partial x'}x'Bx =B+B'.$$

Of course, if $B$ is symmetric as in your example, then this simplifies to $2B$.