Foundations to Frontier
Tests
A. Mathematical Foundations › A3 Calculus and Analysis › Multivariable calculus

The Hessian Matrix, Curvature and Saddle Points

The Hessian collects all second derivatives and describes how a function curves in every direction. Its eigenvalues decide whether a flat spot is a valley, a peak or a saddle. They also set how fast optimizers converge, and explain why deep networks are full of saddles rather than bad minima.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Bowls, domes and saddles

Three flat spots can feel completely different. In a bowl, every direction curves up, so it’s a minimum. On a dome, every direction curves down, so it’s a maximum. On a horse saddle (or a Pringle crisp), the surface curves up front-to-back but down side-to-side. It’s flat at the centre, yet neither the lowest nor the highest point.

The table of how a surface curves in every direction is the Hessian.

The Hessian: curvature in every direction (click the map)
jump to critical point:
at (1.00, 1.00): H = [[12.00, -4.00], [-4.00, 12.00]] · eigenvalues λ₁ = 16.000, λ₂ = 8.000 · ‖∇f‖ = 0.000
critical point → local minimum
Green line = direction of positive curvature (curves up), orange = negative (curves down); longer = stronger. Two minima and a saddle between them.
Why engineers care

When an AI model trains, it often slows down near saddle-shaped spots: flat, but not the bottom. When engineers design a spacecraft’s orbit or a robot’s motion, they check the curvature at a solution to make sure it’s really a minimum of fuel or effort, not a saddle.

📝 Quick check (Level 0)
0/3 answered
  1. 1. The centre of a horse saddle is a…
  2. 2. The bottom of a bowl is a…
  3. 3. At all three kinds of flat spot, the slope is…

Level 1: Beginner

★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.

Definition

H=∇2f=(fxxfxyfyxfyy),Hij=∂2f∂xi∂xjH = \nabla^2f = \begin{pmatrix}f_{xx}&f_{xy}\\f_{yx}&f_{yy}\end{pmatrix}, \qquad H_{ij} = \frac{\partial^2f}{\partial x_i\partial x_j}

By Clairaut (A3.2-2), fxy=fyxf_{xy} = f_{yx}, so HH is symmetric.

Example. f=x2+3xy+5y2f = x^2 + 3xy + 5y^2: fx=2x+3yf_x = 2x + 3y and fy=3x+10yf_y = 3x + 10y, so

H=(23310)H = \begin{pmatrix}2&3\\3&10\end{pmatrix}

This is constant, because ff is quadratic. A general quadratic form 12x⊤Ax\tfrac12\mathbf x^\top A\mathbf x has Hessian AA (A2.4-2).

📝 Quick check (Level 1)
0/3 answered
  1. 1. H of x² + 3xy + 5y²: the (2, 2) entry?
  2. 2. For a smooth f, H is…
  3. 3. f_xx of x³ at x = 2?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.

The second-derivative test in many variables

At a critical point (∇f=0\nabla f = \mathbf 0), look at the eigenvalues of HH:

Eigenvalues of HH HH is The point is
all >0>0 positive definite strict local minimum
all <0<0 negative definite strict local maximum
some >0>0, some <0<0 indefinite saddle
some =0= 0 (rest one sign) semidefinite inconclusive

In 2-D, use D=fxxfyy−fxy2=det⁡HD = f_{xx}f_{yy} - f_{xy}^2 = \det H. If D>0D>0, it’s a min when fxx>0f_{xx}>0 and a max when fxx<0f_{xx}<0. If D<0D<0, it’s a saddle. If D=0D = 0, the test is inconclusive.

Example. f=x4+y4−4xyf = x^4 + y^4 - 4xy has critical points (0,0)(0,0) and ±(1,1)\pm(1,1). At (1,1)(1,1), H=(12−4−412)H = \begin{pmatrix}12&-4\\-4&12\end{pmatrix} with eigenvalues 8 and 16, so it’s a minimum. At the origin, H=(0−4−40)H = \begin{pmatrix}0&-4\\-4&0\end{pmatrix} with eigenvalues ±4\pm4, so it’s a saddle.

Curvature in a direction

The second derivative along a unit vector u\mathbf u is u⊤Hu\mathbf u^\top H\mathbf u, a Rayleigh quotient (A2.4-2). The eigenvalues are the principal curvatures (the most and least curved directions) and the eigenvectors point along them. The ratio λmax⁡/λmin⁡\lambda_{\max}/\lambda_{\min}, the condition number, decides how badly gradient descent zig-zags (A2.3-8, A3.2-3).

🐍 Exercise 1: compute Hessians and classify critical points
Build a finite-difference Hessian and classify points by eigenvalue signs. Test it on x³ − 3x + y² and x⁴ + y⁴ − 4xy.
📝 Quick check (Level 2)
0/3 answered
  1. 1. D = f_xx f_yy − f_xy² for xy at the origin?
  2. 2. x³ − 3x + y² at (−1, 0) is a…
  3. 3. The curvature of x² + 3y² along (0, 1)?

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Why the test works

Second-order Taylor (A3.2-7) at a critical point gives

f(p+h)=f(p)+12h⊤Hh+o(∥h∥2)f(\mathbf p + \mathbf h) = f(\mathbf p) + \tfrac12\mathbf h^\top H\mathbf h + o(\lVert\mathbf h\rVert^2)

