Worked examples — Local vs global minima - maxima
This page is a case zoo. The parent note told you the rules — gradient zero, Hessian sign, local vs global. Here we hunt down every kind of situation those rules can produce, so that no exam question and no loss landscape can surprise you.
We build every symbol from scratch. If you have never seen a derivative, read the first callout slowly.
The scenario matrix
Every extremum problem falls into one of these cells. The examples below are labelled with the cell they cover, and together they hit all of them.
| # | Case class | What makes it tricky | Example |
|---|---|---|---|
| A | Interior minimum, | the clean textbook case | Ex 1 |
| B | Interior maximum, | just a sign flip of A | Ex 1 |
| C | Boundary extremum | there, rules break | Ex 2 |
| D | Degenerate (inflection / shelf) | second-derivative test fails | Ex 3 |
| E | Tie: local extremum that is also global, and non-unique | "which is THE min?" | Ex 4 |
| F | Many local minima (multimodal) | global nearest valley | Ex 5 |
| G | Saddle point in 2D | flat but neither min nor max | Ex 6 |
| H | Real-world word problem | translate words → | Ex 7 |
| I | Exam twist: unbounded / no global min | limiting behaviour | Ex 8 |
| J | Plateau: a whole interval of tied minimizers | infinitely many optima | Ex 9 |
Prerequisite links for the practical side: Gradient Descent, Loss Landscape Visualization, Momentum and Nesterov, Adam Optimizer.
Example 1 — Cells A & B: clean interior min and max
-
Find where the slope is flat. So at and . Why this step? A local extremum can only sit where the marble momentarily stops rolling, i.e. slope (the necessary condition from the parent note).
-
Read the sign of on each stretch. For both factors negative → product positive (uphill). Between and one factor flips → negative (downhill). For positive again (uphill). Why this step? Uphill-then-downhill means a peak; downhill-then-uphill means a valley. This alone classifies them without .
-
Confirm with the bowl/cap test. → cap → local maximum (Cell B). → bowl → local minimum (Cell A). Why this step? The second derivative gives the same answer independently — a cross-check.
-
Values. , .
Verify: slope sign flipped at (max) and at (min) — consistent with . Peak height sits above valley , as a peak must. ✓
Example 2 — Cell C: the extremum lives on the boundary
-
Interior critical points first. . But , so there are no interior critical points. Why this step? The gradient-zero rule only finds interior candidates. If none lie inside, the extrema are forced to the ends.
-
Check the two boundary points. , . Why this step? On a closed interval a continuous function always attains its min and max; if not interior, they must be at an endpoint. This is the case the parent note's Step 3 warns you never to skip.
-
Compare. Smallest value at → global minimum. Largest at → global maximum.
Verify: at the slope (still climbing rightward), yet it is the minimum — proof that boundary extrema need not have zero slope. Sanity: for . ✓
Example 3 — Cell D: the second-derivative test breaks
-
Both are critical, both have vanishing curvature test. ; . ; . Why this step? When the test is inconclusive — the curve is flatter than a parabola near , so " vs " cannot decide.
-
Fall back to the sign-of-slope walk (first-derivative test).
- : is negative for , positive for → downhill then uphill → local minimum (and here also global).
- : everywhere, never flips sign → the curve keeps climbing through a flat shelf. This is an inflection point, NOT an extremum. Why this step? The slope-sign walk always works even when the curvature test dies. See figure.

Verify: for all , so really is a strict minimum. For : , values straddle , so it is not an extremum. ✓
Example 4 — Cell E: a local extremum that is also global, non-uniquely
-
Critical points. . Why this step? Necessary condition, same as always.
-
Classify. : → local max; → local min.
-
Evaluate everything, endpoints included (Cell C habit). Why this step? Global-ness is decided only by comparing all candidate values.
-
Read off ties. Minimum value occurs at two points (boundary) and (interior local min). Maximum value occurs at (interior local max) and (boundary). Why this step? Global extrema need not be unique, and an interior local max () can simultaneously be a global max.
Verify: , (tie), , (tie). ✓
Example 5 — Cell F: many valleys, global ≠ nearest
-
Where are the valleys? . Near integers , , so ; the actual valleys sit close to each integer. The bowl term makes deeper integers cost more. Why this step? The cosine carves periodic dips; the parabola tilts the whole floor so the middle dip is deepest.
-
Global minimum. At : , so . This is the lowest because grows and can dip to at most only when is also . Why this step? Both "give-me-lowest" ingredients (small , ) coincide only at .
-
The trap valley near . Gradient descent from moves to the local valley near , where . Far above . Why this step? Downhill-only walking cannot climb the ridge back toward — the core reason Momentum and Nesterov and Adam Optimizer exist.
Read the figure below like a hiker's cross-section. Follow the lavender curve from the butter-yellow dot marked "start ": the ground slopes down toward , so a downhill-only walker rolls into the coral dot at — a genuine valley, but a shallow one. Now look leftward to the mint dot at the very centre: sits far lower, separated from the start by tall ridges the walker cannot climb. The picture's whole message: the nearest valley (coral) is not the deepest valley (mint), which is exactly why plain gradient descent gets trapped.

