1.2.6 · D4Calculus & Optimization Basics

Exercises — The Hessian matrix

2,678 words12 min readBack to topic

Before we start, one shared picture of the three shapes we keep classifying — bowl, dome, saddle. Keep it beside you: every L3 and L4 classification below is really deciding which of these three panels your critical point lives in.

Figure — The Hessian matrix

Level 1 — Recognition

Recall Solution

Recall the layout , where means "differentiate by twice" and means "by , then by " (or vice-versa — they match). (a) (top-left). (b) (top-right). (c) Because of Schwarz's theorem: when the second partials are continuous, mixed partials are equal, so and is symmetric. Both numbers measure the same twist of the surface, read from either direction.

Recall Solution

The vector is the gradient — first-order slopes, one per variable, so numbers. The matrix is the Hessian — second-order curvatures, one per pair of variables, so numbers (). But symmetry () means the entry above the diagonal repeats the one below it, so only of them are independent ( on the diagonal plus distinct off-diagonal pairs). That is what you actually need to store or compute — for it is numbers, not . The gradient points uphill; the Hessian bends the hill.


Level 2 — Application

Recall Solution

First the gradient: , . Now differentiate each slope again:

  • ✓ (matches ) Notice the Hessian depends on the point — curvature changes as you move.
Recall Solution

Substitute :

Recall Solution

What "curvature along a direction" means. Slice the surface with the vertical plane through pointing along ; you get a 1D curve . Its second derivative is the curvature felt in that direction. Why (mini-proof, so you don't have to trust the parent note blindly). By the chain rule, the first derivative of is the directional derivative Differentiate again in . Each is itself a function of the moving point, so the chain rule gives . Therefore The double sum is exactly the matrix product written out. So the quadratic form equals the directional curvature — no hidden factor. (The you sometimes see belongs to the Taylor term , because integrating twice produces the ; the curvature itself has no .) Now the computation. Compute first: Then . The value : along the surface curves upward (like the bottom of a bowl in that direction).


Level 3 — Analysis

Recall Solution

Gradient: , which is only at ✓ (test is valid here). Hessian: , so . . Since , the eigenvalues have opposite signssaddle point (the yellow saddle panel of the figure above). (No need to check — the diagonal-sign test only matters when .)

Recall Solution

; solving both gives only . . ⇒ eigenvalues share a sign. Which sign? Check the top-left diagonal curvature ⇒ both negative ⇒ maximum (the red dome panel).

Recall Solution

Eigenvalues solve . Subtract from each diagonal entry: Expand the product (multiply the two brackets term by term): Now subtract the off-diagonal product : Apply the quadratic formula ( with ): So and . Both negative ⇒ maximum, matching L3.2 ✓. Their product and sum , exactly the shortcut logic.

Recall Solution

, zero only at . , so at the origin . ⇒ the second-derivative test is inconclusive. One eigenvalue is — a flat direction () where the quadratic term tells you nothing. Resolve it with higher-order terms: along the function is , and along it is ; both curve upward, so is actually a minimum. The Hessian alone could not see this because the curvature in the -direction only shows up at fourth order. This is exactly why is flagged "test fails, look deeper."


Level 4 — Synthesis

Recall Solution

. Set to zero: ; . Two critical points: and . Hessian (since , eigenvalues are the diagonal here).

  • At : , eigenvalues both minimum (blue bowl panel).
  • At : , eigenvalues opposite signs ⇒ saddle (yellow panel). Same function, different curvature at different points — this is why must be evaluated per point.
Recall Solution

(constant — independent of the point). Need positive definite: (always true) and . So the origin is a minimum exactly for . At , (inconclusive — a flat valley direction, exactly the L3.4 situation); beyond, (saddle).

Recall Solution

At : . Gradient: ; . So . Hessian entries: ; ; . With , the Taylor formula (True value — the estimate is close, as expected for small steps.)


Level 5 — Mastery

Recall Solution

. (constant). Its inverse: , so Compute Update: , i.e. the origin — we land exactly at . Why one step suffices: Newton's method minimizes the local quadratic model exactly. Here is exactly quadratic, so the model equals the true function — one step lands on the true minimum .

Recall Solution

, eigenvalues and . A large condition number () means a long, thin valley: curvature is steeper across the valley () than along it (). Gradient descent takes big steps across and tiny steps along, so it zig-zags slowly toward the minimum. This is exactly the pathology Newton's method cures by rescaling with .

Recall Solution

. Second partials: . Apply the hint. The top-left entry always, so the only condition that can fail is the determinant. Determinant: .

  • Convex (positive semidefinite) needs : . ✓ This is exactly the claimed region.
  • Near : plug in ⇒ eigenvalues have opposite signs ⇒ the Hessian is indefinite is not convex there (locally saddle-shaped). Conclusion: convexity is a local, point-dependent property here. For (i.e. ) the Hessian is positive semidefinite and is convex; in the strip around the -axis it is not. So is convex on that region but not convex everywhere — which is what we were asked to show.

Recall Quick self-test (cloze)

A positive determinant of a 2×2 Hessian means the eigenvalues ::: share the same sign (could be a max or a min). To distinguish max from min when you check ::: the sign of a diagonal entry (or the trace). When the second-derivative test is ::: inconclusive — you must use higher-order terms. The condition number being large predicts ::: gradient descent will zig-zag in a long, thin valley. Newton's method reaches the minimum of a purely quadratic function in ::: exactly one step.