Lagrange Error Bound

The Lagrange error bound tells you how far a Taylor polynomial can be from its function. If |f^{(n+1)}(z)| \le M for every z between a and x, then the error of the nth-degree Taylor polynomial is at most |R_n(x)| \le \dfrac{M}{(n+1)!}|x - a|^{n+1}.

Before this lesson: Taylor Polynomials, Alternating Series Error Bound and Higher-Order Derivatives

Where the error comes from

The remainder R_n(x) = f(x) - P_n(x) is the error of a Taylor polynomial. Taylor’s theorem says the remainder looks just like the next term of the series, except that the derivative is taken at some unknown point z between a and x:

R_n(x) = \dfrac{f^{(n+1)}(z)}{(n+1)!}(x - a)^{n+1}

You can’t find z, but you can find the largest value M that |f^{(n+1)}| reaches between a and x. Using M in place of the unknown derivative gives an upper bound on the error.

Graph for 0 ≤ x ≤ 1 of the actual error eˣ − P₂(x), where P₂(x) = 1 + x + x²/2 (solid blue curve), and the Lagrange error bound e·x³/6 (dashed orange curve). The bound curve stays above the error curve everywhere. At x = 1 the actual error is about 0.218 and the bound is about 0.453.
The Lagrange error bound is a guaranteed ceiling: the real error of P₂ for eˣ always stays under it.

The Lagrange error bound formula

|R_n(x)| = |f(x) - P_n(x)| \le \dfrac{M}{(n+1)!}|x - a|^{n+1}
  • n is the degree of the Taylor polynomial, and a is its center.
  • M is any number with |f^{(n+1)}(z)| \le M for every z between a and x. It is usually the largest value of the (n + 1)th derivative on that interval.
  • The bound uses the next derivative and the next factorial: (n + 1), not n.

How to use the Lagrange error bound

  1. Find the (n + 1)th derivative of f.
  2. Find M, the largest value of its absolute value between a and x. A simple number that is a bit larger also works.
  3. Put M, n + 1 and |x − a| into the formula.
  4. To find the degree you need, try n = 1, 2, 3, … until the bound is small enough.

Lagrange error bound examples

Example 1: Estimating e to the 0.5

Use the third-degree Maclaurin polynomial P_3(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} to estimate e^{0.5}, and bound the error.

P_3(0.5) = 1 + 0.5 + 0.125 + 0.0208333 \approx 1.6458333

Substitute x = 0.5: 0.5²/2 = 0.125 and 0.5³/6 ≈ 0.0208333.

f^{(4)}(z) = e^z

n = 3, so use the fourth derivative. Every derivative of eˣ is eˣ (see derivatives of exponential functions).

e^z \le e^{0.5} \lt 2 \text{ for } 0 \le z \le 0.5

eᶻ grows, so its largest value is at z = 0.5. Use M = 2.

|R_3(0.5)| \le \dfrac{2}{4!}(0.5)^4

Put M = 2, n + 1 = 4 and |x − a| = 0.5 into the formula.

\dfrac{2}{24}(0.0625) \approx 0.0052

4! = 24 and 0.5⁴ = 0.0625.

Answer: e^{0.5} \approx 1.64583 with error at most 0.0052. (The true value is 1.64872, so the actual error is about 0.0029.)

Example 2: A sine estimate

Use P_3(x) = x - \frac{x^3}{6} to estimate sin 0.3, and bound the error with the Lagrange error bound.

P_3(0.3) = 0.3 - \dfrac{0.027}{6} = 0.3 - 0.0045 = 0.2955

Substitute x = 0.3: 0.3³ = 0.027.

f^{(4)}(z) = \sin z, \; |\sin z| \le 1

The fourth derivative of sin x is sin x. Sine is never bigger than 1, so M = 1.

|R_3(0.3)| \le \dfrac{1}{4!}(0.3)^4 = \dfrac{0.0081}{24}

Put the values into the formula.

\dfrac{0.0081}{24} = 0.0003375

Divide.

