---
title: The mean value theorem
heading: Somewhere, the speedometer read your average
eyebrow: A5 · Lesson 28 · The mean value theorem
xp: 40
---

::: hook
You drive 120 km in 1.5 hours, an average of 80 km/h. Was there a moment when the speedometer read exactly 80? Yes, always, however you drove, as long as your speed changed smoothly. That's the mean value theorem, and it's more useful than it sounds: it's how you prove that a function with zero derivative is constant, how you bound the error of an approximation, and why an instrument with a known maximum slew rate can't change faster than that on average.
:::

::: play
- The curve is $f(x) = x^3 - 3x + 2$ on $[a, b]$. The dashed line joins the endpoints; its slope is the average rate of change.
- Find the point $c$ where the tangent (solid line) is parallel to the dashed one. The readouts compare the two slopes.
:::
:::

```sim plot
view: graph
x: x = -2.5..2.5
y: y = -4..10
slider: a = -2..0 step 0.1 = -1.5
slider: b = 0.5..2.5 step 0.1 = 2
slider: c = -2.5..2.5 step 0.01 = 1
plot: x^3 - 3*x + 2 | label: f(x)
plot: (a^3 - 3*a + 2) + ((b^3 - 3*b) - (a^3 - 3*a))/(b - a)*(x - a) | dashed | color: ch2 | label: secant
plot: (c^3 - 3*c + 2) + (3*c^2 - 3)*(x - c) | color: ch3 | label: tangent at c
readout: average slope = ((b^3 - 3*b) - (a^3 - 3*a))/(b - a) | digits: 4
readout: f′(c) = 3*c^2 - 3 | digits: 4
```

::: predict
## A sensor's output rose from 1.0 V to 3.4 V over 2 ms, smoothly. What must have been true at some instant?

- [ ] The output was exactly 2.2 V
- [x] The output was changing at exactly 1.2 V/ms
- [ ] The output was changing at its maximum rate
- [ ] Nothing can be said about any single instant