If H≻0H\succ0 with smallest eigenvalue λmin⁡>0\lambda_{\min}>0, then 12h⊤Hh≥12λmin⁡∥h∥2\tfrac12\mathbf h^\top H\mathbf h\ge\tfrac12\lambda_{\min}\lVert\mathbf h\rVert^2, which dominates the o(⋅)o(\cdot) term for small h\mathbf h. So f(p+h)>f(p)f(\mathbf p + \mathbf h)>f(\mathbf p), a strict minimum. ∎ If HH has eigenvalues of both signs, moving along the corresponding eigenvectors goes up one way and down the other, so it’s a saddle.

When the test is silent

x2+y4x^2 + y^4 and x2−y4x^2 - y^4 have the same Hessian (2000)\begin{pmatrix}2&0\\0&0\end{pmatrix} at the origin. The first has a minimum there and the second a saddle. A zero eigenvalue means higher-order terms decide. The monkey saddle x3−3xy2x^3 - 3xy^2 has H=0H = 0, with three valleys.

Convexity

A C2C^2 function is convex iff H(x)⪰0H(\mathbf x)\succeq0 everywhere, and strictly convex if H≻0H\succ0 everywhere (A2.3-3, A3.1-5). For a convex function, any critical point is a global minimum. That’s the foundation of convex optimization (A6).

Exercise 3.1: Show the Hessian of a quadratic ½xᵀAx + bᵀx is A (for symmetric A)

The gradient is Ax+bA\mathbf x + \mathbf b. Differentiating again gives AA. Since it is constant, the quadratic is exactly its own second-order Taylor model, which is why Newton’s method solves it in one step.

📝 Quick check (Level 3)
0/3 answered
  1. 1. x² − y⁴ at the origin is…
  2. 2. A C² function is convex iff…
  3. 3. The smallest eigenvalue of [[12, −4], [−4, 12]]?

Level 4: Expert

★★★★★ Expert⏱ 45 minResearchers: original papers and open problems.

Saddles dominate in high dimensions

At a “random” critical point of a high-dimensional function, each Hessian eigenvalue is about equally likely to be positive or negative. A minimum needs all nn to be positive, which becomes exponentially rare. Dauphin et al. (2014) showed neural-network losses are riddled with saddle points, with the fraction of negative eigenvalues falling as the loss decreases. Gradient descent with noise escapes strict saddles efficiently (Ge et al., 2015; Jin et al., 2017). This explains why bad local minima are less of a problem in practice than feared.

🐍 Exercise 2 (research): random critical points are almost never minima
For random symmetric (GOE) matrices of size n = 1 to 6, estimate the probability that all eigenvalues are positive. Watch it fall from ½ to essentially 0.

Curvature at scale

  • Hessian-vector products (Pearlmutter, 1994) compute HvH\mathbf v for about the cost of two gradients, without forming the n×nn\times n matrix. Combined with power iteration or Lanczos (A2.4-7), they give the sharpness λmax⁡\lambda_{\max} and the eigenvalue density of networks with millions of parameters (Ghorbani et al., 2019; Practice Code 5).
  • Edge of stability. Training with step η\eta drives λmax⁡(H)\lambda_{\max}(H) up to about 2/η2/\eta and keeps it there (Cohen et al., 2021). Sharpness-aware minimization deliberately seeks flatter minima (Foret et al., 2021).
  • Second-order optimization in robotics. iLQR and DDP use (Gauss–Newton approximations of) Hessians of the trajectory cost, J⊤JJ^\top J plus constraint curvature, for fast motion planning and model-predictive control (Tassa, Erez and Todorov, 2012). Checking the Hessian at a solution certifies a true local minimum of the planner’s cost.
  • Uncertainty. The Laplace approximation (A3.1-8) uses H−1H^{-1} at the optimum as a posterior covariance. In SLAM, the information matrix is the Hessian of the negative log-likelihood.

References

  1. B. Pearlmutter (1994). “Fast exact multiplication by the Hessian.” Neural Computation, 6(1).
  2. Y. Dauphin, R. Pascanu, C. Gulcehre, K. Cho, S. Ganguli, Y. Bengio (2014). “Identifying and attacking the saddle point problem in high-dimensional non-convex optimization.” NeurIPS.
  3. R. Ge, F. Huang, C. Jin, Y. Yuan (2015). “Escaping from saddle points: online stochastic gradient for tensor decomposition.” COLT.
  4. C. Jin, R. Ge, P. Netrapalli, S. Kakade, M. Jordan (2017). “How to escape saddle points efficiently.” ICML.
  5. Y. Tassa, T. Erez, E. Todorov (2012). “Synthesis and stabilization of complex behaviors through online trajectory optimization.” IROS.
  6. B. Ghorbani, S. Krishnan, Y. Xiao (2019). “An investigation into neural net optimization via Hessian eigenvalue density.” ICML.
  7. J. Cohen, S. Kaur, Y. Li, J. Z. Kolter, A. Talwalkar (2021). “Gradient descent on neural networks typically occurs at the edge of stability.” ICLR.
  8. P. Foret, A. Kleiner, H. Mobahi, B. Neyshabur (2021). “Sharpness-aware minimization for efficiently improving generalization.” ICLR.