Answer: sin 0.3 ≈ 0.2955 with error at most 0.0003375. (The true value is 0.2955202.)

Example 3: Centered at a = 1

Use P_2(x) = (x - 1) - \frac{(x - 1)^2}{2}, the second-degree Taylor polynomial of ln x at a = 1, to estimate ln 1.2. Bound the error.

P_2(1.2) = 0.2 - \dfrac{0.04}{2} = 0.18

Substitute x = 1.2, so x − 1 = 0.2.

f'''(z) = \dfrac{2}{z^3}

n = 2, so use the third derivative of ln x (see derivatives of logarithmic functions).

\dfrac{2}{z^3} \le \dfrac{2}{1^3} = 2 \text{ for } 1 \le z \le 1.2

2/z³ decreases as z grows, so it is largest at z = 1. Use M = 2.

|R_2(1.2)| \le \dfrac{2}{3!}(0.2)^3 = \dfrac{2(0.008)}{6}

Put M = 2, n + 1 = 3 and |x − a| = 0.2 into the formula.

\dfrac{0.016}{6} \approx 0.00267

Multiply, then divide.

Answer: ln 1.2 ≈ 0.18 with error at most 0.00267. (The true value is 0.18232.)

Example 4: Choosing the degree

What degree of Maclaurin polynomial for e^x is needed to estimate e (that is, x = 1) with error less than 0.001?

M = 3

Every derivative is eᶻ, which is at most e¹ ≈ 2.718 < 3 for 0 ≤ z ≤ 1.

\dfrac{3}{(n+1)!}(1)^{n+1} \lt 0.001

Set the bound less than 0.001 with x − a = 1.

(n + 1)! \gt 3000

Multiply both sides by (n + 1)! and divide by 0.001.

6! = 720, \; 7! = 5040

List factorials: 7! is the first one past 3000.

n + 1 = 7, \text{ so } n = 6

Subtract 1.

Answer: a sixth-degree polynomial. P_6(1) = 1 + 1 + \frac{1}{2} + \frac{1}{6} + \frac{1}{24} + \frac{1}{120} + \frac{1}{720} \approx 2.71806, and e ≈ 2.71828.

Example 5: A pendulum simulation (word problem)

A pendulum simulation replaces cos θ with 1 - \frac{\theta^2}{2}, the second-degree Maclaurin polynomial, for angles up to 0.2 radians. How large can the error be?

f'''(z) = \sin z

n = 2, so use the third derivative of cos: −sin, −cos, then sin (see derivatives of trig functions).

|\sin z| \le 1

Use M = 1.

|R_2(\theta)| \le \dfrac{1}{3!}|\theta|^3 \le \dfrac{(0.2)^3}{6}

The bound is largest when |θ| is as big as possible, 0.2.

\dfrac{(0.2)^3}{6} = \dfrac{0.008}{6} \approx 0.00133

0.2³ = 0.008.

Answer: the error is at most about 0.00133 for every angle up to 0.2 radians. The true largest error is only about 0.00007, so the bound is safe but cautious.

Common mistakes

MistakeExample of the errorFix
Using the nth derivativeFor P₃, using f‴ to find MUse the (n + 1)th derivative: f⁽⁴⁾ for P₃.
Using n! instead of (n + 1)!Dividing by 3! for the error of P₃The error of P₃ uses 4! = 24.
Taking M at the wrong pointUsing M = e⁰ = 1 for eᶻ on 0 ≤ z ≤ 0.5M must be the largest value on the interval: e^0.5 ≈ 1.65, so use 2.
Forgetting the power on |x − a|Writing \frac{M}{4!}(0.5) instead of \frac{M}{4!}(0.5)^4Raise |x − a| to the (n + 1)th power.
Thinking the bound is the error“The error is exactly 0.0052”The bound is a ceiling. The real error is usually smaller.
Using a point outside the intervalUsing z = 2 to find M when estimating at x = 0.5 with a = 0Only z between a and x matters.

Related methods

Lagrange or alternating series error bound?

