TExcelTAD
Home › Calculus in Depth › The Mean Value Theorem

The Mean Value Theorem

The Mean Value Theorem says that somewhere between two points, a smooth function's instantaneous rate of change equals its average rate of change. It looks modest, yet almost every "the derivative tells us about the function" result rests on it: a zero derivative means a constant function, a positive derivative means increasing, and derivative bounds turn into error bounds. Here we prove it from Rolle's theorem and put it to work.

Rolle's theorem

Rolle's Theorem. Let ff be continuous on [a,b][a, b], differentiable on (a,b)(a, b), with f(a)=f(b)f(a) = f(b). Then there is a number cc in (a,b)(a, b) with f′(c)=0f'(c) = 0.

Proof. If ff is constant on [a,b][a, b], then f′(c)=0f'(c) = 0 for every cc in (a,b)(a, b). Otherwise ff takes some value different from f(a)f(a), say larger (the smaller case is symmetric). By the Extreme Value Theorem, ff attains an absolute maximum on [a,b][a, b] at some cc. Since f(c)>f(a)=f(b)f(c) > f(a) = f(b), cc is not an endpoint, so cc is in (a,b)(a, b), ff has a local maximum there and f′(c)f'(c) exists. By Fermat's theorem f′(c)=0f'(c) = 0. ∎

All three hypotheses are needed: ∣x∣\lvert x \rvert on [−1,1][-1, 1] (not differentiable at 0) has no horizontal tangent, and neither has a function with a jump.

The Mean Value Theorem

Mean Value Theorem (MVT). Let ff be continuous on [a,b][a, b] and differentiable on (a,b)(a, b). Then there is a cc in (a,b)(a, b) with

f′(c)=f(b)−f(a)b−af'(c) = \frac{f(b) - f(a)}{b - a}, equivalently f(b)−f(a)=f′(c)(b−a)f(b) - f(a) = f'(c)(b - a).

Proof. Subtract the secant line from ff. The secant through (a,f(a))(a, f(a)) and (b,f(b))(b, f(b)) is s(x)=f(a)+m(x−a)s(x) = f(a) + m(x - a) with m=f(b)−f(a)b−am = \frac{f(b) - f(a)}{b - a}. Let h(x)=f(x)−s(x)h(x) = f(x) - s(x).

h is continuous on [a,b] and differentiable on (a,b)(difference of such functions)h(a)=f(a)−f(a)=0h(b)=f(b)−f(a)−m(b−a)=0Rolle⇒some c in (a,b) has h′(c)=0h′(c)=f′(c)−m=0⇒f′(c)=m■\begin{aligned} &h \text{ is continuous on } [a, b] \text{ and differentiable on } (a, b) && \text{(difference of such functions)} \\ &h(a) = f(a) - f(a) = 0 \\ &h(b) = f(b) - f(a) - m(b - a) = 0 \\ &\text{Rolle} \Rightarrow \text{some } c \text{ in } (a, b) \text{ has } h'(c) = 0 \\ &h'(c) = f'(c) - m = 0 \quad \Rightarrow \quad f'(c) = m && \blacksquare \end{aligned}

Geometrically: there is a tangent line parallel to the secant. Physically: if you drive 150 km in 2 hours, at some instant your speedometer read exactly 75 km/h.

python · try it yourself
import sympy as sp

x = sp.symbols('x', real=True)
f = x**3 - 3*x + 1
a, b = 0, 3
m = (f.subs(x, b) - f.subs(x, a)) / (b - a)
print("secant slope m =", m)
cs = [c for c in sp.solve(sp.Eq(sp.diff(f, x), m), x) if a < c < b]
print("c with f'(c) = m:", cs, "≈", [round(float(c), 4) for c in cs])
secant slope m = 6
c with f'(c) = m: [sqrt(3)] ≈ [1.7321]

The theorem promises at least one cc; it does not say how to find it, and there may be several. Its power lies in using cc without knowing it.

Consequences