::: reveal
At some instant the rate was exactly $(3.4 - 1.0)/2 = 1.2$ V/ms: the mean value theorem. (It also passed through 2.2 V, by the intermediate value theorem from lesson 6, but that's a statement about the value, not the rate.)
:::
:::

::: nameit
## The theorem

If $f$ is continuous on $[a, b]$ and differentiable on $(a, b)$, there's at least one $c$ in $(a, b)$ with

$$f'(c) = \frac{f(b) - f(a)}{b - a}$$

Geometrically: somewhere the tangent is parallel to the line joining the endpoints. **Rolle's theorem** is the special case $f(a) = f(b)$: somewhere $f'(c) = 0$.

## Consequences

**Zero derivative means constant.** If $f' = 0$ on an interval, then for any two points $f(b) - f(a) = f'(c)(b - a) = 0$. So $f$ is constant. Two functions with the same derivative differ by a constant, which is why every antiderivative (lesson 36) comes with a $+C$.

**Bounds on change.** If $|f'| \le M$ on an interval, then $|f(b) - f(a)| \le M|b - a|$. An op amp with a slew rate of 0.5 V/µs can't change its output by more than 0.5 V in any microsecond, and an ADC sampling a signal whose slope is bounded knows how far it can move between samples.

**Increasing functions.** If $f' > 0$ on an interval, $f$ is increasing there, since every difference $f(b) - f(a)$ has the sign of some $f'(c)$.

The theorem promises a $c$ exists but doesn't say where. Finding it means solving $f'(c) = $ (average slope).
:::

::: example
## Find the $c$ promised by the mean value theorem for $f(x) = x^2$ on $[1, 4]$.

::: solution
1. **Average slope.**
   $$\frac{16 - 1}{4 - 1} = 5$$
2. **Solve $f'(c) = 5$.**
   $$2c = 5 \quad\Rightarrow\quad c = 2.5$$
   inside $(1, 4)$ as promised.
3. **For any parabola.** $c$ is exactly the midpoint of the interval.

**Answer:** $c = 2.5$.
:::
:::

::: example
## An op amp's output can slew at most 0.5 V/µs. What's the largest-amplitude 100 kHz sine it can produce without distortion?

::: solution
1. **Maximum slope of a sine.** A sine $A\sin(2\pi ft)$ has maximum slope $2\pi fA$.
2. **Hold it to the slew rate.**
   $$2\pi \times 10^5 \times A \le 0.5 \times 10^6$$
   so
   $$A \le 0.80\ \text{V}$$
3. **What happens above it.** Above 0.8 V amplitude, the output can't keep up and the sine turns into a triangle. This is the "full-power bandwidth" on op amp datasheets.

**Answer:** the largest undistorted 100 kHz sine has an amplitude of 0.80 V.
:::
:::

::: example
## A 10 µF capacitor's voltage rises from 1 V to 4 V in 3 ms. What does the mean value theorem say about its current?

::: solution
1. **Average rate.** The voltage changed by 3 V in 3 ms:
   $$\frac{3\ \text{V}}{3\ \text{ms}} = 1000\ \text{V/s}$$
2. **Apply the theorem.** If $v$ is smooth, at some instant in between $dv/dt$ was exactly 1000 V/s.
3. **Current at that instant.**
   $$\begin{aligned} i &= C\frac{dv}{dt} \\ &= 10^{-5} \times 1000 \\ &= 10\ \text{mA} \end{aligned}$$
4. **What it doesn't promise.** The current may have been bigger or smaller at other times, but it must have passed through 10 mA at least once.

**Answer:** at some instant the current was exactly 10 mA.
:::
:::

::: check
given: a = 1 | 2; b = 4 | 5 | 7
answer: (a + b)/2
tolerance: 0.5%

## For $f(x) = x^2$ on $[\given{a}, \given{b}]$, find the $c$ guaranteed by the mean value theorem.

::: right
Right. The average slope is $a + b$, and $2c = a + b$ gives the midpoint, {answer}.
:::

::: misses
- [a + b] That's the average slope. Solve $2c = $ that slope.
- [any] Not yet. Compute the average slope, then solve $f'(c) = $ it.
:::
:::

::: check
given: a = 1 | 2; b = 3 | 4
answer: sqrt((a^2 + a*b + b^2)/3)
tolerance: 0.5%

## For $f(x) = x^3$ on $[\given{a}, \given{b}]$, find the $c$ guaranteed by the mean value theorem.

::: right
Right. Average slope $\frac{b^3 - a^3}{b - a} = a^2 + ab + b^2$; then $3c^2 = $ that, so $c$ = {answer}.
:::

::: misses
- [(a + b)/2] That works for parabolas, not cubics.
- [a^2 + a*b + b^2] That's the average slope. Solve $3c^2 = $ that.
- [any] Not yet. Average slope, then $3c^2 = $ average slope.
:::
:::

::: check
given: SR = 0.5 | 13 | 20; f = 100 | 500
answer: SR*1e6/(2*pi*f*1e3)
unit: V

## An op amp slews at most {SR} V/µs. What is the largest sine amplitude it can produce at {f} kHz without slew-rate distortion?

::: right
Right. $2\pi fA \le$ SR gives $A$ = {answer}.
:::

::: misses
- [SR*1e6/(f*1e3)] The sine's peak slope is $2\pi fA$, not $fA$.
- [SR/(2*pi*f)] Put the slew rate in V/s and the frequency in Hz.
- [any] Not yet. Set the sine's peak slope, $2\pi fA$, equal to the slew rate.
:::
:::

::: check
given: v1 = 1 | 2; v2 = 4 | 9; T = 2 | 5
answer: (v2 - v1)/T
unit: V/ms

## A signal goes smoothly from {v1} V to {v2} V in {T} ms. What rate of change must it have had at some instant?

::: right
Right. The mean value theorem guarantees the average rate, {answer}, somewhere.
:::

::: misses
- [v2/T] Use the change, $v_2 - v_1$.
- [any] Not yet. Average rate = change ÷ time.
:::
:::

::: check
kind: choice

## $f'(x) = g'(x)$ for every $x$. Which must be true?

- [ ] $f = g$
- [x] $f = g + C$ for some constant $C$
- [ ] $f$ and $g$ are both constant
- [ ] Nothing: the derivatives tell you nothing about the functions

::: right
Right. $(f - g)' = 0$, so $f - g$ is constant by the mean value theorem.
:::

::: misses
- [1] They can differ by a constant: $x^2$ and $x^2 + 5$ have the same derivative.
- [any] What does a zero derivative say about $f - g$?
:::
:::

::: check
kind: parts
given: a = 1 | 2; b = 3 | 5

## Apply the mean value theorem on $[\given{a}, \given{b}]$.

::: part
answer: a^2 + a*b + b^2
tolerance: 0.5%

### For $f(x) = x^3$, what is the average slope over the interval?

::: misses
- [any] $\frac{b^3 - a^3}{b - a}$; factor the top.
:::
:::

::: part
answer: sqrt((a^2 + a*b + b^2)/3)
tolerance: 0.5%

### Where does $f'(c) = 3c^2$ equal that average?

::: misses
- [(a + b)/2] That's the midpoint; for a cubic the point isn't the midpoint.
- [any] Solve $3c^2$ = the average slope.
:::
:::

::: part
answer: ((sqrt(a) + sqrt(b))/2)^2
tolerance: 0.5%

### For $f(x) = \sqrt{x}$ instead, where is $c$?

::: misses
- [(a + b)/2] Not the midpoint: solve $\frac{1}{2\sqrt{c}} = \frac{\sqrt{b} - \sqrt{a}}{b - a}$.
- [any] The average slope is $\frac{1}{\sqrt{a} + \sqrt{b}}$.
:::
:::
:::

::: check
kind: derivation
vars: a = 0.5..2, b = 3..6

## Find the point the mean value theorem promises for $f(x) = 1/x$ on $[a, b]$.

::: step
answer: -1/(a*b)

### What is the average slope, $\frac{f(b) - f(a)}{b - a}$, simplified?
:::

::: step
answer: sqrt(a*b)

### Solve $f'(c) = -1/c^2$ = that slope for $c > 0$.
:::

::: right
Right. $c = \sqrt{ab}$, the geometric mean of the ends: always strictly between them.
:::
:::

::: explain
## How does the mean value theorem show that a function with zero derivative everywhere on an interval is constant?

::: model
Pick any two points $a$ and $b$ in the interval. The mean value theorem says $f(b) - f(a) = f'(c)(b - a)$ for some $c$ between them. Since $f'$ is zero everywhere, $f'(c) = 0$, so $f(b) = f(a)$. That holds for every pair of points, so $f$ takes the same value everywhere: it's constant.
:::
:::

::: practice

::: check
given: k = 2 | 3; a = 0 | 1; b = 2 | 4
answer: (a + b)/2
tolerance: 0.5%

## For $f(x) = \given{k}x^2 + 1$ on $[\given{a}, \given{b}]$, find the mean value theorem's $c$.

::: misses
- [k*(a + b)] That's the average slope.
- [any] For any parabola, $c$ is the midpoint.
:::
:::

::: check
given: M = 2 | 5; d = 0.1 | 3
answer: M*d

## $|f'(x)| \le$ {M} everywhere. What is the most $f$ can change over an interval of length {d}?

::: misses
- [M] Multiply by the length.
- [any] $|f(b) - f(a)| \le M|b - a|$.
:::
:::

::: check
given: A = 1 | 10; f = 20 | 200
answer: 2*pi*f*1e3*A/1e6
unit: V/µs

## What slew rate, in V/µs, does an op amp need to output a {A} V amplitude sine at {f} kHz?

::: misses
- [2*pi*f*1e3*A] Convert to V/µs.
- [any] $2\pi fA$ in V/s, divided by $10^6$.
:::
:::
:::
