Math Core

Lesson 6.11 · Infinite Sequences and Series

The Lagrange error bound

A Taylor polynomial gives an approximation, but an approximation is only useful if you know how far off it might be. The Lagrange error bound gives a guaranteed upper limit on the error, using only a bound on the next derivative. It works for any Taylor polynomial, not just alternating ones.

The remainder

When you approximate f(x)f(x) by its nnth-degree Taylor polynomial Pn(x)P_n(x) centered at aa, the error is the remainder

Rn(x)=f(x)−Pn(x).R_n(x) = f(x) - P_n(x).

You usually can't compute Rn(x)R_n(x) exactly (if you could, you wouldn't need the approximation). But you can bound it.

Where the bound comes from

Look at the pattern in the Taylor polynomial: the term after f(n)(a)n!(x−a)n\dfrac{f^{(n)}(a)}{n!}(x-a)^n would be f(n+1)(a)(n+1)!(x−a)n+1\dfrac{f^{(n+1)}(a)}{(n+1)!}(x-a)^{n+1}. Lagrange showed that the remainder is exactly this next term, except with the derivative evaluated at some unknown point cc between aa and xx rather than at aa:

Rn(x)=f(n+1)(c)(n+1)!(x−a)n+1.R_n(x) = \frac{f^{(n+1)}(c)}{(n+1)!}(x - a)^{n+1}.

You don't know cc, but if you know the largest that ∣f(n+1)∣|f^{(n+1)}| can be on the interval, you can replace f(n+1)(c)f^{(n+1)}(c) by that maximum.

Lagrange error bound

If ∣f(n+1)(t)∣≤M|f^{(n+1)}(t)| \le M for every tt between aa and xx, then

∣f(x)−Pn(x)∣≤M(n+1)! ∣x−a∣n+1.|f(x) - P_n(x)| \le \frac{M}{(n+1)!}\,|x - a|^{n+1}.

Read the formula as "next term, with the derivative replaced by its maximum." Three ingredients: MM (the max of the (n+1)(n+1)st derivative), the factorial (n+1)!(n+1)!, and the distance from the center raised to the (n+1)(n+1) power.

sin x and its cubic Taylor polynomial x − x³/6. The error is tiny near 0 and grows as |x − a| grows, just as the factor |x − a|⁴ in the bound predicts.Open in grapher →

Finding M

MM must bound ∣f(n+1)(t)∣|f^{(n+1)}(t)| on the whole interval between the center aa and the point xx, not just at the endpoints you happen to plug in.

  • For sin⁡x\sin x and cos⁡x\cos x, every derivative is a sine or cosine, so M=1M = 1 always works.
  • For exe^x on [0,x][0, x], the derivative ete^t is increasing, so M=exM = e^x. Since the goal is to avoid using the value you're approximating, a convenient overestimate is often used, like e0.5<2e^{0.5} < 2 or e1<3e^1 < 3.
  • For other functions, find where ∣f(n+1)∣|f^{(n+1)}| is largest on the interval; for a monotonic derivative, that's at an endpoint.
  • On the AP exam, MM is often given to you: "∣f(4)(x)∣≤6|f^{(4)}(x)| \le 6 for all xx in the interval."

Common mistake

The most common mistakes are using the wrong derivative and the wrong factorial. For PnP_n, the bound uses the (n+1)(n+1)st derivative and (n+1)!(n+1)!. For a third-degree polynomial, that's the fourth derivative and 4!=244! = 24. Also, the answer is a bound on the error, so write "error≤0.0026\text{error} \le 0.0026", not "error =0.0026= 0.0026."

Worked examples

Worked example: Sine near zero

The polynomial P3(x)=x−x36P_3(x) = x - \dfrac{x^3}{6} is used to approximate sin⁡(0.5)\sin(0.5). Use the Lagrange error bound to bound the error.

Solution. Here n=3n = 3, a=0a = 0, x=0.5x = 0.5. The fourth derivative of sin⁡x\sin x is sin⁡x\sin x, and ∣sin⁡t∣≤1|\sin t| \le 1, so take M=1M = 1:

∣sin⁡(0.5)−P3(0.5)∣≤14!(0.5)4=0.062524≈0.0026.|\sin(0.5) - P_3(0.5)| \le \frac{1}{4!}(0.5)^4 = \frac{0.0625}{24} \approx 0.0026.

(The actual error is about 0.000260.00026, well within the bound.)

Worked example: A given derivative bound

The function ff has derivatives of all orders, and ∣f(4)(x)∣≤6|f^{(4)}(x)| \le 6 for 1≤x≤1.51 \le x \le 1.5. The third-degree Taylor polynomial for ff about x=1x = 1 is used to approximate f(1.4)f(1.4). Show that the error is less than 0.010.01.