1. Zero derivative means constant. If f′(x)=0f'(x) = 0 for all xx in an interval II, then ff is constant on II. Take any x1<x2x_1 < x_2 in II; the MVT gives f(x2)−f(x1)=f′(c)(x2−x1)=0f(x_2) - f(x_1) = f'(c)(x_2 - x_1) = 0.

2. Equal derivatives differ by a constant. If f′=g′f' = g' on II, apply consequence 1 to f−gf - g: f(x)=g(x)+Cf(x) = g(x) + C. This is why every antiderivative carries a +C+ C (Antiderivatives).

3. Sign of f′f' gives monotonicity. If f′>0f' > 0 on II, then for x1<x2x_1 < x_2, f(x2)−f(x1)=f′(c)(x2−x1)>0f(x_2) - f(x_1) = f'(c)(x_2 - x_1) > 0. This is the Increasing/Decreasing Test of the next lesson.

4. Derivative bounds become Lipschitz bounds. If ∣f′(x)∣≤M\lvert f'(x) \rvert \le M on II, then ∣f(x)−f(y)∣≤M∣x−y∣\lvert f(x) - f(y) \rvert \le M \lvert x - y \rvert. For sine, ∣cos⁡∣≤1\lvert \cos \rvert \le 1 gives ∣sin⁡x−sin⁡y∣≤∣x−y∣\lvert \sin x - \sin y \rvert \le \lvert x - y \rvert for all real x,yx, y:

python · try it yourself
import numpy as np

rng = np.random.default_rng(7)
x = rng.uniform(-10, 10, 100_000)
y = rng.uniform(-10, 10, 100_000)
ratio = np.abs(np.sin(x) - np.sin(y)) / np.abs(x - y)
print("largest |sin x - sin y| / |x - y| seen:", round(float(ratio.max()), 6))
print("bound from MVT with |cos| <= 1:        1")

# A sharper use: e^x on [0, 0.1] has f' = e^x <= e^0.1
M = np.exp(0.1)
print("|e^0.1 - e^0| =", round(float(np.exp(0.1) - 1), 6), "<= M*0.1 =", round(float(M * 0.1), 6))
largest |sin x - sin y| / |x - y| seen: 0.999992
bound from MVT with |cos| <= 1:        1
|e^0.1 - e^0| = 0.105171 <= M*0.1 = 0.110517

A picture

python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

f = lambda x: x**3 - 3*x + 1
a, b = 0.0, 3.0
m = (f(b) - f(a)) / (b - a)
c = np.sqrt((m + 3) / 3)               # solves 3c² − 3 = m
xs = np.linspace(-0.3, 3.2, 300)
plt.figure(figsize=(6, 4))
plt.plot(xs, f(xs), label="f(x) = x³ − 3x + 1")
plt.plot(xs, f(a) + m * (xs - a), "--", label=f"secant, slope {m:g}")
plt.plot(xs, f(c) + m * (xs - c), ":", label=f"tangent at c ≈ {c:.3f}")
plt.scatter([a, b, c], [f(a), f(b), f(c)], zorder=3)
plt.ylim(-3, 20); plt.legend(); plt.grid(alpha=0.3)
print(f"tangent at c = {c:.4f} is parallel to the secant (slope {m:g})")
tangent at c = 1.7321 is parallel to the secant (slope 6)

In software

  • Lipschitz constants in ML. A network layer with bounded derivative (weights with bounded spectral norm) changes its output by at most M∣Δx∣M \lvert \Delta x \rvert for an input change Δx\Delta x. Spectral normalisation in GANs, robustness certificates against adversarial examples and gradient clipping all lean on this MVT inequality.
  • Error analysis. "Rounding the input by δ\delta changes the output by at most max⁡∣f′∣⋅δ\max \lvert f' \rvert \cdot \delta" is the MVT. It is how numerical libraries reason about condition numbers.
  • Convergence proofs. Fixed-point iterations xn+1=g(xn)x_{n+1} = g(x_n) converge when ∣g′∣≤k<1\lvert g' \rvert \le k < 1 near the fixed point, since ∣g(x)−g(y)∣≤k∣x−y∣\lvert g(x) - g(y) \rvert \le k \lvert x - y \rvert shrinks distances: the core of the proof that Newton's method converges.

