---
title: The Mean Value Theorem
module: Differentiation
moduleNumber: 5
lessonNumber: 2
order: 502
summary: >
  A relative extremum in the interior forces the derivative to vanish; Rolle's
  theorem and the mean value theorem turn that local fact into global control.
  The sign of the derivative fixes monotonicity, a bounded derivative yields a
  Lipschitz bound, and Darboux's theorem shows derivatives have the intermediate
  value property even where they are discontinuous.
topics: [Differentiation]
sources:
  - book: Lebl
    ref: "Ch. 4 — The Derivative; §4.2 Mean value theorem"
  - book: Rosenlicht
    ref: "Ch. 5 — Differentiation"
draft: false
---

The [derivative](/real-analysis/differentiation/the-derivative) is a local
object: $f'(c)$ depends only on an arbitrarily small neighborhood of $c$. The mean
value theorem carries that local information to global conclusions about $f$
across a whole interval. It rests on one lemma about extrema, then Rolle's
theorem, then a single tilt of the picture.

## Vanishing derivatives at interior extrema

Absolute maxima and minima are the highest and lowest values a function attains.
A **relative** extremum is highest or lowest only among nearby
points.

> **Definition (Relative extremum).** Let $S \subseteq \mathbb{R}$ and
> $f : S \to \mathbb{R}$. Then $f$ has a **relative maximum** at $c \in S$ if
> there is a $\delta > 0$ with $f(x) \leq f(c)$ for all $x \in S$ satisfying
> $|x - c| < \delta$. A **relative minimum** is defined with the inequality
> reversed.

At an interior relative extremum a differentiable function must have zero slope.
This is **Fermat's stationary-point condition**.

> **Lemma (Fermat).** If $f : (a, b) \to \mathbb{R}$ is differentiable at
> $c \in (a, b)$ and has a relative minimum or maximum at $c$, then $f'(c) = 0$.[^lebl-fermat]

> **Proof.** Suppose $c$ is a relative maximum, so $f(x) - f(c) \leq 0$ for $x$
> within $\delta$ of $c$. The difference quotient then has a definite sign on each
> side:
> $$
> \frac{f(x) - f(c)}{x - c} \leq 0 \ \ (c < x < c + \delta),
> \qquad
> \frac{f(x) - f(c)}{x - c} \geq 0 \ \ (c - \delta < x < c).
> $$
> Taking $x \to c^+$ gives $f'(c) \leq 0$; taking $x \to c^-$ gives
> $f'(c) \geq 0$. Both hold, so $f'(c) = 0$. For a minimum apply the result to
> $-f$. $\blacksquare$

A point where $f'(c) = 0$ (or where $f'$ fails to exist) is a **critical point**.
Fermat's lemma says an interior extremum is always a critical point, which
reduces optimization on an interval to a finite search.

```algorithm
caption: locating the absolute extrema of a continuous $f$ on $[a, b]$
collect the critical points: every $c \in (a, b)$ where $f'(c) = 0$ or $f'(c)$ fails to exist
form the candidate set $S = \{\text{critical points}\} \cup \{a, b\}$
for each $x \in S$ do
  evaluate $f(x)$
return the point of largest $f$ as the maximum and of smallest $f$ as the minimum
```

The endpoints join the search because Fermat's lemma is silent there; an
extremum at $a$ or $b$ need not be critical. The procedure is exhaustive
precisely because a continuous $f$ on a closed bounded interval attains its
extrema (the [extreme value theorem](/real-analysis/continuity/evt-ivt)), and an
interior one must be critical.

## Rolle's theorem

If a differentiable function returns to its starting height, it must turn around
somewhere in between, and at the turning point the tangent is horizontal.

> **Theorem (Rolle).** Let $f : [a, b] \to \mathbb{R}$ be continuous on
> $[a, b]$ and differentiable on $(a, b)$, with $f(a) = f(b)$. Then there is a
> $c \in (a, b)$ with $f'(c) = 0$.[^lebl-rolle]

> **Proof.** By the extreme value theorem $f$ attains an absolute maximum and an
> absolute minimum on $[a, b]$. Write $K = f(a) = f(b)$. If some $f(x) > K$, the
> maximum exceeds $K$ and so is attained at an interior $c$, where Fermat's lemma
> gives $f'(c) = 0$. If some $f(x) < K$, the minimum is interior by the same
> argument. If neither happens then $f \equiv K$ is constant and $f' \equiv 0$
> throughout, so any $c$ works. $\blacksquare$

