Skip to main content

11. Mean Value Theorem and Taylor Expansion — Imitating Functions with Polynomials

Calculus 3/5. The real utility of differentiation is "controlling the behavior of an entire function with one derivative." The mean value theorem is that control mechanism, and repeatedly applying it to reconstruct a function as a polynomial gives the Taylor expansion. Approximation theory, optimization, and the proof of the CLT all begin here.

Rolle's theorem → mean value theorem​

Rolle's theorem: if ff is continuous on [a,b][a,b], differentiable on (a,b)(a,b), and f(a)=f(b)f(a) = f(b), then some c∈(a,b)c \in (a,b) satisfies f′(c)=0f'(c) = 0. (If both ends have the same height, there is a horizontal tangent somewhere.)

Mean Value Theorem (MVT): under the same conditions, even when f(a)≠f(b)f(a) \neq f(b), some c∈(a,b)c \in (a,b) satisfies

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

This means there is a tangent somewhere with the same slope as the secant. The proof ends by subtracting the secant from ff and reducing the problem to Rolle's theorem.

Immediate consequences of the MVT​

  • Sign of the derivative ⟹ monotonicity: if f′>0f' > 0 on an interval, ff is strictly increasing. (f(y)−f(x)=f′(c)(y−x)>0f(y) - f(x) = f'(c)(y-x) > 0)
  • f′≡0f' \equiv 0 ⟹ constant: "functions with the same derivative differ by a constant" follows here, and the +C+C in an indefinite integral is a consequence of this theorem.
  • Lipschitz control: if ∣f′∣≤L|f'| \le L, then ∣f(x)−f(y)∣≤L∣x−y∣|f(x) - f(y)| \le L|x - y|. This single inequality controls every variation in function values with a derivative bound, and it is the standard LL-smoothness assumption in convergence proofs for gradient descent.

L'Hôpital's rule​

For limits of the form 00\frac{0}{0} or ∞∞\frac{\infty}{\infty},

lim⁡x→af(x)g(x)=lim⁡x→af′(x)g′(x)(when the limit on the right exists)\lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{x \to a} \frac{f'(x)}{g'(x)} \qquad \text{(when the limit on the right exists)}

This is a consequence of Cauchy's mean value theorem (the two-function version of the MVT). Once Taylor expansion below becomes familiar, however, most limits can be read immediately by "expanding and comparing the lowest-order terms" without L'Hôpital's rule.

Taylor's theorem​

If ff is n+1n+1 times differentiable, then near aa,

f(x)=∑k=0nf(k)(a)k!(x−a)k⏟Taylor polynomial Tn(x)+f(n+1)(c)(n+1)!(x−a)n+1⏟Lagrange remainderf(x) = \underbrace{\sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}(x-a)^k}_{\text{Taylor polynomial } T_n(x)} + \underbrace{\frac{f^{(n+1)}(c)}{(n+1)!}(x-a)^{n+1}}_{\text{Lagrange remainder}}

(cc is some point between aa and xx.) When n=0n = 0, this is exactly the MVT—Taylor's theorem is the higher-order extension of the MVT.

The key message: because the remainder is controlled by (x−a)n+1(x-a)^{n+1}, as xx approaches aa, the polynomial approximation improves at the rate of its order.

f(x)=Tn(x)+O((x−a)n+1)f(x) = T_n(x) + O\big((x-a)^{n+1}\big)

Why the coefficient is f(k)(a)/k!f^{(k)}(a)/k!​

TnT_n is "the unique degree-nn polynomial whose derivatives through order nn all agree with ff at aa." Since dkdxk(x−a)k=k!\frac{d^k}{dx^k}(x-a)^k = k!, division by k!k! is required for the derivatives to match. The factorial from the Gamma function page again serves as a normalization constant here.

Five expansions to memorize​

Around x→0x \to 0:

ex=1+x+x22!+x33!+⋯e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots sin⁡x=x−x33!+x55!−⋯cos⁡x=1−x22!+x44!−⋯\sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots \qquad \cos x = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots ln⁡(1+x)=x−x22+x33−⋯(∣x∣<1)\ln(1+x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots \qquad (|x| < 1) (1+x)α=1+αx+α(α−1)2!x2+⋯(∣x∣<1)(1+x)^\alpha = 1 + \alpha x + \frac{\alpha(\alpha-1)}{2!} x^2 + \cdots \qquad (|x| < 1)

Examples of use—moments when they actually appear in probability and ML:

  • ln⁡(1+x)≈x−x22\ln(1+x) \approx x - \frac{x^2}{2}: log return ≈ simple return, and the origin of small-sample correction terms.
  • ex≈1+xe^x \approx 1 + x: compound interest → continuous compounding, (1+λ/n)n→eλ(1 + \lambda/n)^n \to e^\lambda (Poisson limit).
  • The heart of the CLT proof (Part 4): expand the characteristic function to second order, φ(t/n)n=(1−t22n+o(1/n))n→e−t2/2\varphi(t/\sqrt{n})^n = \big(1 - \frac{t^2}{2n} + o(1/n)\big)^n \to e^{-t^2/2}. Without Taylor expansion, the proof of the CLT cannot begin.
  • Linearizing sigmoid and softmax; analyzing local behavior of activation functions.

Second-order expansion — the language of optimization​

Optimization most often uses the expansion through second order:

f(x+h)≈f(x)+f′(x) h+12f′′(x) h2f(x + h) \approx f(x) + f'(x)\,h + \frac{1}{2} f''(x)\, h^2
  • At a point where f′(x)=0f'(x) = 0 (a critical point), the first-order term vanishes and the second-order term dominates—f′′>0f'' > 0 gives a minimum, and f′′<0f'' < 0 gives a maximum. This is the second-order condition in Part 5.
  • Newton's method chooses the next step by matching through the second-order term: h=−f′(x)/f′′(x)h = -f'(x)/f''(x).
  • In statistics, a second-order expansion of the log-likelihood leads to the Laplace approximation (approximating the posterior with a Gaussian) and Fisher information. The fact that "expanding the log density to second order near its maximum produces a Gaussian" is another route demonstrating the universality of the Gaussian.

Big-O / little-o​

The standard vocabulary for expressing approximation precision (as x→ax \to a):

NotationMeaningExample
f=O(g)f = O(g)∥f/g∥\|f/g\| is boundedsin⁡x=x+O(x3)\sin x = x + O(x^3)
f=o(g)f = o(g)f/g→0f/g \to 0Differentiability: f(a+h)−f(a)−f′(a)h=o(h)f(a+h) - f(a) - f'(a)h = o(h)
f∼gf \sim gf/g→1f/g \to 1Stirling: Γ(z)∼2π/z (z/e)z\Gamma(z) \sim \sqrt{2\pi/z}\,(z/e)^z

The claim in Part 1 that the O(h2)O(h^2) central difference is better than the O(h)O(h) forward difference follows immediately by subtracting two Taylor expansions: f(x+h)−f(x−h)=2f′(x)h+2f′′′(x)3!h3+⋯f(x+h) - f(x-h) = 2f'(x)h + \frac{2 f'''(x)}{3!}h^3 + \cdots

Pitfalls of Taylor series​

The series as n→∞n \to \infty does not always converge to the original function.

  • Radius of convergence: ln⁡(1+x)\ln(1+x) is valid only for ∣x∣<1|x| < 1. Using the expansion outside that radius is simply wrong.
  • Smooth but non-analytic functions: for f(x)=e−1/x2f(x) = e^{-1/x^2} (f(0)=0f(0)=0), every derivative at the origin is 0, so its Taylor series is identically 0, but the function itself is not 0. "Even knowing every derivative may not reveal the function."
  • In contrast, for objects with good properties such as characteristic functions, a local expansion determines the entire distribution—see Part 2 for the contrast with the moment problem.

Summary​

  • The MVT is a mechanism for "controlling changes in function values through derivatives"—monotonicity, Lipschitz bounds, and +C+C all follow from it.
  • Taylor's theorem is the higher-order extension of the MVT, and the remainder O((x−a)n+1)O((x-a)^{n+1}) guarantees approximation quality.
  • The five expansions ex,sin⁡,cos⁡,ln⁡(1+x),(1+x)αe^x, \sin, \cos, \ln(1+x), (1+x)^\alpha are reused everywhere, from the CLT proof to numerical-stability tricks.
  • Second-order expansion is a shared language of optimization (Newton, second-order conditions) and statistics (Laplace approximation, Fisher information).

Next: Multivariable Differentiation