---
title: Extrema and the Mean Value Theorem
module: Applications of Derivatives
moduleNumber: 3
lessonNumber: 1
order: 301
summary: >
  Absolute and local extrema, the Extreme Value Theorem that guarantees them,
  and Fermat's Theorem pinning candidates to critical numbers. The Closed
  Interval Method turns the search for extrema into a finite checklist. Rolle's
  Theorem and the Mean Value Theorem then connect a function's values to its
  derivative, giving the tool that most of differential calculus rests on.
topics: [Applications of Derivatives]
sources:
  - book: Stewart
    ref: "Ch. 3 — Applications of Differentiation; §3.1 Maximum and Minimum Values"
  - book: Stewart
    ref: "Ch. 3; §3.2 The Mean Value Theorem"
---

Optimization problems ask for the shape of a can that minimizes material, the
branching angle that minimizes the work of pumping blood, the production level
that maximizes profit. Every such problem reduces to locating the largest or
smallest value of a function. Two theorems make the search finite: the Extreme
Value Theorem guarantees that a continuous function on a closed interval attains
its extremes, and Fermat's Theorem pins the interior candidates to points where
the derivative vanishes. The Mean Value Theorem then converts a bound on the
derivative into a bound on the function itself.

## Absolute and local extrema

A function can be large in two different senses: larger than every other value
it takes, or merely larger than its immediate neighbors. Both matter, and they
carry separate names.

> **Definition (Absolute extrema).** Let $c$ be a number in the domain $D$ of a
> function $f$. Then $f(c)$ is the **absolute maximum value** of $f$ on $D$ if
> $f(c) \ge f(x)$ for all $x$ in $D$, and the **absolute minimum value** if
> $f(c) \le f(x)$ for all $x$ in $D$.

> **Definition (Local extrema).** $f(c)$ is a **local maximum value** of $f$ if
> $f(c) \ge f(x)$ when $x$ is near $c$, and a **local minimum value** if
> $f(c) \le f(x)$ when $x$ is near $c$. "Near $c$" means on some open interval
> containing $c$.

Absolute extrema are also called **global** extrema, and the maximum and minimum
values together are the **extreme values** of $f$. A local extremum is a purely
neighborhood property; an absolute extremum is a statement about the whole
domain. An endpoint can be an absolute extremum without being a local one,
because a local extremum requires an _open_ interval on both sides.

$$
% caption: On a closed interval the absolute maximum sits at an endpoint while
% interior peaks and valleys are only local extrema.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-0.3,0) -- (8.6,0) node[right, black!70] {$x$};
\draw[->, black] (0,-0.3) -- (0,4.2) node[above, black!70] {$y$};
\draw[black, very thick]
  (0.4,3.4) .. controls (1.4,1.0) and (2.0,0.8) .. (2.6,1.6)
  .. controls (3.2,2.4) and (4.0,2.6) .. (4.8,1.6)
  .. controls (5.4,0.9) and (6.0,0.6) .. (6.6,1.4)
  .. controls (7.2,2.1) and (7.6,2.6) .. (8.0,3.9);
\fill[acc] (2.6,1.6) circle (2pt) node[below=3pt, black!75] {loc min};
\fill[black] (4.8,1.6) circle (2pt) node[above=3pt, black!75] {loc max};
\fill[black] (6.6,1.4) circle (2pt) node[below=3pt, black!75] {loc min};
\fill[acc] (8.0,3.9) circle (2.4pt) node[above left=1pt, black!75] {abs max};
\draw[dashed, black] (0,3.4) -- (0.4,3.4);
\node[black!75, anchor=east] at (-0.05,3.4) {$f(a)$};
\fill[black] (0.4,3.4) circle (2pt);
\draw[dashed, black] (2.6,0) -- (2.6,1.6);
\node[black!70, anchor=north] at (2.6,-0.05) {abs min};
\end{tikzpicture}
$$

