1.2.6 · D2Calculus & Optimization Basics

Visual walkthrough — The Hessian matrix

1,906 words9 min readBack to topic

Step 1 — A height that depends on two knobs

WHAT. Imagine a landscape. At every spot on the flat ground there is a height — how high the land is above that spot. Turning the -knob walks you east–west; turning the -knob walks you north–south.

WHY. Before we can talk about curvature we must picture the surface. Every symbol on this page is ultimately a fact about this hill.

PICTURE. The green sheet is . The flat grid below is the ground. A point on the ground pushes straight up to a point on the sheet.

Figure — The Hessian matrix

Step 2 — Slope in one direction: the partial derivative

WHAT. Freeze and wiggle only . The rate at which height changes is the partial derivative , read "how fast climbs as I step east". Do the same for to get .

WHY. A hill's steepness depends on which way you face. To measure it we must pick a single direction and ask the plain 1D question "rise over run" — which is exactly what a partial derivative does.

PICTURE. The red curve is the slice through the surface at fixed (walking east only). Its tangent's steepness is . The blue curve slices the other way.

Figure — The Hessian matrix

Step 3 — Curvature: the slope of the slope

WHAT. A slope can itself change as you walk. Differentiate the east-slope again with respect to : that is , the curvature along . Positive ⇒ the slice bends up like a cup; negative ⇒ bends down like a cap.

WHY. Slope alone cannot distinguish a peak from a valley — at both the slope is zero. What differs is how the slope turns around. Curvature is the smallest tool that sees a bend, so it is exactly the tool we need.

PICTURE. Same east-slice from Step 2, now with three tangent lines. Their steepness increases as we move right — the change in that steepness is the curvature.

Figure — The Hessian matrix

Step 4 — Directions interact: the off-diagonal term

WHAT. There is a fourth number: as you step north (), does the east-slope change? That is the mixed partial . A tilted, twisting surface has this term non-zero.

WHY. In 2D directions can be coupled — the east steepness can depend on how far north you are. Ignoring this misses saddles and tilted bowls. So we must record it.

PICTURE. Two east-slices taken at two different values. Their tangents differ — that difference is the mixed partial. The purple arrow shows the slope changing as increases.

Figure — The Hessian matrix

Step 5 — The curvature of an arbitrary direction: the quadratic form

WHAT. Walk in a general direction , not just east or north. The bend you feel is

WHY. The four numbers of let us predict curvature in every direction with one formula — instead of measuring infinitely many slices. This single number is what decides the shape.

PICTURE. From the flat spot at the centre, arrows fan out in all directions. Each arrow is coloured by the sign of along it — up (mint) or down (coral).

Figure — The Hessian matrix

Step 6 — Turn to the natural axes: eigenvalues

WHAT. A symmetric has two special perpendicular directions — its eigenvectors — along which the twist vanishes. Along eigenvector the curvature is a pure number, the eigenvalue . In those axes:

WHY. In the raw frame the twist term mixes the directions and hides the shape. Rotating to the eigen-axes cancels the mixing, leaving two clean, independent bends. This is exactly why we reach for Eigenvalues and eigenvectors.

PICTURE. The same bowl, but drawn along its own axes . Two independent parabolas, one per eigenvalue — no cross-term left.

Figure — The Hessian matrix

Step 7 — The verdict: all four cases

WHAT. Combine the signs of :

every direction shape name
curves up cup minimum
curves down cap maximum
up one way, down the other Pringle saddle
any flat one way trough/ridge inconclusive

WHY. These are all the sign patterns two numbers can have. No hidden fifth case exists — the classification is complete, including the degenerate zero.

PICTURE. Four mini-surfaces side by side: bowl, dome, saddle, and a flat-bottomed trough (the zero-eigenvalue case).

Figure — The Hessian matrix

Step 8 — One full loop on a coupled example

WHAT. Take . Gradient is zero only at . Hessian: Eigenvalues: — both positive. ✅

WHY. This is Steps 4–7 in one shot: a real twist (), forecast by the determinant, confirmed by eigenvalues. Two roads, same answer — that agreement is your safety check.

PICTURE. The tilted bowl of with its two eigen-axes drawn: the steep one () and the gentle one ().

Figure — The Hessian matrix

The one-picture summary

Figure — The Hessian matrix

The whole pipeline: height → slopes (gradient) → curvatures (Hessian) → quadratic form → eigenvalues → shape verdict. Each arrow is one of our steps.

height f

slopes gradient

curvatures Hessian

quadratic form Q

eigenvalues lambda

min max or saddle

Recall Feynman retelling — say it back in plain words

I start with a hill whose height depends on two knobs. I ask "how steep, facing east? facing north?" — those two slopes are the gradient, and at a flat spot they're both zero. But flat could be a peak, a pit, or a saddle, so I ask the deeper question: as I walk, does the slope itself bend up or down? Those bends — three distinct ones because east and north can twist into each other — I stack into the Hessian. To know the bend in any direction I sandwich a direction between two copies of the Hessian; that number is the quadratic form. To read it cleanly I rotate to the surface's own two axes, where the twist disappears and only two pure bends remain: the eigenvalues. Both up means a bowl (minimum), both down a dome (maximum), one each a saddle, any zero and I can't tell. For I skip the eigenvalues: a positive determinant says the bends agree in sign, and a single diagonal entry tells me whether that shared sign is up or down.

Recall Quick checks

Why is symmetric? ::: The twist "east-then-north" equals "north-then-east" (Schwarz), so . At a critical point, what happened to the linear Taylor term? ::: The gradient is , so it vanishes and only the curvature term survives. and — what shape? ::: A maximum (both eigenvalues negative). One zero eigenvalue means? ::: Inconclusive — a flat direction, need higher-order terms.

Related: Newton's method uses to jump to the bottom of this quadratic bowl; Convex functions are exactly those whose Hessian is positive semidefinite everywhere; when eigenvalues differ wildly, Gradient descent zig-zags down the thin valley.