If the Taylor series alternates at your x and its terms shrink, such as the series for sin x or cos x, the alternating series error bound is often easier: the error is less than the next nonzero term. For series that don’t alternate, such as the one for e^x at a positive x, use the Lagrange error bound.

A sharper bound for sin and cos

The Maclaurin polynomials of sin x skip every even power, so P_3 = P_4. You may treat x - \frac{x^3}{6} as P₄ and use the fifth derivative. For sin 0.3 this gives \frac{0.3^5}{5!} \approx 0.00002, a much smaller bound.

Practice problems

  1. Use P_2(x) = 1 + x + \frac{x^2}{2} to estimate e^{0.2}, and bound the error. Use e^0.2 < 2.
  2. Use P_4(x) = 1 - \frac{x^2}{2} + \frac{x^4}{24} to estimate cos 0.5, and bound the error.
  3. Use P_1(x) = 2 + \frac{x - 4}{4} for \sqrt{x} at a = 4 to estimate \sqrt{4.1}, and bound the error.
  4. What degree of Maclaurin polynomial for sin x guarantees an error less than 0.0001 at x = 1? Use M = 1.
  5. |f^{(4)}(x)| \le 6 on 1 ≤ x ≤ 3. P₃ is the third-degree Taylor polynomial of f at a = 2. Bound the error of P₃(2.5).
  6. Use P_3(x) = (x - 1) - \frac{(x - 1)^2}{2} + \frac{(x - 1)^3}{3} to estimate ln 1.1, and bound the error.
  7. Use P_2(x) = 1 - x + \frac{x^2}{2} (for e^{-x} at 0) to estimate e^{-0.1}, and bound the error.
  8. Show that sin x ≈ x has error at most 0.001 when |x| ≤ 0.04.
  9. Bound the largest error of P_3(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} for e^x on −1 ≤ x ≤ 1. Use e < 3.
  10. A rocket’s height is approximated by its second-degree Taylor polynomial at t = 0 for 0 ≤ t ≤ 2 seconds. If |h'''(t)| \le 1.5 m/s³ on that interval, what is the largest possible error?
Show answers

1.

P_2(0.2) = 1 + 0.2 + 0.02 = 1.22

0.2²/2 = 0.02.

|R_2(0.2)| \le \dfrac{2}{3!}(0.2)^3 = \dfrac{2(0.008)}{6}

f‴(z) = eᶻ ≤ e^0.2 < 2, so M = 2.

\dfrac{0.016}{6} \approx 0.00267

Divide.

Answer: e^0.2 ≈ 1.22 with error at most 0.00267 (true value 1.22140)

2.

P_4(0.5) = 1 - 0.125 + \dfrac{0.0625}{24} \approx 0.8776042

0.5²/2 = 0.125 and 0.5⁴ = 0.0625.

|R_4(0.5)| \le \dfrac{1}{5!}(0.5)^5 = \dfrac{0.03125}{120}

f⁽⁵⁾(z) = −sin z, so M = 1.

\dfrac{0.03125}{120} \approx 0.00026

Divide.

Answer: cos 0.5 ≈ 0.87760 with error at most 0.00026 (true value 0.87758)

3.

P_1(4.1) = 2 + \dfrac{0.1}{4} = 2.025

x − 4 = 0.1.

f''(z) = -\dfrac{1}{4z^{3/2}}

Use the power rule twice on z to the 1/2.

|f''(z)| \le \dfrac{1}{4 \cdot 4^{3/2}} = \dfrac{1}{32}

The largest value on 4 ≤ z ≤ 4.1 is at z = 4; 4 to the 3/2 is 8.

|R_1(4.1)| \le \dfrac{1/32}{2!}(0.1)^2 = \dfrac{0.01}{64}

Put M = 1/32, n + 1 = 2 and |x − a| = 0.1 into the formula.

\dfrac{0.01}{64} \approx 0.000156

Divide.

Answer: √4.1 ≈ 2.025 with error at most 0.000156 (true value 2.024846)

4.

\dfrac{1}{(n+1)!} \lt 0.0001

With M = 1 and x − a = 1.

(n + 1)! \gt 10{,}000

Flip both sides.

7! = 5040, \; 8! = 40{,}320

8! is the first factorial past 10,000.

n + 1 = 8

So n = 7.

Answer: degree 7, which is x − x³/3! + x⁵/5! − x⁷/7!

5.

|R_3(2.5)| \le \dfrac{6}{4!}(0.5)^4

M = 6, n + 1 = 4 and |x − a| = 0.5.

\dfrac{6}{24}(0.0625) = 0.015625

6/24 = 0.25 and 0.25 · 0.0625 = 0.015625.

Answer: the error is at most 0.015625

6.

P_3(1.1) = 0.1 - 0.005 + 0.0003333 \approx 0.0953333

x − 1 = 0.1.

f^{(4)}(z) = -\dfrac{6}{z^4}

Differentiate 2/z³ once more.

|f^{(4)}(z)| \le 6

Largest at z = 1 on 1 ≤ z ≤ 1.1.

|R_3(1.1)| \le \dfrac{6}{4!}(0.1)^4 = 0.25(0.0001) = 0.000025

Put the values into the formula.

Answer: ln 1.1 ≈ 0.095333 with error at most 0.000025 (true value 0.095310)

7.

P_2(0.1) = 1 - 0.1 + 0.005 = 0.905

x = 0.1 gives e⁻⁰·¹.

|f'''(z)| = e^{-z} \le 1 \text{ for } 0 \le z \le 0.1