Some functions have extreme values and some do not. The function $f(x) = x^2$
attains its absolute minimum $0$ at the origin but has no maximum; $f(x) = x^3$
has no extreme values at all, local or absolute, since it is strictly
increasing. The following theorem states exactly when existence is guaranteed.

> **Theorem (Extreme Value Theorem).** If $f$ is continuous on a closed interval
> $[a, b]$, then $f$ attains an absolute maximum value $f(c)$ and an absolute
> minimum value $f(d)$ at some numbers $c$ and $d$ in $[a, b]$.

Both hypotheses are needed. Drop continuity and a function can approach a value
it never attains; drop the closed interval, replacing $[a,b]$ with the open
$(a,b)$, and the same failure occurs at the missing endpoints. The theorem is
plausible from a picture but its proof requires the completeness of the real
numbers, so Stewart states it without proof.[^stewart-evt] It is an _existence_
theorem: it promises the extrema exist but says nothing about where they are.

$$
% caption: Both hypotheses are needed: a jump discontinuity lets a function
% approach a bound it never attains, and an open interval lets it grow without
% ever reaching an endpoint.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
% left: discontinuous, no maximum
\begin{scope}
\draw[->, black] (-0.3,0) -- (3.1,0) node[right, black!70] {$x$};
\draw[->, black] (0,-0.3) -- (0,3.5) node[above, black!70] {$y$};
\draw[black, dashed] (0,3.0) -- (2.4,3.0);
\node[black!70, anchor=east] at (-0.05,3.0) {$3$};
\draw[black, very thick] (0.25,0.5) -- (1.9,2.9);
\draw[black, very thick] (1.9,0.9) -- (2.5,1.55);
\fill[acc] (1.9,0.9) circle (1.8pt);
\draw[acc, fill=white, thick] (1.9,2.9) circle (2.2pt);
\node[black!70, anchor=north] at (1.3,-0.35) {jump: the value $3$ is never attained};
\end{scope}
% right: open interval, unbounded
\begin{scope}[xshift=5.2cm]
\draw[->, black] (-0.3,0) -- (3.1,0) node[right, black!70] {$x$};
\draw[->, black] (0,-0.3) -- (0,3.5) node[above, black!70] {$y$};
\draw[black, dashed] (0.35,0) -- (0.35,3.4);
\draw[black, dashed] (2.65,0) -- (2.65,3.4);
\draw[black, very thick] plot[domain=0.36:2.64, samples=110] (\x, {0.42/((\x-0.3)*(2.7-\x))});
\node[black!70, anchor=north] at (1.5,-0.35) {open interval: no largest value};
\end{scope}
\end{tikzpicture}
$$

## Fermat's Theorem and critical numbers

Locating an interior extremum uses one observation about the tangent line. At
the top of a smooth hill or the bottom of a smooth valley, the tangent is
horizontal.

