Skip to content
Tutorials Center
My learning

Topics

Lesson 26 of 37 · Differentiation

Taylor's Theorem with Remainder

State Taylor's theorem with the Lagrange remainder, bound approximation errors rigorously, and see why a function can have a Taylor series that fails to equal it.

A differentiable function looks like a straight line near a point. Taylor's theorem says that a function with n derivatives looks like a polynomial of degree n, and, crucially, it tells you how big the error is. Without the remainder, a Taylor polynomial is just a guess; with it, it is a certified approximation.

The theorem

Theorem (Taylor with Lagrange remainder). Let f have n + 1 derivatives on an open interval containing a and x. Then there is a number ξ between a and x such that

Text
f(x) = Σ_{k=0}^{n} f^{(k)}(a)/k! · (x - a)^k  +  R_n(x),
R_n(x) = f^{(n+1)}(ξ) / (n+1)! · (x - a)^{n+1}.

The polynomial Tₙ(x) = Σ f^{(k)}(a)(x-a)^k / k! is the Taylor polynomial of degree n at a. For n = 0 the theorem is exactly the Mean Value Theorem: f(x) = f(a) + f'(ξ)(x - a).

Idea of the proof

Fix x ≠ a. Define K by f(x) = Tₙ(x) + K (x - a)^{n+1}/(n+1)! and consider

Text
g(t) = f(x) - Σ_{k=0}^{n} f^{(k)}(t)(x - t)^k / k! - K (x - t)^{n+1}/(n+1)!.

Then g(x) = 0, and the choice of K makes g(a) = 0. Differentiating, the sum telescopes and g'(t) = -(f^{(n+1)}(t) - K)(x - t)^n / n!. By Rolle's theorem some ξ between a and x has g'(ξ) = 0, so K = f^{(n+1)}(ξ). ∎

Using the remainder to bound errors

You usually do not know ξ, but you can bound |f^{(n+1)}| on the interval. If |f^{(n+1)}(t)| ≤ M for t between a and x, then

Text
|f(x) - Tₙ(x)| ≤ M |x - a|^{n+1} / (n+1)!.

Example: computing e. For f(x) = eˣ, a = 0, x = 1: all derivatives are eᵗ ≤ e < 3 on [0, 1], so |e - Tₙ(1)| ≤ 3/(n+1)!. With n = 9 this is below 10⁻⁶, so Σ_{k=0}^{9} 1/k! approximates e within 10⁻⁶.

Python Actual error versus the Lagrange bound for e

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Sine and its error

For sin x at a = 0, every derivative is ±sin or ±cos, so |f^{(n+1)}| ≤ 1 everywhere. Hence for every real x,

Text
| sin x - Tₙ(x) | ≤ |x|^{n+1} / (n+1)!.

Since |x|^{n+1}/(n+1)! → 0 as n → ∞ for each fixed x, the Taylor polynomials converge to sin x for all real x.

Python Convergence of Taylor polynomials for sin

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A smooth function that equals none of its Taylor series

Taylor's theorem does not say the remainder tends to 0. Consider

Text
f(x) = e^{-1/x²}  for x ≠ 0,   f(0) = 0.

It can be shown that f has derivatives of every order at 0, and all of them are 0. So every Taylor polynomial at 0 is the zero polynomial, yet f(x) > 0 for x ≠ 0. The Taylor series converges (to 0) but not to f. So "infinitely differentiable" is strictly weaker than "equal to its Taylor series" (analytic).

Python Derivatives of exp(-1/x^2) tend to 0 at 0

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The code checks the right-hand limits for the first four derivatives; the full proof for all orders uses induction, where each derivative has the form (polynomial in 1/x) · e^{-1/x²}.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. In Taylor's theorem with Lagrange remainder, what is xi?

    The theorem only asserts existence of some xi between a and x; you bound the derivative over the whole interval.
  2. 2. For n = 0 Taylor's theorem becomes:

    f(x) = f(a) + f'(xi)(x - a) is the MVT.
  3. 3. If |f^(n+1)| is at most M on the interval, the error of the degree n Taylor polynomial is at most:

    That is the Lagrange remainder with the derivative replaced by its bound.
  4. 4. What does f(x) = exp(-1/x^2) with f(0) = 0 show?

    All derivatives at 0 vanish, so the Taylor series is identically 0, but f is positive for x not 0.

Summary

  • Taylor with Lagrange remainder: f(x) = Tₙ(x) + f^{(n+1)}(ξ)(x - a)^{n+1}/(n+1)!.
  • Bounding |f^{(n+1)}| by M gives a rigorous error bound M|x - a|^{n+1}/(n+1)!.
  • For sin, cos and exp the remainder tends to 0, so the series converge to the function.
  • Infinitely differentiable does not mean analytic: e^{-1/x²} has a zero Taylor series at 0.

Next: Darboux Sums and Integrability