Solution. With M=6M = 6, n=3n = 3 and ∣x−a∣=0.4|x - a| = 0.4:

∣f(1.4)−P3(1.4)∣≤64!(0.4)4=6(0.0256)24=0.0064<0.01.|f(1.4) - P_3(1.4)| \le \frac{6}{4!}(0.4)^4 = \frac{6(0.0256)}{24} = 0.0064 < 0.01.

Worked example: Estimating e

The Maclaurin polynomial Pn(x)=1+x+x22!+⋯+xnn!P_n(x) = 1 + x + \dfrac{x^2}{2!} + \cdots + \dfrac{x^n}{n!} is used to approximate e=e1e = e^1. Using M=3M = 3, find the smallest nn for which the Lagrange error bound is less than 0.0010.001.

Solution. Every derivative of exe^x is exe^x, and on [0,1][0, 1] it is at most e<3e < 3. So

∣e−Pn(1)∣≤3(n+1)!(1)n+1=3(n+1)!.|e - P_n(1)| \le \frac{3}{(n+1)!}(1)^{n+1} = \frac{3}{(n+1)!}.

We need (n+1)!>3000(n+1)! > 3000. Since 6!=7206! = 720 and 7!=50407! = 5040, the smallest choice is n+1=7n + 1 = 7, so n=6n = 6.

Worked example: Finding M yourself

The second-degree Taylor polynomial for ln⁡x\ln x about x=1x = 1 is P2(x)=(x−1)−(x−1)22P_2(x) = (x-1) - \dfrac{(x-1)^2}{2}. Bound the error when P2(1.2)P_2(1.2) is used to approximate ln⁡(1.2)\ln(1.2).

Solution. We need the third derivative: f′′′(x)=2x3f'''(x) = \dfrac{2}{x^3}. On [1,1.2][1, 1.2] this is decreasing, so its maximum is at x=1x = 1: M=2M = 2. Then

∣ln⁡(1.2)−P2(1.2)∣≤23!(0.2)3=2(0.008)6≈0.00267.|\ln(1.2) - P_2(1.2)| \le \frac{2}{3!}(0.2)^3 = \frac{2(0.008)}{6} \approx 0.00267.

Tip

When a Taylor series is alternating (like the ones for sin⁡x\sin x and cos⁡x\cos x at a positive xx), the alternating series error bound is often simpler and tighter. The Lagrange bound is the tool to use when the series isn't alternating, or when the question says "Lagrange."

Practice

Practice 1

The polynomial P3(x)=x−x36P_3(x) = x - \dfrac{x^3}{6} approximates sin⁡x\sin x. Use the Lagrange error bound with M=1M = 1 to bound ∣sin⁡(0.5)−P3(0.5)∣|\sin(0.5) - P_3(0.5)|. Round to four decimal places.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

The polynomial P2(x)=1+x+x22P_2(x) = 1 + x + \dfrac{x^2}{2} is used to approximate e0.1e^{0.1}. Using M=3M = 3 as a bound for the third derivative on [0,0.1][0, 0.1], find the Lagrange error bound.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

A function ff satisfies ∣f(4)(x)∣≤6|f^{(4)}(x)| \le 6 for 1≤x≤1.51 \le x \le 1.5. The third-degree Taylor polynomial for ff about x=1x = 1 is used to approximate f(1.4)f(1.4). Find the Lagrange error bound.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 4

The Maclaurin polynomial PnP_n for exe^x is used to approximate ee. Using M=3M = 3, what is the smallest nn for which the Lagrange error bound is less than 0.0010.001?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

The second-degree Taylor polynomial for ln⁡x\ln x about x=1x = 1 is used to approximate ln⁡(1.2)\ln(1.2). Find the Lagrange error bound, using the maximum of ∣f′′′(x)∣|f'''(x)| on [1,1.2][1, 1.2]. Round to five decimal places.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 6

Let P4(x)P_4(x) be the fourth-degree Taylor polynomial for ff about x=2x = 2. Given that ∣f(5)(x)∣≤40|f^{(5)}(x)| \le 40 for all xx, which is the Lagrange error bound for ∣f(2.5)−P4(2.5)∣|f(2.5) - P_4(2.5)|?

Practice 7

The table gives values of the derivatives of gg at x=0x = 0, and ∣g(4)(x)∣≤12|g^{(4)}(x)| \le 12 for 0≤x≤10 \le x \le 1.

g(0)g(0)g′(0)g'(0)g′′(0)g''(0)g′′′(0)g'''(0)
22−1-166−12-12

The third-degree Maclaurin polynomial P3P_3 for gg is used to approximate g(0.5)g(0.5). Which statement is true?