$$
% caption: Rolle's theorem. Equal endpoint heights force a turning point in the
% interior where the tangent is horizontal.
\begin{tikzpicture}[scale=1.0,>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,->] (-0.2,0) -- (5.4,0) node[right]{x};
\draw[black,->] (0,-0.2) -- (0,3.2) node[above]{y};
\draw[thick,black] (0.6,1.2) to[out=45,in=180] (2.6,2.6) to[out=0,in=135] (4.6,1.2);
\draw[black,dashed] (0.6,1.2) -- (4.6,1.2);
\draw[acc,very thick] (1.7,2.6) -- (3.5,2.6);
\fill[acc] (2.6,2.6) circle (1.8pt);
\node[above,acc] at (2.6,2.7) {horizontal tangent};
\fill[black] (0.6,1.2) circle (1.3pt);
\fill[black] (4.6,1.2) circle (1.3pt);
\node[below] at (0.6,1.15) {a};
\node[below] at (2.6,-0.02) {c};
\node[below] at (4.6,1.15) {b};
\end{tikzpicture}
$$

Differentiability on all of $(a, b)$ cannot be dropped. The function $|x|$ on
$[-1, 1]$ has equal endpoint values but no point where the derivative is zero,
because of the corner at the origin where $f'$ does not exist.

Reading Rolle's theorem backwards bounds how many roots a function can have: a
root of $f'$ sits between any two roots of $f$, so few roots of $f'$ mean few
roots of $f$.

> **Worked example (Counting real roots with Rolle).** The polynomial
> $p(x) = x^4 - 4x + c$ has at most two distinct real roots, whatever the
> constant $c$. Its derivative
> $$
> p'(x) = 4x^3 - 4 = 4(x^3 - 1)
> $$
> vanishes only at $x = 1$. If $p$ had three distinct real roots
> $r_1 < r_2 < r_3$, Rolle's theorem applied to $[r_1, r_2]$ and to $[r_2, r_3]$
> would produce two distinct roots of $p'$, one in each open interval. But $p'$
> has a single real root, so $p$ has at most two distinct real roots.

## The mean value theorem

Tilt Rolle's picture. Instead of equal endpoints, allow $f(a) \neq f(b)$ and
compare the tangent slope against the slope of the **secant** joining the two
endpoints.

> **Theorem (Mean value theorem).** Let $f : [a, b] \to \mathbb{R}$ be continuous
> on $[a, b]$ and differentiable on $(a, b)$. Then there is a $c \in (a, b)$ with
> $$
> f(b) - f(a) = f'(c)\,(b - a),
> \qquad\text{equivalently}\qquad
> f'(c) = \frac{f(b) - f(a)}{b - a}.
> $$

The right-hand ratio is the slope of the secant through
$\bigl(a, f(a)\bigr)$ and $\bigl(b, f(b)\bigr)$; the theorem asserts that the
tangent at some interior $c$ is parallel to it. The name reflects that the secant
slope is the _average_ (mean) value of the derivative, and the average is
actually achieved somewhere inside.

> **Proof.** Subtract the secant line from $f$. Define
> $$
> g(x) = f(x) - f(b) - \frac{f(b) - f(a)}{b - a}\,(x - b).
> $$
> Then $g$ is continuous on $[a, b]$, differentiable on $(a, b)$, and
> $g(a) = g(b) = 0$. Rolle's theorem supplies a $c \in (a, b)$ with $g'(c) = 0$,
> that is
> $$
> 0 = g'(c) = f'(c) - \frac{f(b) - f(a)}{b - a}. \qquad \blacksquare
> $$

