Foundations to Frontier
Tests
A. Mathematical Foundations › A3 Calculus and Analysis › Single-variable calculus

Optimization in One Variable: Critical Points and the Second-Derivative Test

To find the best value, look where the slope is zero, check the curvature, and don't forget the endpoints. One-variable optimization is the building block of line searches, learning-rate choice and engineering design, and it even rediscovers the law of refraction.

Level 0: Foundation

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

Flat at the top, flat at the bottom

Walk over a hill. Going up, the ground slopes up; going down, it slopes down. At the very top, for an instant, it’s flat. The same happens at the bottom of a valley. So to find the highest or lowest point, look for where the slope is zero. These are the critical points.

But flat doesn’t tell you which: the top of a hill and the bottom of a bowl are both flat. Check whether the ground curves like a cup (a minimum) or a cap (a maximum).

Critical points, the second-derivative test and global extremes
f(x) = a x⁴ + b x³ + c x² + d x on [−2, 2]
critical points: x = -1.036 (local min), x = 0.075 (local max), x = 0.960 (local min)
global min -1.305 at x = -1.036 · global max 8.600 at x = 2.000 (an endpoint wins!)
Green = concave up (f″ ≥ 0, cup), orange = concave down (cap). Hollow dots = critical points (f′ = 0); blue/purple rings = global min/max on the closed interval, which may sit at an endpoint. Try a = 1, b = c = d = 0 (x⁴: f″(0) = 0, test inconclusive, yet a minimum).
Why engineers care

Engineers constantly ask “what’s the best?”: the lightest beam that won’t break, the antenna angle with the strongest signal, the fuel burn that maximizes a spacecraft’s range. Each of these, at its heart, is “find where the derivative is zero”.

📝 Quick check (Level 0)
0/3 answered
  1. 1. At the very top of a smooth hill, the slope is…
  2. 2. A cup shape has its flat point at a…
  3. 3. With 20 m of fence, which rectangle encloses the most area?

Level 1: Beginner

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

The recipe

  1. Solve f′(x)=0f'(x) = 0 for the critical points.
  2. Classify each one with the second derivative: f′′>0f''>0 means a cup, so a local min; f′′<0f''<0 means a cap, so a local max; f′′=0f'' = 0 means the test is inconclusive.

Example. For f(x)=x3−3xf(x) = x^3 - 3x: f′(x)=3x2−3=0f'(x) = 3x^2 - 3 = 0 gives x=±1x = \pm1. Then f′′(x)=6xf''(x) = 6x, so f′′(1)=6>0f''(1) = 6>0 (a local min, f(1)=−2f(1) = -2) and f′′(−1)=−6<0f''(-1) = -6<0 (a local max, f(−1)=2f(-1) = 2).

Example. For x2−6xx^2 - 6x: 2x−6=02x - 6 = 0 gives x=3x = 3. Since f′′=2>0f'' = 2>0, this is a minimum, with value −9-9.

📝 Quick check (Level 1)
0/3 answered
  1. 1. The critical point of x² − 6x?
  2. 2. x³ − 3x at x = 1 is a…
  3. 3. f″(c) < 0 at a critical point means…

Level 2: Intermediate

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

Global extremes on [a,b][a,b]

By the extreme value theorem (A3.1-1), a continuous ff has a global max and min on [a,b][a,b]. They occur at critical points or at the endpoints. So you compare ff at all of them (the closed-interval method). On [−1.5,2.5][-1.5, 2.5], the maximum of x3−3xx^3 - 3x is at the endpoint x=2.5x = 2.5 (value 8.125), not at the local max x=−1x = -1 (value 2).

When the second-derivative test is silent

x4x^4, −x4-x^4 and x3x^3 all have f′(0)=f′′(0)=0f'(0) = f''(0) = 0, but they give a min, a max and neither. Use the first-derivative test instead: does f′f' change sign from − to + (a min) or from + to − (a max)?

Convexity makes everything easy

If f′′≥0f''\ge0 everywhere (ff is convex), then any critical point is a global minimum. This is the single most important fact in optimization (A6), and the reason convex problems are “solved”.

Classic problems

Problem Objective Answer
box from a 30 × 30 sheet V=x(30−2x)2V = x(30-2x)^2 x=5x = 5, V=2000V = 2000
best constant estimate ∑(x−ai)2\sum(x - a_i)^2 the mean
robust estimate ∑∣x−ai∣\sum\lvert x - a_i\rvert the median (not differentiable at the data points)
fence enclosure, perimeter PP x(P/2−x)x(P/2 - x) a square
🐍 Exercise 1: two ways to optimize the box
Implement golden-section search (no derivatives) and Newton's method on V′. Find the best cut x = 5 (V = 2000), confirm it's a max with V″, and compare the iteration counts.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Minimizing Σ(x − aᵢ)² gives…
  2. 2. Global extremes on [a, b] can occur at…
  3. 3. f″ ≥ 0 everywhere means every critical point is…

