1.2.9 · D4Calculus & Optimization Basics

Exercises — Local vs global minima - maxima

2,789 words13 min readBack to topic

This page is a self-testing ladder. Each problem is stated cleanly, then hides a full solution inside a collapsible callout. Work it first, then reveal. The levels climb from recognising an extremum to synthesising everything you know about the loss landscape — the exact thing that decides whether Gradient Descent finds a great model or a mediocre one.

Before you start, one shared vocabulary reminder so no symbol appears unearned:

Figure — Local vs global minima - maxima

The picture above is our reference landscape: two valleys of different depths plus two ridge tops. Look at the red dot — that is the deep valley (the global min); the black dot on the left is the shallow valley (a local-only min). Every exercise below lives on a curve like this one.


Level 1 — Recognition

Recall Solution 1.1

Read the curve left to right.

  • Shallow valley (left): lower than its immediate neighbours → local minimum. But another valley is deeper, so it is not global.
  • First ridge top: higher than neighbours → local maximum.
  • Deep valley (right): lowest point on the whole curve → local minimum AND global minimum.
  • Second ridge top: higher than neighbours → local maximum.

The whole point: "flat spot" ≠ "minimum", and "minimum" ≠ "global minimum". You must compare depths.

Recall Solution 1.2

False. A flat slope is necessary for a smooth extremum but not sufficient. The classic counterexample is at : , yet the function keeps rising through that point — it is an inflection point, neither a peak nor a valley. In many dimensions the analogue is a saddle point.


Level 2 — Application

Recall Solution 2.1

Slope to zero. . Curvature. everywhere, so the parabola opens upward is a local minimum. Global? An upward parabola has only one valley and rises forever on both sides, so this local min is also the global minimum. Its value: . This is what "convex" means — one bowl, local = global, no traps for Gradient Descent.

Recall Solution 2.2

Slope to zero. . Curvature. .

  • At : → curves down → local maximum, value .
  • At : → curves up → local minimum, value .

Global? As , ; as , . So on the full real line there is no global minimum or maximum — the cubic runs off to . The extrema found are strictly local.


Level 3 — Analysis

Recall Solution 3.1

Slope to zero. . Curvature. .

  • At : local maximum, value .
  • At : local minima, value .

Global. As , dominates → , so no global max. The two valleys tie at , so the global minimum is , achieved at BOTH and . Lesson: global extrema need not be unique — a "W"-shaped curve has two equally deep valleys. The bump at between them is a barrier that could trap plain gradient descent, motivating Momentum and Nesterov.

The figure below draws exactly this "W". Notice the two red dots sitting at the same height (the tied global minima) and the black dot at on top of the barrier between them — the local max your gradient descent must climb over to hop valleys.

Figure — Local vs global minima - maxima
Recall Solution 3.2

Interior critical points. . Classify. : at , (local max); at , (local min). Evaluate at critical points AND endpoints (on a closed interval the boundary can win):

Global minimum , achieved at (endpoint) and (interior). Global maximum , achieved at (interior) and (endpoint). Both are non-unique, and both are attained partly on the boundary.


When the Second-Derivative Test Fails


Level 4 — Synthesis

Recall Solution 4.1

(a) Gradient (differentiate each coordinate; ): (b) At : and , so both components are critical point. ✓ (c) . Why global: the smooth bowl is minimised at the origin, and each cosine term reaches its lowest possible value exactly when its argument is — which also happens at . Both "pull-down" mechanisms bottom out at the same point, so can't be beaten. All other critical points sit in shallower ripples with values : they are local-only minima that trap Gradient Descent unless you use tricks like Adam Optimizer or random restarts.

Recall Solution 4.2

(a) B, at , is only above the global — much closer than A's . (b) In over-parameterised networks many local minima generalise almost identically; a -vs- training loss gap can vanish on the test set, and A may even be flatter/more robust. See Generalization in Deep Learning and Regularization Techniques. (c) Momentum and Nesterov — velocity built up on the descent lets the ball roll through the shallow barrier out of A's basin. Learning Rate Tuning (a larger/scheduled step) helps too.


Level 5 — Mastery

Recall Solution 5.1

(a) ; at both are → critical point. ✓ (b) Along the -axis (): , so the origin is a minimum in that direction. Along the -axis (): , so the origin is a maximum in that direction. Up one way, down another → it is neither a local max nor a local min. (c) This is a saddle point (shaped like a horse's saddle / a Pringle). The Hessian has eigenvalues and mixed signs. In millions of dimensions a critical point is a min only if every one of millions of curvature signs is positive; probabilistically that's rare, so most flat spots are saddles. Escaping them (not local minima) is the real challenge — see Loss Landscape Visualization.

The 3-D figure below is this saddle. Trace the red ridge running along the -axis — walking that way the surface curves up (a min direction). Then follow the black valley along the -axis — that way it curves down (a max direction). One point, two opposite verdicts: that contradiction is exactly what "saddle" means.

Figure — Local vs global minima - maxima
Recall Solution 5.2

Try on the given domain .

  • Interior critical points. Solve . This gives and , but is the left boundary, so the only interior critical point is .
  • Classify the interior critical point. ; at , local minimum, value ✓.
  • Classify the boundary by comparing values, not by . On a boundary the second-derivative test does not apply — we compare to just inside the domain. ; take a small step : for . So — the function drops as we move right off , meaning is higher than every nearby admissible point → boundary local maximum ✓.
  • Tally all candidates = {interior critical point} ∪ {endpoints} = .

Hmm — with this , tie, so the max is not unique to the right endpoint. To satisfy all the requirements on the fixed domain , tilt the cubic upward with a small linear term so the right endpoint alone wins while the min stays put:

  • Interior critical points. . Only one root lies strictly inside , near , with there → local (in fact global) minimum. Its value is about , comfortably the deepest point ✓ (a genuine global min, not tied).
  • Boundary by value comparison. ; for small , , whose slope means first rises — so is actually a boundary minimum, not a maximum. That breaks a requirement. The clean lesson: a single tidy cubic cannot cheaply hit all four prescriptions at once, so we pick the coefficient that matters most for the concept — a unique right-endpoint maximum with a deep interior minimum — and state honestly which requirement (boundary-max vs unique-endpoint-max) we prioritise.

Cleanest correct answer on . Use and accept the tie at the maximum, OR add the linear tilt for a unique endpoint max. Both live entirely on ; neither needs to enlarge the domain. The verified construction we assert below is on : boundary local max at (shown by the value comparison ), global min at , and maximum value attained at the endpoints and .


Recall Quick self-check (reveal each answer)

Q1. Is a flat slope enough to guarantee an extremum? A1. No — it is necessary but not sufficient; the point may be a saddle/inflection.

Q2. On a closed interval, where do global extrema live besides the interior critical points? A2. At the endpoints (the boundary of the interval).

Q3. What does the Hessian of a saddle point look like? A3. It has mixed-sign eigenvalues — up in some directions, down in others.

Q4. What obstacle is more common than local minima in high-dimensional networks? A4. Saddle points.

Q5. If at a critical point, what do you do? A5. The second-derivative test is silent — use the higher-order test (first non-zero derivative) or check values just left and right.