The third derivative of e⁻ˣ is −e⁻ˣ.

|R_2(0.1)| \le \dfrac{1}{3!}(0.1)^3 = \dfrac{0.001}{6} \approx 0.000167

Put M = 1 into the formula.

Answer: e^−0.1 ≈ 0.905 with error at most 0.000167 (true value 0.904837)

8.

|R_1(x)| \le \dfrac{1}{2!}|x|^2

sin x ≈ x is P₁. f″(z) = −sin z, so M = 1.

\dfrac{(0.04)^2}{2} = \dfrac{0.0016}{2} = 0.0008

Use the largest |x|, 0.04.

Answer: the error is at most 0.0008, which is less than 0.001

9.

M = 3

f⁽⁴⁾(z) = eᶻ ≤ e < 3 for −1 ≤ z ≤ 1.

|R_3(x)| \le \dfrac{3}{4!}|x|^4 \le \dfrac{3}{24}

|x| is at most 1.

Answer: the error is at most 3/24 = 0.125

10.

|R_2(t)| \le \dfrac{1.5}{3!}t^3

M = 1.5, n + 1 = 3, center a = 0.

\dfrac{1.5}{6}(2)^3 = 0.25(8) = 2

The bound is largest at t = 2.

Answer: at most 2 meters

Lagrange error bound FAQ

What is the Lagrange error bound?

It is an upper limit on the error of a Taylor polynomial: |R_n(x)| \le \frac{M}{(n+1)!}|x - a|^{n+1}, where M is the largest value of |f^{(n+1)}| between a and x.

How do you find M?

Find the (n + 1)th derivative, then find its largest absolute value between a and x. For sin and cos you can use M = 1. For an increasing function like e^x, use the value at the right end.

What is the difference between the Lagrange and alternating series error bounds?

The alternating series bound works only for alternating series and uses the next term. The Lagrange bound works for any Taylor polynomial but needs a bound M on a derivative.

Why does the formula use (n + 1)! and not n!?

The error acts like the first term the polynomial leaves out. That term has degree n + 1, so it has (n + 1)! in the denominator.

Summary

  • Error of Pₙ: |R_n(x)| \le \frac{M}{(n+1)!}|x - a|^{n+1}.
  • M bounds the (n + 1)th derivative between a and x.
  • Use the next derivative and the next factorial.
  • The bound is a ceiling; the real error is usually smaller.
  • Raise n until the bound is small enough to reach a target accuracy.

Previous lesson: Alternating Series Error Bound

Next lesson: Power Series

Back to the Calculus 2 Index