Level 3: Advanced

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

Why the second-derivative test works

If f′(c)=0f'(c) = 0 and f′′(c)>0f''(c)>0, then f′f' is increasing near cc. So f′<0f'<0 just left of cc and f′>0f'>0 just right of it. By the MVT, ff decreases and then increases, so cc is a strict local min. ∎ Equivalently, Taylor’s theorem (A3.1-10) gives f(c+h)=f(c)+12f′′(ξ)h2f(c + h) = f(c) + \tfrac12f''(\xi)h^2, which is positive near cc.

Convexity, three ways

For twice-differentiable ff, these are equivalent:

  1. f(λx+(1−λ)y)≤λf(x)+(1−λ)f(y)f(\lambda x + (1-\lambda)y)\le\lambda f(x) + (1-\lambda)f(y) (chords lie above the graph; Jensen, A1).
  2. f(y)≥f(x)+f′(x)(y−x)f(y)\ge f(x) + f'(x)(y - x) (tangents lie below the graph).
  3. f′′≥0f''\ge0 (f′f' is non-decreasing).

Form 2 gives the key theorem at once: if f′(x∗)=0f'(x^*) = 0, then f(y)≥f(x∗)f(y)\ge f(x^*) for all yy. ∎

Inflection points are where the concavity changes. x3−3xx^3 - 3x has one at x=0x = 0, where f′′=6xf'' = 6x changes sign.

Exercise 3.1: Why does minimizing Σ|x − aᵢ| give the median?

For xx not equal to any data point, the derivative is (number of points below xx) − (number above). It is negative until half the points are below and positive after. So the minimum is where the count balances: the median.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Where is the inflection point of x³ − 3x?
  2. 2. Is eˣ convex?
  3. 3. For a convex differentiable f, the tangent line…

Level 4: Expert

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

Fermat’s principle: optimization rediscovers physics

Light takes the path of least time (Fermat, 1662). A robot crossing from pavement (fast) to grass (slow) faces the same problem. Minimizing the travel time T(x)T(x) over the crossing point, and setting T′(x)=0T'(x) = 0, gives Snell’s law sin⁡θ1/v1=sin⁡θ2/v2\sin\theta_1/v_1 = \sin\theta_2/v_2. Path planners for mixed terrain (planetary rovers on sand and rock) use exactly these cost-weighted optimal paths.

🐍 Exercise 2 (research): the fastest path across two terrains
Minimize a robot's travel time across pavement (2 m/s) then grass (0.8 m/s) by Newton on T′. Beat the straight line by about 15 s, and verify Snell's law to 10⁻¹².

One-dimensional optimization inside big optimizers

  • Line search. Most multivariable optimizers choose a direction, then solve a 1-D problem along it. Exact search (golden section, Brent’s method; Brent, 1973) or inexact search with the Armijo/Wolfe conditions (Armijo, 1966; Wolfe, 1969) is standard in L-BFGS and robot trajectory optimizers.
  • Newton’s method for optimization, x←x−f′(x)/f′′(x)x\leftarrow x - f'(x)/f''(x), converges quadratically near a minimum. But it heads for any critical point: started near a maximum, it converges to the maximum (Practice Code 4). Practical versions check f′′>0f''>0 or use trust regions.
  • Learning-rate selection is a 1-D optimization problem. “LR range tests” sweep it and look for the steepest loss decrease (Smith, 2017).
  • Robust statistics. Choosing squared vs absolute (or Huber) loss changes the optimum from the mean to the median. This matters with outlier sensor readings (Huber, 1964).

References

  1. P. de Fermat (c. 1636). Methodus ad disquirendam maximam et minimam. Fermat’s principle of least time: letter of 1662.
  2. J. Kiefer (1953). “Sequential minimax search for a maximum.” Proceedings of the AMS, 4(3). (Golden-section/Fibonacci search.)
  3. P. Huber (1964). “Robust estimation of a location parameter.” Annals of Mathematical Statistics, 35(1).
  4. L. Armijo (1966). “Minimization of functions having Lipschitz continuous first partial derivatives.” Pacific Journal of Mathematics, 16(1).
  5. P. Wolfe (1969). “Convergence conditions for ascent methods.” SIAM Review, 11(2).
  6. R. Brent (1973). Algorithms for Minimization without Derivatives. Prentice-Hall.
  7. J. Nocedal, S. Wright (2006). Numerical Optimization, 2nd ed. Springer. Chapter 3.
  8. L. Smith (2017). “Cyclical learning rates for training neural networks.” WACV.