Linear Algebra
16.47 min read

Hessian of a Quadratic

Quadratic functions are the cleanest case. For f(x)=12xtMxf(\mathbf{x}) = \frac{1}{2}\mathbf{x}^t M \mathbf{x} with MM symmetric, let us compute the Hessian directly.

Expanding: f=12k,lmklxkxlf = \frac{1}{2}\sum_{k,l} m_{kl} x_k x_l. For off-diagonal terms iji \neq j: 2fxixj=12[mij+mij]=mij\frac{\partial^2 f}{\partial x_i \partial x_j} = \frac{1}{2}[m_{ij} + m_{ij}] = m_{ij} (using symmetry of MM). For diagonal: 2fxi2=mii\frac{\partial^2 f}{\partial x_i^2} = m_{ii}.

The stunning conclusion: for a quadratic f(x)=12xtMxf(\mathbf{x}) = \frac{1}{2}\mathbf{x}^t M \mathbf{x}, the Hessian is constant and equal to MM everywhere: Hf(x0)=MHf(\mathbf{x}_0) = M for all x0\mathbf{x}_0.

This means we can recover the quadratic from its Hessian: f(x)=12xt[Hf]xf(\mathbf{x}) = \frac{1}{2}\mathbf{x}^t [Hf] \mathbf{x}. Adding linear or constant terms to ff does not change the Hessian.

Formal View

Theorem 16.2 — Hessian of a Quadratic
For f(x)=12xtMxf(\mathbf{x}) = \frac{1}{2}\mathbf{x}^t M \mathbf{x} with MM symmetric, the Hessian is constant:
Hf(x0)=Mfor all x0Hf(\mathbf{x}_0) = M \quad \text{for all } \mathbf{x}_0

Adding any linear term btx\mathbf{b}^t \mathbf{x} or constant cc does not change the Hessian — only the quadratic part contributes.

Why This Matters

Quadratics are the canonical second-order approximation to any smooth function. Understanding the quadratic case tells us how to interpret the Hessian at any point.

  • Any smooth function looks like a quadratic near a point — the Hessian is its defining matrix
  • Newton's method replaces the function with its local quadratic and minimizes that
  • Quadratic programming (QP) solves optimization over quadratic objectives — foundational in robotics and control
  • Understanding loss landscape curvature in neural networks via quadratic approximation

Quiz

Question 1

For f(x)=12xtMxf(\mathbf{x}) = \frac{1}{2}\mathbf{x}^t M \mathbf{x} with MM symmetric, Hf(x0)Hf(\mathbf{x}_0) equals:

Question 2

For f(x)=12xtMx+btx+cf(\mathbf{x}) = \frac{1}{2}\mathbf{x}^t M \mathbf{x} + \mathbf{b}^t \mathbf{x} + c, what is HfHf?

Question 3

For a general smooth function ff, the Hessian Hf(x0)Hf(\mathbf{x}_0) is constant (same at every point).

Question 4

Given Hf=MHf = M for a quadratic ff, how do we recover ff?

Common Mistakes

  • Forgetting the 12\frac{1}{2} when reconstructing ff from HfHf — writing xtMx\mathbf{x}^t M \mathbf{x} instead of 12xtMx\frac{1}{2}\mathbf{x}^t M \mathbf{x}.
  • Assuming the Hessian of a non-quadratic is constant — only quadratics have constant Hessians.
  • Forgetting to require MM symmetric when using this theorem.