Verify: ; ; and so the near valley is worse. ✓
Example 6 — Cell G: a genuine 2-D saddle point
-
Gradient zero. , which is at the origin — a critical point. Why this step? The necessary condition holds, so it's a candidate.
-
Hessian (the matrix of second derivatives). Its diagonal entries are the eigenvalues and — mixed signs. Why this step? Positive-definite (all ) = min, negative-definite (all ) = max, mixed = saddle (parent note, Step 2).
-
See it directly. Along the -axis (): , a bowl (min). Along the -axis (): , a cap (max). Same point looks like a valley one way, a summit the other — a mountain pass. Why this step? The eigenvalue signs are literally these two cross-section curvatures.
In the figure below, the two curves are the two cross-sections through the same origin dot (lavender). Trace the mint curve ("along x-axis"): it is a bowl opening upward — from the origin, walking along you go up, so it looks like a minimum. Now trace the coral curve ("along y-axis"): it is a cap opening downward — walking along you go down, so the same origin looks like a maximum. The eigenvalues and are precisely the upward and downward curvatures of these two curves; seeing both signs meet at one point is what "saddle" means.

Verify: (increase along ); (decrease along ). Both increase and decrease at the same point ⇒ saddle. ✓
Example 7 — Cell H: real-world word problem
-
Translate words to a function. Fence covers two depths + one width: . Area: Why this step? Optimisation always needs one variable and a clear objective .
-
Domain. Width must be positive and , so (Cell C awareness).
-
Critical point. . → cap → maximum. Why this step? Negative curvature confirms a peak, not a dip.
-
Check the ends. , , . Why this step? The endpoints give degenerate zero-area pens; the interior peak wins.
Verify: , depth , area . Units: metre × metre = m². The forecasted trade-off holds: half the fence to width, half to the two depths. ✓
Example 8 — Cell I: exam twist, no global minimum exists
-
Limiting behaviour of . As , ; as , . Why this step? If the function runs off to , no lowest value exists — no global minimum. Likewise no global maximum.
-
What about its critical point? at , but (Cell D) it's an inflection, not an extremum. So even the only flat point is not an optimum. Why this step? A student who stops at "found a critical point" would wrongly report as the minimum; we must confirm that this candidate is not even a local extremum before drawing conclusions.
-
The exponential . everywhere → strictly decreasing, never flat. As , (approaches but never reaches ); as , . Why this step? The infimum is but it is never attained — a subtle "no minimum exists" even though values stay positive.
Verify: , — unbounded both ways, so no global extrema. For : for all yet can be made arbitrarily tiny ⇒ min value never reached. ✓
Example 9 — Cell J: a plateau of infinitely many minimizers
-
Read the two pieces. Inside the function is exactly ; outside it climbs as . Why this step? Understanding the shape first tells us the lowest possible value is , achieved on a whole stretch, not a point.
-
Every point of ties for the minimum. Since everywhere and for all , every such is a global minimizer. That is an uncountably infinite set of optima — a plateau. Why this step? The definition of global minimum ( for all ) is satisfied simultaneously by an entire interval, so "the" minimizer does not exist; a set of minimizers does.
-
The gradient test alone would mislead. On the open interval , everywhere — infinitely many critical points, none isolated. The Hessian (here just ) is on the plateau too, so the curvature test is silent (a Cell-D flavour), yet each is a legitimate minimum. Why this step? It shows a degenerate landscape where "flat" means genuinely optimal over a region, not a shelf — common in over-parameterised Neural Network Optimization where many weight settings give identical loss.
Verify: , , (all interior of the plateau equal the minimum), while and (outside is strictly higher), confirming the whole is the minimizing set. ✓
Common Mistakes recap
Recall
Recall A critical point
is automatically a minimum. True or false? False — it can be a max, min, saddle, or inflection. Always check or walk the slope sign. ::: False
Recall When the second-derivative test gives
, what do you do? Fall back to the first-derivative (slope-sign) test; the curvature test is inconclusive. ::: Use the first-derivative test.
Recall On
, why is the minimum of not at ? Because is outside the domain; with no interior critical point the min is forced onto a boundary (). ::: It sits on the boundary.
Recall Give a function with a critical point but no global minimum on
. : it has (an inflection) yet runs to , so no global min. ::: .
Recall Can a function have infinitely many global minimizers?
Yes — a flat-bottomed plateau (e.g. on all of ) makes every point of that interval a global minimizer. ::: Yes, on a plateau.