$$
% caption: The mean value theorem. The tangent at some interior c runs parallel
% to the secant joining the endpoints, matching the average slope.
\begin{tikzpicture}[scale=1.0,>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,->] (-0.2,0) -- (5.6,0) node[right]{x};
\draw[black,->] (0,-0.2) -- (0,3.6) node[above]{y};
\draw[thick,black] (0.6,0.7) to[out=55,in=210] (2.4,2.2) to[out=30,in=200] (4.8,3.2);
\draw[black,dashed] (0.6,0.7) -- (4.8,3.2);
\node[black] at (1.5,1.15) {chord};
\draw[acc,very thick] (1.9,1.05) -- (3.9,2.75);
\node[acc] at (3.6,2.25) {tangent};
\fill[acc] (2.9,1.9) circle (1.8pt);
\fill[black] (0.6,0.7) circle (1.3pt);
\fill[black] (4.8,3.2) circle (1.3pt);
\node[below] at (0.6,0.65) {a};
\node[below] at (2.9,-0.02) {c};
\node[below] at (4.8,3.15) {b};
\end{tikzpicture}
$$

A more symmetric version replaces the linear comparison function by a second
function $\varphi$, giving **Cauchy's mean value theorem**: for continuous
$f, \varphi$ differentiable on $(a, b)$ there is a $c$ with
$$
\bigl(f(b) - f(a)\bigr)\varphi'(c) = f'(c)\bigl(\varphi(b) - \varphi(a)\bigr).
$$
Taking $\varphi(x) = x$ recovers the ordinary theorem. This form underlies both
[Taylor's theorem](/real-analysis/differentiation/taylors-theorem) and
L'Hôpital's rule.

| Theorem | Endpoint hypothesis | Conclusion at some $c \in (a,b)$ |
| --- | --- | --- |
| Rolle | $f(a) = f(b)$ | $f'(c) = 0$ |
| Mean value | none | $f(b) - f(a) = f'(c)(b - a)$ |
| Cauchy | none, on a pair $f, \varphi$ | $\bigl(f(b)-f(a)\bigr)\varphi'(c) = f'(c)\bigl(\varphi(b)-\varphi(a)\bigr)$ |

## From the sign of $f'$ to the shape of $f$

The typical use of the mean value theorem is to remove a limit: it replaces the
difference quotient by an _exact_ derivative at some interior point, converting
inequalities on $f'$ into inequalities on $f$.

**A vanishing derivative means constant.** If $f'(x) = 0$ for all $x$ in an
interval $I$, then $f$ is constant. For any $x < y$ in $I$ the theorem gives a
$c$ with $f(y) - f(x) = f'(c)(y - x) = 0$, so $f(y) = f(x)$. This is the first
differential equation solved in the subject: $f' = 0$ has only the constant
solutions.[^lebl-const]

**The sign of $f'$ controls monotonicity.**

> **Proposition (Monotonicity test).** Let $f : I \to \mathbb{R}$ be
> differentiable. Then $f$ is increasing on $I$ if and only if $f'(x) \geq 0$ for
> all $x \in I$, and decreasing if and only if $f'(x) \leq 0$ throughout. If
> $f'(x) > 0$ for all $x$ then $f$ is strictly increasing; if $f'(x) < 0$ then
> strictly decreasing.[^lebl-mono]

> **Proof.** If $f$ is increasing, every difference quotient is $\geq 0$, and the
> limit $f'(c) \geq 0$. Conversely, if $f' \geq 0$ then for $x < y$ the theorem
> gives $f(y) - f(x) = f'(c)(y - x) \geq 0$. The strict statements use
> $f'(c) > 0$ and $y - x > 0$. $\blacksquare$

$$
% caption: The sign of the derivative reads off the shape: where the tangent
% slopes up the function rises, where it slopes down the function falls, and the
% turning point is where the sign changes.
\begin{tikzpicture}[scale=1.0,>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,->] (-0.2,0) -- (6.0,0) node[right]{x};
\draw[black,->] (0,-0.2) -- (0,3.4) node[above]{y};
\draw[thick,black] (0.5,0.7) to[out=55,in=180] (2.8,2.8) to[out=0,in=125] (5.4,0.9);
\fill[acc] (2.8,2.8) circle (1.8pt);
\node[above,acc] at (2.8,2.9) {turning point};
\draw[black,->] (1.2,1.35) -- (1.75,1.75);
\draw[black,->] (4.1,2.1) -- (4.65,1.65);
\node[black] at (1.35,0.55) {increasing};
\node[black] at (4.55,0.55) {decreasing};
\end{tikzpicture}
$$

The strict converse fails: $f(x) = x^3$ is strictly increasing yet $f'(0) = 0$.
A positive derivative is sufficient for strict growth but not necessary.

**The first-derivative test.** Combining the two directions, a sign change of the
derivative locates an extremum. If $f' \leq 0$ on $(a, c)$ and $f' \geq 0$ on
$(c, b)$, then $f$ falls then rises, so $c$ is an absolute minimum on $(a, b)$;
the reversed signs give a maximum. Restricting to $(c - \delta, c + \delta)$
turns this into a test for relative extrema.[^lebl-fdt]

## Bounding differences: the mean value inequality

A bound on the derivative becomes a bound on how fast the function can change. If
$|f'| \leq M$ throughout an interval, then for any $x, y$ the theorem gives a $c$
between them with
$$
|f(x) - f(y)| = |f'(c)|\,|x - y| \leq M\,|x - y|.
$$
This is **Lipschitz continuity** with constant $M$: a differentiable function with
bounded derivative cannot separate points faster than linearly.[^lebl-lip] The
converse direction also holds locally, so on an interval "bounded derivative" and
"Lipschitz" coincide for differentiable functions.

> **Worked example (A Lipschitz bound for the sine).** Since $\sin' = \cos$ and
> $|\cos| \leq 1$ everywhere, taking $M = 1$ in the mean value inequality gives
> $$
> |\sin x - \sin y| \leq |x - y| \qquad \text{for all } x, y \in \mathbb{R},
> $$
> proved without a single trigonometric identity. Every Lipschitz function is
> [uniformly continuous](/real-analysis/continuity/uniform-continuity), so a
> derivative bound is the standard route from smoothness to uniform continuity.

The theorem also settles differentiability at an endpoint from the behavior of the
derivative nearby.

> **Proposition (Endpoint derivative).** Suppose $f : [a, b) \to \mathbb{R}$ is
> continuous, differentiable on $(a, b)$, and $\lim_{x \to a^+} f'(x) = L$. Then
> $f$ is differentiable at $a$ with $f'(a) = L$.[^lebl-endpoint]

> **Proof.** For $x > a$ the mean value theorem on $[a, x]$ supplies a
> $c_x \in (a, x)$ with $\frac{f(x) - f(a)}{x - a} = f'(c_x)$. As $x \to a^+$ the
> point $c_x$ is squeezed to $a$, so $f'(c_x) \to L$, and the difference quotient
> at $a$ has limit $L$. $\blacksquare$

## Darboux's theorem

A derivative need not be continuous. Yet even a discontinuous derivative cannot
jump over intermediate values; it has the intermediate value property regardless.

> **Theorem (Darboux).** Let $f : [a, b] \to \mathbb{R}$ be differentiable. If
> $y$ lies strictly between $f'(a)$ and $f'(b)$, then there is a $c \in (a, b)$
> with $f'(c) = y$.[^lebl-darboux]

> **Proof.** Suppose $f'(a) < y < f'(b)$ and set $g(x) = yx - f(x)$, so
> $g'(x) = y - f'(x)$ and thus $g'(a) > 0 > g'(b)$. The continuous $g$ attains a
> maximum at some $c \in [a, b]$. Since $g'(a) > 0$ there is a nearby point to the
> right of $a$ with larger $g$, so the maximum is not at $a$; since $g'(b) < 0$
> there is a point to the left of $b$ with larger $g$, so the maximum is not at
> $b$. Hence $c$ is interior, Fermat's lemma gives $g'(c) = 0$, and $f'(c) = y$.
> $\blacksquare$

$$
% caption: Darboux's proof. The auxiliary g rises at a and falls at b, so its
% maximum lands strictly inside, and there its derivative vanishes.
\begin{tikzpicture}[scale=1.0,>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,->] (-0.2,0) -- (5.4,0) node[right]{x};
\draw[black,->] (0,-0.2) -- (0,3.2) node[above]{y};
\draw[thick,black] (0.6,0.8) to[out=42,in=180] (2.6,2.5) to[out=0,in=150] (4.6,1.0);
\draw[acc,very thick] (1.7,2.5) -- (3.5,2.5);
\fill[acc] (2.6,2.5) circle (1.8pt);
\node[above,acc] at (2.6,2.6) {maximum inside};
\draw[black,->] (0.75,1.0) -- (1.25,1.4);
\draw[black,->] (4.0,1.75) -- (4.5,1.35);
\node[below] at (0.6,0.75) {a};
\node[below] at (4.6,0.95) {b};
\node[black] at (1.5,0.4) {rising};
\node[black] at (4.3,0.5) {falling};
\end{tikzpicture}
$$

A discontinuous derivative genuinely exists.

> **Worked example (A differentiable function with discontinuous derivative).**
> Define
> $$
> f(x) =
> \begin{cases}
> x^2 \sin(1/x), & x \neq 0,\\
> 0, & x = 0.
> \end{cases}
> $$
> At the origin the difference quotient is
> $\frac{x^2 \sin(1/x)}{x} = x\sin(1/x)$, and $|x\sin(1/x)| \leq |x| \to 0$, so
> $f'(0) = 0$. For $x \neq 0$ the product and chain rules give
> $$
> f'(x) = 2x\sin(1/x) - \cos(1/x).
> $$
> Along $x_n = \frac{1}{2\pi n} \to 0$ the first term vanishes and
> $\cos(1/x_n) = 1$, so $f'(x_n) = -1$; along $x_n = \frac{1}{(2n+1)\pi} \to 0$,
> $\cos(1/x_n) = -1$ and $f'(x_n) = +1$. The derivative takes values equal to
> $+1$ and $-1$ in every neighborhood of the origin, so it is not continuous
> there, even though $f$ is differentiable everywhere. By Darboux's theorem $f'$
> still attains every value between any two it takes.

$$
% caption: The graph of x^2 sin(1/x) is trapped between the parabolas y = x^2 and
% y = -x^2, pinching to the origin; the oscillation persists at every scale, so
% the slope at 0 is 0 while nearby slopes swing between +1 and -1.
\begin{tikzpicture}[scale=1.0,>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,->] (-2.6,0) -- (2.7,0) node[right]{x};
\draw[black,->] (0,-2.4) -- (0,2.6) node[above]{y};
\draw[black,densely dashed] plot[domain=-1.42:1.42,samples=60] (\x,{1.25*\x*\x});
\draw[black,densely dashed] plot[domain=-1.42:1.42,samples=60] (\x,{-1.25*\x*\x});
\node[black,anchor=west] at (1.45,2.35) {$x^2$};
\draw[thick,black] plot[domain=0.045:1.42,samples=260] (\x,{1.25*\x*\x*sin(deg(1/\x))});
\draw[thick,black] plot[domain=-1.42:-0.045,samples=260] (\x,{1.25*\x*\x*sin(deg(1/\x))});
\fill[acc] (0,0) circle (1.6pt);
\node[black,anchor=west] at (0.15,-1.75) {slope 0 at the origin};
\end{tikzpicture}
$$

This is why continuously differentiable functions get their own name and
notation, $C^1(I)$: continuity of $f'$ is a real extra assumption, not a free
consequence of differentiability.

[^lebl-fermat]: **Lebl**, _Basic Analysis I_, §4.2, Lemma 4.2.2 — an interior relative extremum of a differentiable function is a critical point.
[^lebl-rolle]: **Lebl**, _Basic Analysis I_, §4.2, Theorem 4.2.3 (Rolle). See also **Rosenlicht**, Ch. 5.
[^lebl-const]: **Lebl**, _Basic Analysis I_, §4.2, Proposition 4.2.6 — zero derivative on an interval implies constant.
[^lebl-mono]: **Lebl**, _Basic Analysis I_, §4.2, Propositions 4.2.7–4.2.8 — monotonicity from the sign of the derivative.
[^lebl-fdt]: **Lebl**, _Basic Analysis I_, §4.2, Proposition 4.2.9 — the first-derivative test for absolute extrema.
[^lebl-lip]: **Lebl**, _Basic Analysis I_, §4.2, Exercise 4.2.3 — a differentiable function with bounded derivative is Lipschitz continuous.
[^lebl-endpoint]: **Lebl**, _Basic Analysis I_, §4.2, Proposition 4.2.10 — differentiability at an endpoint from the one-sided limit of the derivative.
[^lebl-darboux]: **Lebl**, _Basic Analysis I_, §4.2, Theorem 4.2.11 (Darboux) and Example 4.2.12 — the intermediate value property of derivatives and a differentiable function with discontinuous derivative.
