Key idea of this section
f(x) = ∑ₖ₌₀ⁿ f⁽ᵏ⁾(a)(x − a)ᵏ/k! + Rₙ(x) Lagrange: Rₙ(x) = f⁽ⁿ⁺¹⁾(ξ)(x − a)ⁿ⁺¹/(n + 1)! for some ξ between a and x
The Taylor polynomial
If f has n derivatives at a, its Taylor polynomial of degree n at a is Pₙ(x) = ∑ₖ₌₀ⁿ f⁽ᵏ⁾(a)(x − a)ᵏ/k!. It is the unique polynomial of degree ≤ n whose derivatives of orders 0 to n agree with those of f at a. Brook Taylor published the series in 1715; the question of how well Pₙ approximates f, i.e. the size of the remainder Rₙ = f − Pₙ, was first answered by Lagrange (1797).
Theorem 6.1 (Taylor's theorem, Lagrange remainder). Suppose f⁽ⁿ⁾ is continuous on the closed interval between a and x and f⁽ⁿ⁺¹⁾ exists on the open interval. Then there is ξ strictly between a and x with
f(x) = Pₙ(x) + f⁽ⁿ⁺¹⁾(ξ)(x − a)ⁿ⁺¹/(n + 1)!.
Proof. Fix x ≠ a and choose M so that f(x) = Pₙ(x) + M(x − a)ⁿ⁺¹. Define, for t between a and x,
g(t) = f(x) − ∑ₖ₌₀ⁿ f⁽ᵏ⁾(t)(x − t)ᵏ/k! − M(x − t)ⁿ⁺¹.
Then g(x) = 0 and g(a) = 0 by the choice of M. Differentiating, the sum telescopes: the derivative of ∑ₖ₌₀ⁿ f⁽ᵏ⁾(t)(x − t)ᵏ/k! equals f⁽ⁿ⁺¹⁾(t)(x − t)ⁿ/n!. Hence
g′(t) = −f⁽ⁿ⁺¹⁾(t)(x − t)ⁿ/n! + (n + 1)M(x − t)ⁿ.
By Rolle there is ξ between a and x with g′(ξ) = 0, i.e. M = f⁽ⁿ⁺¹⁾(ξ)/(n + 1)!. ∎
Two other forms of the remainder are important. If f⁽ⁿ⁺¹⁾ is continuous (or merely Riemann integrable), the integral form
Rₙ(x) = (1/n!) ∫ₐˣ f⁽ⁿ⁺¹⁾(t)(x − t)ⁿ dt
follows from the fundamental theorem of calculus by induction, integrating by parts at each step. If f is only n times differentiable at a, the Peano form says Rₙ(x) = o((x − a)ⁿ), meaning Rₙ(x)/(x − a)ⁿ → 0 as x → a. The Peano form is what makes Taylor expansion a tool for computing limits; the Lagrange and integral forms give explicit error bounds.
Computing limits with expansions
Using the standard expansions with Peano remainders, for example cos x = 1 − x²/2 + x⁴/24 + o(x⁴):
lim (x → 0) (cos x − 1 + x²/2)/x⁴ = lim (x⁴/24 + o(x⁴))/x⁴ = 1/24.
Similarly sin x − x cos x = (x − x³/6) − (x − x³/2) + o(x³) = x³/3 + o(x³), so (sin x − x cos x)/x³ → 1/3. This is usually far quicker and less error-prone than repeated L'Hôpital.
Error bounds and the irrationality of e
For f(x) = eˣ at a = 0, every derivative is eˣ, so for 0 < x ≤ 1,
0 < eˣ − ∑ₖ₌₀ⁿ xᵏ/k! = eξ xⁿ⁺¹/(n + 1)! < 3/(n + 1)!.
At x = 1 this gives 0 < e − ∑ₖ₌₀ⁿ 1/k! < 3/(n + 1)!, so the series converges to e very rapidly. The same estimate proves:
Theorem 6.2. e is irrational. (Euler proved this in 1737 using continued fractions; the short proof below is due to Fourier, 1815.)
Proof. Suppose e = p/q with p, q ∈ ℕ. Let x = q!(e − ∑ (k = 0 to q) 1/k!). Since q!e = (q − 1)!p and each q!/k! with k ≤ q is an integer, x is an integer. And
0 < x = ∑ (k = q + 1 to ∞) q!/k! = 1/(q + 1) + 1/((q + 1)(q + 2)) + ... < ∑ⱼ₌₁∞ 1/(q + 1)ʲ = 1/q ≤ 1.
No integer lies strictly between 0 and 1. Hence e is irrational. ∎
The remainder can be large even when the Taylor series converges
For ln(1 + x) at 0 the Taylor series is x − x²/2 + x³/3 − .... At x = 1 the Lagrange remainder is |Rₙ(1)| = (n!/(1 + ξ)ⁿ⁺¹)/(n + 1)! ≤ 1/(n + 1) → 0, so ln 2 = 1 − 1/2 + 1/3 − ..., confirming the sum of the alternating harmonic series. For x > 1 the series diverges, although ln(1 + x) is perfectly smooth there.
More strikingly, the Taylor series of a smooth function need not converge to the function at all. Let f(x) = e−1/x² for x ≠ 0 and f(0) = 0. By induction, for x ≠ 0 each derivative has the form f⁽ⁿ⁾(x) = pₙ(1/x)e−1/x² for a polynomial pₙ, and since e−1/x² decays faster than any power of x, every derivative at 0 equals 0 (Problem 52). The Taylor series of f at 0 is identically 0, which converges everywhere but equals f only at x = 0. Functions equal to their Taylor series near every point are called real analytic; f is C∞ but not analytic. The distinction disappears in complex analysis, where one complex derivative implies analyticity.
Higher-order extremum test
If f′(a) = ... = f⁽ⁿ⁻¹⁾(a) = 0 and f⁽ⁿ⁾(a) ≠ 0 with f⁽ⁿ⁾ continuous at a, then Taylor's theorem shows that f(x) − f(a) has the sign of f⁽ⁿ⁾(a)(x − a)ⁿ near a. So for even n, a is a strict local minimum if f⁽ⁿ⁾(a) > 0 and a strict local maximum if f⁽ⁿ⁾(a) < 0; for odd n, a is not an extremum. For f(x) = x⁴ at 0 (n = 4, f⁽⁴⁾ = 24) this detects the minimum that the second derivative test misses.
Exercise
- (a)Find the degree-3 Taylor polynomial of √(1 + x) at 0.
- (b)Using the Lagrange bound 3/(n + 1)!, what is the least n for which ∑ₖ₌₀ⁿ 1/k! is guaranteed to approximate e within 10⁻⁶?
- (c)Compute lim (x → 0) (eˣ − 1 − x − x²/2)/x³.
Show solution
Answers: (a) 1 + x/2 − x²/8 + x³/16 (the coefficients are the binomial coefficients C(1/2, k)). (b) We need (n + 1)! > 3 × 10⁶. Since 9! = 362,880 and 10! = 3,628,800, n + 1 = 10, so n = 9. (c) eˣ − 1 − x − x²/2 = x³/6 + o(x³), so the limit is 1/6.