Rolle's Theorem

lean4-proofcalculusvisualization
f(a)=f(b)    c(a,b):  f(c)=0f(a)=f(b)\implies\exists\,c\in(a,b):\;f'(c)=0

Statement

Let f:RRf : \mathbb{R} \to \mathbb{R} be continuous on [a,b][a, b] and differentiable on (a,b)(a, b). If f(a)=f(b)f(a) = f(b), then there exists at least one point c(a,b)c \in (a, b) such that

f(c)=0f'(c) = 0

In other words, whenever a smooth curve returns to its starting height, it must have had a horizontal tangent somewhere in between.

Visualization

Consider f(x)=(x1)(x3)=x24x+3f(x) = (x-1)(x-3) = x^2 - 4x + 3 on [1,3][1, 3].

Note f(1)=0f(1) = 0 and f(3)=0f(3) = 0, so f(1)=f(3)f(1) = f(3).

  f(x) = (x-1)(x-3)

  0 |*-----------*   ← f(1)=0, f(3)=0
    | \         /
 -1 |  \       /
    |   ·-----·      ← tangent at c=2 is horizontal
 -1 |    \   /
    |     \ /
 -1 |      *         ← minimum at x=2, f(2)=-1
    +--+---+---+--
       1   2   3

Derivative: f(x)=2x4f'(x) = 2x - 4, so f(c)=0c=2(1,3)f'(c) = 0 \Rightarrow c = 2 \in (1, 3).

xxf(x)f(x)f(x)f'(x)
102-2
21-10
3022

The horizontal tangent at c=2c = 2 is guaranteed by Rolle's Theorem.

Proof Sketch

  1. Trivial case: If ff is constant on [a,b][a, b], then f0f' \equiv 0 everywhere and any cc works.
  2. Non-trivial case: Since ff is continuous on the compact set [a,b][a, b], it attains its maximum and minimum (Extreme Value Theorem).
  3. Interior extremum: Since f(a)=f(b)f(a) = f(b) and ff is not constant, at least one of the extrema is attained at an interior point c(a,b)c \in (a, b).
  4. Zero derivative: At an interior local extremum of a differentiable function, f(c)=0f'(c) = 0 (Fermat's criterion). If f(c)>0f'(c) > 0 or f(c)<0f'(c) < 0, then ff is locally monotone at cc, contradicting the extremum.

Connections

  • Mean Value TheoremMean Value Theoremc(a,b)  :  f(c)=f(b)f(a)ba\exists\, c \in (a,b)\;:\; f'(c) = \frac{f(b)-f(a)}{b-a}There exists a point where the instantaneous rate of change equals the average rate of changeRead more → — the MVT is proved by applying Rolle's Theorem to h(x)=f(x)L(x)h(x) = f(x) - L(x) where LL is the secant line
  • Intermediate Value TheoremIntermediate Value Theoremf(a)yf(b)c[a,b]:  f(c)=yf(a) \le y \le f(b) \Rightarrow \exists\, c \in [a,b]:\; f(c) = yA continuous function on a closed interval hits every value between its endpointsRead more → — the existence of an interior extremum uses continuity on a compact interval, the same hypothesis as IVT
  • Taylor's TheoremTaylor's Theoremf(x)=k=0nf(k)(x0)k!(xx0)k+Rn(x)f(x) = \sum_{k=0}^{n} \frac{f^{(k)}(x_0)}{k!}(x-x_0)^k + R_n(x)Approximate smooth functions by polynomials with explicit error boundsRead more → — Taylor's theorem in Lagrange remainder form uses the MVT repeatedly, which in turn rests on Rolle

Lean4 Proof

import Mathlib.Analysis.Calculus.LocalExtr.Rolle

/-- Rolle's Theorem: wraps Mathlib's `exists_hasDerivAt_eq_zero`. -/
theorem rolles_theorem {f f' :   } {a b : } (hab : a < b)
    (hfc : ContinuousOn f (Set.Icc a b))
    (hfI : f a = f b)
    (hff' :  x  Set.Ioo a b, HasDerivAt f (f' x) x) :
     c  Set.Ioo a b, f' c = 0 :=
  exists_hasDerivAt_eq_zero hab hfc hfI hff'