> **Theorem (Fermat's Theorem).** If $f$ has a local maximum or minimum at $c$,
> and if $f'(c)$ exists, then $f'(c) = 0$.

The proof reads the sign of the difference quotient from both sides. Suppose $f$
has a local maximum at $c$. For small $h$, $f(c+h) \le f(c)$, so
$f(c+h) - f(c) \le 0$. Dividing by $h > 0$ keeps the sign, and dividing by
$h < 0$ flips it:

$$
\lim_{h \to 0^+} \frac{f(c+h) - f(c)}{h} \le 0,
\qquad
\lim_{h \to 0^-} \frac{f(c+h) - f(c)}{h} \ge 0.
$$

Both one-sided limits equal $f'(c)$ because the derivative exists, so
$f'(c) \le 0$ and $f'(c) \ge 0$ at once, forcing $f'(c) = 0$.

Two cautions keep Fermat's Theorem from being misread. Its converse is false:
$f'(c) = 0$ does not imply an extremum. And it says nothing when $f'(c)$ fails to
exist, yet an extremum can still occur there.

$$
% caption: Fermat's Theorem has two escape hatches: a horizontal tangent that is
% not an extremum, and an extremum where the derivative fails to exist.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
% left panel: cubic with horizontal tangent, no extremum
\begin{scope}
\draw[->, black] (-1.6,0) -- (1.6,0) node[right, black!70] {$x$};
\draw[->, black] (0,-1.6) -- (0,1.7) node[above, black!70] {$y$};
\draw[black, very thick] plot[domain=-1.18:1.18, samples=60] (\x, {\x*\x*\x});
\draw[black, dashed] (-1.1,0) -- (1.1,0);
\fill[acc] (0,0) circle (2pt);
\node[black!70, anchor=north] at (0,-1.75) {$y=x^3$: horizontal tangent at $0$, no extremum};
\end{scope}
% right panel: absolute-value cusp, extremum with no derivative
\begin{scope}[xshift=5.2cm]
\draw[->, black] (-1.6,0) -- (1.6,0) node[right, black!70] {$x$};
\draw[->, black] (0,-0.4) -- (0,1.9) node[above, black!70] {$y$};
\draw[black, very thick] (-1.3,1.3) -- (0,0) -- (1.3,1.3);
\fill[acc] (0,0) circle (2pt);
\node[black!70, anchor=north] at (0,-0.5) {V-shaped graph: min at $0$, no derivative there};
\end{scope}
\end{tikzpicture}
$$

Both failure modes point to the same set of candidates: the places where the
derivative is zero, plus the places where it does not exist.

> **Definition (Critical number).** A **critical number** of a function $f$ is a
> number $c$ in the domain of $f$ such that either $f'(c) = 0$ or $f'(c)$ does
> not exist.

Fermat's Theorem, restated: if $f$ has a local extremum at $c$, then $c$ is a
critical number. Local extrema occur only at critical numbers, so the search
narrows to that (usually finite) list.

For example, the critical numbers of $f(x) = x^{3/5}(4 - x)$ come from the
product rule. Writing $f(x) = 4x^{3/5} - x^{8/5}$,

$$
f'(x) = \tfrac{12}{5}x^{-2/5} - \tfrac{8}{5}x^{3/5}
       = \frac{12 - 8x}{5x^{2/5}}.
$$

The numerator vanishes at $x = \tfrac{3}{2}$, giving $f'(x) = 0$; the
denominator vanishes at $x = 0$, where $f'$ does not exist. Both $0$ and
$\tfrac{3}{2}$ are critical numbers, so both must be tested.

## The Closed Interval Method

On a closed interval an absolute extremum is either a local extremum, which lands
on a critical number by Fermat's Theorem, or it occurs at an endpoint. That
dichotomy is exhaustive, so a three-step procedure always finds the absolute
extrema of a continuous function on $[a, b]$.

```algorithm
caption: $\textsc{ClosedIntervalMethod}(f, a, b)$ — absolute extrema of a continuous $f$ on $[a,b]$
find every critical number $c$ of $f$ in the open interval $(a, b)$
evaluate $f(c)$ at each such critical number
evaluate $f$ at the two endpoints $a$ and $b$
return the largest of these values as the absolute maximum
return the smallest of these values as the absolute minimum
```

The method is finite because the candidate list is finite. There is no need to
decide _which_ critical numbers are maxima and which are minima; comparing the
values sorts that out at the end.

Consider $f(x) = x^3 - 3x^2 + 1$ on $\left[-\tfrac{1}{2}, 4\right]$. Since $f$ is
a polynomial it is continuous, and $f'(x) = 3x^2 - 6x = 3x(x-2)$ exists
everywhere, so the only critical numbers are $x = 0$ and $x = 2$, both inside the
interval. Tabulating the four candidates:

| $x$ | role | $f(x)$ |
| --- | --- | --- |
| $-\tfrac{1}{2}$ | endpoint | $\tfrac{1}{8}$ |
| $0$ | critical | $1$ |
| $2$ | critical | $-3$ |
| $4$ | endpoint | $17$ |

The absolute maximum is $f(4) = 17$ and the absolute minimum is $f(2) = -3$. The
maximum happens to sit at an endpoint and the minimum at an interior critical
number; the method does not distinguish, since it only compares the tabulated
values.

> **Worked example.** Find the absolute extrema of $f(x) = x - 2\sin x$ on
> $[0, 2\pi]$. The function is continuous, and $f'(x) = 1 - 2\cos x$ exists
> everywhere, so the critical numbers solve $\cos x = \tfrac{1}{2}$, giving
> $x = \tfrac{\pi}{3}$ and $x = \tfrac{5\pi}{3}$, both interior to the interval.
> Tabulating the four candidates,
>
> $$
> f(0) = 0, \quad
> f\!\left(\tfrac{\pi}{3}\right) = \tfrac{\pi}{3} - \sqrt{3} \approx -0.68, \quad
> f\!\left(\tfrac{5\pi}{3}\right) = \tfrac{5\pi}{3} + \sqrt{3} \approx 6.97, \quad
> f(2\pi) = 2\pi \approx 6.28.
> $$
>
> The absolute maximum is $f(5\pi/3) = 5\pi/3 + \sqrt{3}$ and the absolute
> minimum is $f(\pi/3) = \pi/3 - \sqrt{3}$. Both extrema land on interior
> critical numbers and outrun the endpoint values, the reverse of the polynomial
> case above.

$$
% caption: The graph of $y = x - 2\sin x$ on $[0, 2\pi]$: absolute minimum and
% maximum both fall at interior critical numbers, beating the endpoint heights.
\begin{tikzpicture}[xscale=0.95, yscale=0.5, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-0.3,0) -- (6.9,0) node[right, black!70] {$x$};
\draw[->, black] (0,-1.4) -- (0,7.8) node[above, black!70] {$y$};
\draw[black, very thick] plot[domain=0:6.283, samples=100] (\x, {\x - 2*sin(\x r)});
\fill[acc] (1.047,-0.685) circle (2.4pt) node[below right=1pt, black!75] {abs min};
\fill[acc] (5.236,6.968) circle (2.4pt) node[above left=1pt, black!75] {abs max};
\fill[black] (0,0) circle (1.6pt);
\fill[black] (6.283,6.283) circle (1.8pt) node[right, black!75] {endpoint};
\draw[dashed, black] (1.047,0) -- (1.047,-0.685);
\draw[dashed, black] (5.236,0) -- (5.236,6.968);
\end{tikzpicture}
$$

## Rolle's Theorem

The Mean Value Theorem follows from a special case in which the endpoints share a
height. If a differentiable function returns to the same value, its derivative
must vanish somewhere between.

> **Theorem (Rolle's Theorem).** Let $f$ satisfy three hypotheses: $f$ is
> continuous on $[a, b]$, $f$ is differentiable on $(a, b)$, and
> $f(a) = f(b)$. Then there is a number $c$ in $(a, b)$ with $f'(c) = 0$.

$$
% caption: Rolle's Theorem: equal endpoint heights force a horizontal tangent at
% some interior point, at a peak or a valley.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-0.3,0) -- (7.2,0) node[right, black!70] {$x$};
\draw[->, black] (0,-0.3) -- (0,3.4) node[above, black!70] {$y$};
\draw[dashed, black] (1.0,2.0) -- (6.0,2.0);
\draw[black, very thick]
  (1.0,2.0) .. controls (2.4,3.6) and (3.0,3.4) .. (3.5,2.8)
  .. controls (4.0,2.2) and (4.6,1.0) .. (6.0,2.0);
\fill[black] (1.0,2.0) circle (2pt) node[left, black!75] {$A$};
\fill[black] (6.0,2.0) circle (2pt) node[right, black!75] {$B$};
% horizontal tangent at the peak near x=2.6
\draw[acc, thick] (1.85,3.42) -- (3.35,3.42);
\fill[acc] (2.6,3.42) circle (2pt);
\draw[dashed, black] (2.6,0) -- (2.6,3.42);
\node[black!75, anchor=north] at (2.6,-0.05) {$c$};
\node[black!70] at (3.7,3.7) {horizontal tangent};
\end{tikzpicture}
$$

The proof splits into three cases. If $f$ is constant, then $f' = 0$ everywhere
and any $c$ works. Otherwise $f$ takes some value above or below the common
endpoint height. Suppose it rises above: by the Extreme Value Theorem $f$ attains
a maximum on $[a,b]$, and since the endpoints share the lower value that maximum
occurs at an interior $c$. Then $f$ has a local maximum at $c$, $f$ is
differentiable there, and Fermat's Theorem gives $f'(c) = 0$. The case where $f$
dips below is symmetric, using the minimum.

To show $x^3 + x - 1 = 0$ has exactly one real root, first note the [Intermediate Value Theorem](/calculus/limits-and-continuity/continuity)
forces a root: $f(0) = -1 < 0$ and $f(1) = 1 > 0$. Suppose there were two roots
$a$ and $b$. Then $f(a) = f(b) = 0$, and Rolle's Theorem would produce a $c$ with
$f'(c) = 0$. But $f'(x) = 3x^2 + 1 \ge 1$ is never zero, a contradiction. So the
root is unique.

## The Mean Value Theorem

The Mean Value Theorem generalizes Rolle's Theorem. Instead of requiring equal
endpoint heights, it compares the derivative to the average slope across the
interval.

> **Theorem (Mean Value Theorem).** Let $f$ be continuous on $[a, b]$ and
> differentiable on $(a, b)$. Then there is a number $c$ in $(a, b)$ such that
>
> $$
> f'(c) = \frac{f(b) - f(a)}{b - a},
> \qquad\text{equivalently}\qquad
> f(b) - f(a) = f'(c)(b - a).
> $$

The right-hand quotient is the slope of the secant line through $A(a, f(a))$ and
$B(b, f(b))$. The theorem asserts that at some interior point the tangent line is
parallel to that secant.[^stewart-mvt]

$$
% caption: The Mean Value Theorem: at some interior $c$ the tangent (slope
% $f'(c)$) runs parallel to the secant chord $AB$.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-0.3,0) -- (7.6,0) node[right, black!70] {$x$};
\draw[->, black] (0,-0.3) -- (0,4.0) node[above, black!70] {$y$};
\draw[black, very thick]
  (0.8,0.7) .. controls (2.6,1.5) and (3.4,3.5) .. (6.8,3.5);
\coordinate (A) at (0.8,0.7);
\coordinate (B) at (6.8,3.5);
% secant AB
\draw[black, thick] (A) -- (B);
\fill[black] (A) circle (2pt) node[below, black!75] {$A$};
\fill[black] (B) circle (2pt) node[right, black!75] {$B$};
% tangent parallel to AB at c approx x=3.6, on curve
\coordinate (P) at (3.6,2.63);
\draw[acc, thick] (2.2,2.0) -- (5.0,3.3);
\fill[acc] (P) circle (2pt) node[above left=0pt, black!75] {$P$};
\draw[dashed, black] (3.6,0) -- (P);
\node[black!75, anchor=north] at (3.6,-0.05) {$c$};
\node[black!70, anchor=west] at (5.05,3.35) {tangent};
\node[black!70, anchor=west] at (5.6,2.35) {secant};
\end{tikzpicture}
$$

The proof applies Rolle's Theorem to the gap between $f$ and its own secant line.
Let

$$
h(x) = f(x) - \left[ f(a) + \frac{f(b) - f(a)}{b - a}(x - a) \right],
$$

the vertical distance from the curve down to the chord. Then $h$ is continuous on
$[a,b]$, differentiable on $(a,b)$, and $h(a) = h(b) = 0$, so Rolle's Theorem
gives a $c$ with $h'(c) = 0$. Differentiating,

$$
h'(x) = f'(x) - \frac{f(b) - f(a)}{b - a},
$$

so $h'(c) = 0$ restates the Mean Value Theorem's conclusion.

Interpreted kinematically: if $s = f(t)$ is position, then the secant
slope is the average velocity and $f'(c)$ is the instantaneous velocity at time
$c$. A car that covers $180$ km in $2$ hours averages $90$ km/h, so its
speedometer read exactly $90$ km/h at some instant. More generally, the
instantaneous rate of change equals the average rate of change somewhere on the
interval.

> **Worked example.** Locate the number $c$ guaranteed by the Mean Value Theorem
> for $f(x) = x^3 - x$ on $[0, 2]$. As a polynomial, $f$ meets both hypotheses.
> With $f(0) = 0$ and $f(2) = 6$, the secant slope is
>
> $$
> \frac{f(2) - f(0)}{2 - 0} = \frac{6}{2} = 3.
> $$
>
> Setting $f'(c) = 3c^2 - 1$ equal to $3$ gives $3c^2 = 4$, so
> $c = \pm\frac{2}{\sqrt{3}}$. Only $c = \frac{2}{\sqrt{3}} \approx 1.15$ lies in
> $(0, 2)$; at that point the tangent runs parallel to the secant through
> $(0, 0)$ and $(2, 6)$.

### Consequences

The Mean Value Theorem converts information about $f'$ into information about $f$.
Two consequences follow at once.

> **Theorem (Constant Function Theorem).** If $f'(x) = 0$ for all $x$ in an
> interval $(a, b)$, then $f$ is constant on $(a, b)$.

For any two points $x_1 < x_2$ in the interval, the Mean Value Theorem gives a
$c$ with $f(x_2) - f(x_1) = f'(c)(x_2 - x_1) = 0$, so $f(x_2) = f(x_1)$. All
values agree, so $f$ is constant. The interval hypothesis is essential:
$f(x) = x/|x|$ has zero derivative on its whole domain yet is not constant,
because that domain, $\{x : x \ne 0\}$, is not an interval.

> **Corollary.** If $f'(x) = g'(x)$ for all $x$ in an interval, then $f - g$ is
> constant there, so $f(x) = g(x) + C$ for some constant $C$.

Applying the previous theorem to $F = f - g$ gives $F' = f' - g' = 0$, hence $F$
is constant. Two functions with matching derivatives differ by a vertical shift.
This is the fact that makes [antiderivatives](/calculus/applications-of-derivatives/newtons-method-and-antiderivatives)
a family of curves differing by a constant, and it is the basis of the
[Fundamental Theorem of Calculus](/calculus/integrals/the-fundamental-theorem-of-calculus).

The Mean Value Theorem also bounds a function from a bound on its slope. If
$f(0) = -3$ and $f'(x) \le 5$ for all $x$, how large can $f(2)$ be? On $[0,2]$
there is a $c$ with $f(2) - f(0) = f'(c)(2 - 0)$, so
$f(2) = -3 + 2f'(c) \le -3 + 2(5) = 7$. The largest possible value of $f(2)$ is
$7$.

[^stewart-evt]: Stewart, §3.1 — Maximum and Minimum Values: the Extreme Value Theorem and its two hypotheses (continuity and a closed interval), stated without proof; Fermat's Theorem, critical numbers, and the Closed Interval Method.
[^stewart-mvt]: Stewart, §3.2 — The Mean Value Theorem: Rolle's Theorem and the Mean Value Theorem with the secant-tangent construction, the Constant Function Theorem, and its corollary on functions with equal derivatives.
