Maximum and Minimum Values
Where does a function reach its highest and lowest values? This lesson gives the precise definitions of absolute and local extrema, the Extreme Value Theorem that guarantees them on closed intervals, Fermat's theorem with its proof, and the closed interval method that turns "find the maximum" into a finite checklist. For a gentler first look, see Extrema.
Definitions
Let be a number in the domain of .
| Term | Definition |
|---|---|
| absolute (global) maximum at | for every in |
| absolute minimum at | for every in |
| local (relative) maximum at | for every in some open interval around |
| local minimum at | for every in some open interval around |
| critical number | in with or undefined |
The value is the maximum or minimum value; is where it happens. Note that with this definition a local extremum needs an open interval around , so an endpoint of a closed domain is never a local extremum, though it can be an absolute one.
The Extreme Value Theorem
Extreme Value Theorem. If is continuous on a closed interval , then attains an absolute maximum value and an absolute minimum value at some numbers in .
Both hypotheses matter. on is continuous but the interval is not closed: no maximum. on is on a closed interval but jumps at 1: it gets arbitrarily close to 1 and never reaches it on , and . The proof needs the completeness of the real numbers (every bounded set has a least upper bound) and is usually given in a course in real analysis; here we take it as given.
Fermat's theorem
Fermat's Theorem. If has a local maximum or minimum at , and exists, then .
Proof (local maximum; the minimum case is the same with inequalities flipped). For all close enough to 0, , so .
Since exists, both one-sided limits equal it, so , i.e. . ∎
The converse is false: has and no extremum at 0. And an extremum can sit where does not exist, as at 0 shows. So Fermat's theorem says only: local extrema in the interior happen at critical numbers.
The closed interval method
To find the absolute extrema of a continuous on :
- Find the values of at the critical numbers in .
- Find and .
- The largest of these is the absolute maximum, the smallest the absolute minimum.
It works because the extremum exists (EVT), and if it is at an interior point it is a local extremum there, hence at a critical number (Fermat). SymPy does the bookkeeping exactly:
import sympy as sp
x = sp.symbols('x', real=True)
f = x**4 - 4*x**3 + 2*x**2 + 3
a, b = -1, 4
crit = [c for c in sp.solve(sp.diff(f, x), x) if a < c < b]
candidates = crit + [a, b]
for c in candidates:
v = sp.simplify(f.subs(x, c))
print(f"x = {str(c):18} f = {str(v):20} ≈ {float(v):8.4f}")
vals = [f.subs(x, c) for c in candidates]
print("absolute max ≈", round(float(max(vals)), 4), " absolute min ≈", round(float(min(vals)), 4))x = 0 f = 3 ≈ 3.0000
x = 3/2 - sqrt(5)/2 f = -5/2 + 5*sqrt(5)/2 ≈ 3.0902
x = sqrt(5)/2 + 3/2 f = -5*sqrt(5)/2 - 5/2 ≈ -8.0902
x = -1 f = 10 ≈ 10.0000
x = 4 f = 35 ≈ 35.0000
absolute max ≈ 35.0 absolute min ≈ -8.0902
The maximum, 35, is at the endpoint ; the minimum, , is at the critical number . The local maximum is not the absolute one. SymPy prints sqrt(5) for .
A critical number where does not exist
on . Here , which is 0 at and undefined at . Both are critical numbers, and SymPy's solve on only finds the first, so we add the second ourselves:
import sympy as sp
x = sp.symbols('x', real=True)
g = sp.real_root(x, 3)**2 * (x - 5) # real cube root, valid for x < 0 too
t = sp.symbols('t', positive=True) # differentiate where x > 0 to see the formula
print("g'(x) =", sp.factor(sp.diff(t**sp.Rational(2, 3) * (t - 5), t)))
crit = [2, 0] # g' = 0 at 2; g' undefined at 0
for c in crit + [-1, 4]:
print(f"g({c:2}) = {float(g.subs(x, c)): .4f}")g'(x) = 5*(t - 2)/(3*t**(1/3))
g( 2) = -4.7622
g( 0) = 0.0000
g(-1) = -6.0000
g( 4) = -2.5198
The minimum is at an endpoint, and the maximum sits at a cusp, which no derivative test that only solves would find.
In software
- Bounding boxes and culling. To fit an axis-aligned box around a Bézier curve, a renderer finds where each coordinate's derivative is 0 on and checks the endpoints: the closed interval method, solved with a quadratic formula.
- Clamped parameters. In optimisation with box constraints (a learning rate in
[1e−5, 1], a joint angle with limits) the best value is either an interior critical point or a boundary value, exactly as here. Projected gradient methods encode this rule. - Robust code checks both. A frequent bug is to solve and forget endpoints and non-differentiable points (
abs,max, ReLU kinks).
Exercises
Exercise 1: Classify the critical numbers
Find all critical numbers of .
Answer
and .
Solution
Exercise 2: Closed interval method by hand
Find the absolute maximum and minimum of on .
Answer
Maximum 66 at , minimum −15 at .
Solution
The largest is 66 (an endpoint), the smallest −15.
f = lambda x: x**3 - 12*x + 1
pts = [-3, -2, 2, 5]
print({p: f(p) for p in pts}){-3: 10, -2: 17, 2: -15, 5: 66}
Exercise 3: A trigonometric extremum
Find the absolute extrema of on .
Answer
Maximum at ; minimum at .
Solution
import math
h = lambda x: x + 2 * math.cos(x)
for x in [0, math.pi / 6, 5 * math.pi / 6, math.pi]:
print(round(x, 4), round(h(x), 4))0 2.0
0.5236 2.2556
2.618 0.8859
3.1416 1.1416
Exercise 4: Why the hypotheses matter
Give a function on with no absolute maximum, and say which hypothesis of the EVT it breaks.
Answer
For example for , : unbounded near 1, not continuous at 1.
Solution
The interval is closed, so continuity must fail. As , , so no value is largest. Defining keeps defined on all of , but the discontinuity at 1 breaks the theorem's hypothesis.
Test yourself
. What can you conclude?
- is a critical number, nothing more
- has a local extremum at
- has an absolute extremum at
Which function is guaranteed an absolute maximum by the Extreme Value Theorem?
- on
- on
- on
- on
In the closed interval method, which points do you compare?
- Only critical numbers
- Critical numbers in and the endpoints
- Only endpoints
- Points where