Exercises

Exercise 1: Check the hypotheses

Does Rolle's theorem apply to f(x)=x2/3f(x) = x^{2/3} on [−1,1][-1, 1]? Is there a cc with f′(c)=0f'(c) = 0?

Answer

No: ff is not differentiable at 0. And there is no such cc.

Solution

f(−1)=f(1)=1f(-1) = f(1) = 1 and ff is continuous, but f′(x)=23x−1/3f'(x) = \frac{2}{3} x^{-1/3} is undefined at x=0x = 0 and never zero. The theorem's conclusion fails because a hypothesis fails.

Exercise 2: Find the MVT point

Find every cc promised by the MVT for f(x)=xf(x) = \sqrt{x} on [1,9][1, 9].

Answer

c=4c = 4.

Solution
m=9−19−1=28=14f′(c)=12c=14⇒c=2⇒c=4, which is in (1,9)\begin{aligned} &m = \frac{\sqrt{9} - \sqrt{1}}{9 - 1} = \frac{2}{8} = \frac{1}{4} \\ &f'(c) = \frac{1}{2\sqrt{c}} = \frac{1}{4} \quad \Rightarrow \quad \sqrt{c} = 2 \quad \Rightarrow \quad c = 4, \text{ which is in } (1, 9) \end{aligned}

Exercise 3: Exactly one root

Show that x5+4x−3=0x^5 + 4x - 3 = 0 has exactly one real root.

Answer

There is a root in (0,1)(0, 1) and there cannot be two.

Solution

Existence: f(0)=−3<0f(0) = -3 < 0, f(1)=2>0f(1) = 2 > 0, so the Intermediate Value Theorem gives a root in (0,1)(0, 1). Uniqueness: if f(r1)=f(r2)=0f(r_1) = f(r_2) = 0 with r1<r2r_1 < r_2, Rolle gives cc with f′(c)=0f'(c) = 0; but f′(x)=5x4+4≥4>0f'(x) = 5x^4 + 4 \ge 4 > 0. Contradiction.

python · try it yourself
import numpy as np
roots = np.roots([1, 0, 0, 0, 4, -3])
print([round(float(r.real), 6) for r in roots if abs(r.imag) < 1e-9])
[0.706115]

Exercise 4: An inequality from the MVT

Use the MVT to prove ln⁡(1+x)<x\ln(1 + x) < x for x>0x > 0.

Answer

ln⁡(1+x)=x1+c<x\ln(1 + x) = \frac{x}{1 + c} < x for some cc in (0,x)(0, x).

Solution

Apply the MVT to f(t)=ln⁡(1+t)f(t) = \ln(1 + t) on [0,x][0, x]: ln⁡(1+x)−ln⁡1=f′(c)⋅x=x1+c\ln(1 + x) - \ln 1 = f'(c) \cdot x = \frac{x}{1 + c} with 0<c<x0 < c < x. Since 1+c>11 + c > 1, x1+c<x\frac{x}{1 + c} < x.

Test yourself

In the proof of the MVT, which function does Rolle's theorem get applied to?

  1. ff itself
  2. f′f'
  3. the tangent line at aa
  4. ff minus the secant line through (a,f(a))(a, f(a)) and (b,f(b))(b, f(b))

If ∣f′(x)∣≤3\lvert f'(x) \rvert \le 3 on [0,10][0, 10] and f(0)=5f(0) = 5, what is the largest possible value of f(4)f(4)?

  1. 8
  2. 12
  3. 17
  4. 35

f′(x)=g′(x)f'(x) = g'(x) for every xx in an interval. What follows?

  1. f−gf - g is constant on the interval
  2. f=gf = g
  3. ff and gg are both constant
  4. Nothing in general