Calculate a Lagrange error bound
A bound for the sine
The upper graph shows the sine curve and, in orange, its Taylor polynomial \(P_3(x)=x-\frac{x^3}{6}\) of degree 3 with center 0. The red shading between them is the error.
In the lower graph, the solid red curve shows the true error \(\left|\sin x-P_3(x)\right|\), and the dashed red curve shows the Lagrange error bound.
At \(x=1\), the true error is 0.0081 and the bound is 0.0417, so the dashed curve is above the solid curve.
Drag the input to \(x=2\), which doubles the distance from the center. The true error becomes 0.243 and the bound becomes 0.667. The bound is 16 times larger because it uses the fourth power of the distance.
The bound can be larger than the true error but never smaller, so it guarantees how large the error can be.
The three parts of the bound
The dashed curve has three parts: the number \(M\), a power of the distance from the center, and a factorial. The number \(M\) bounds the size of the derivative of order \(n+1\).
Move the slider M. The whole curve stretches upward, because M multiplies it.
Change the degree. The power \(|x-a|^{n+1}\) makes the curve flat near the center and steep far from it. The factorial \((n+1)!\) is in the denominator, so a higher degree divides the curve by a larger number.
Every derivative of the sine has size at most 1. Because M is at least 1, the dashed curve stays above the solid curve for every M and every degree.
Notation
The polynomial has degree \(n\) and center \(a\), and \(x\) is the input. The number \(M\) bounds the size of the derivative of order \(n+1\) on the interval between \(a\) and \(x\).
The error is at most \(M\) times the distance from the center to the power \(n+1\), divided by \((n+1)!\).
\[\left|R_n(x)\right|\le\cr{\dfrac{M\,|x-a|^{n+1}}{(n+1)!}}\]If the center is 0, the distance is \(|x|\).
The power and the factorial both use \(n+1\), one more than the degree. The base of the power is the distance \(|x-a|\), not \(x\).
When it fails
Use the power 3 instead of 4. At \(x=3\) the bound is \(\frac{27}{24}=1.125\), but the true error is 1.641, so the dashed curve drops below the solid curve.
A number below the true error is not a bound. With the power \(n+1=4\), the bound is \(\frac{81}{24}=3.375\).
Example 1: The exponential
The Taylor polynomial of degree 3 at 0 approximates \(e^{x}\) at \(x=0.6\). Find an error bound.
The degree is 3, so the derivative has order 4. For \(e^x\), every derivative is \(e^t\).
\[f^{(4)}(t)=e^{t}\]The function \(e^t\) rises, so its largest value on the interval from 0 to 0.6 is \(e^{0.6}\approx1.82\). Any larger number is also valid, so you can use \(M=2\).
Substitute \(M=2\), the distance 0.6 and \(n+1=4\).
\[\left|R_3(0.6)\right|\le\cr{\dfrac{2\,(0.6)^4}{4!}=0.0108}\]The polynomial gives \(1.816\), and \(e^{0.6}\approx1.8221\). The true error is about 0.0061, which is below the bound.
Example 2: The square root
The Taylor polynomial of degree 2 for \(f(x)=\sqrt{x}\) at 4 is \(P_2(x)=2+\tfrac{x-4}{4}-\tfrac{(x-4)^2}{64}\). Find an error bound at \(x=6\).
The degree is 2, so the derivative has order 3. This derivative falls as \(t\) increases, so its largest value on the interval from 4 to 6 is at \(t=4\).
\[\begin{aligned}f'''(t)&=\dfrac38\,t^{-5/2}\\ M&=f'''(4)=\dfrac{3}{256}\end{aligned}\]A tempting wrong move: Multiply \(M\) by the distance 2. Then divide by \(3!\).
\[\cr{\dfrac{M\,|x-4|}{3!}=\dfrac{3}{256}\cdot\dfrac{2}{6}=\dfrac{1}{256}}\]The polynomial gives \(\frac{39}{16}=2.4375\) at \(x=6\), and \(\sqrt6\approx2.4495\). The true error is about 0.0120. The value \(\frac1{256}\approx0.0039\) is smaller, so it cannot be a bound.
The distance must be raised to the power \(n+1=3\).
\[\begin{aligned}\left|R_2(6)\right|&\le\cr{\dfrac{(3/256)\cdot 2^3}{3!}}\\ &=\cr{\dfrac{1}{64}}\approx0.0156\end{aligned}\]
Practice
The Taylor polynomial of degree 3 at 0 approximates \(\ln(1+x)\) at \(x=0.3\). Find an error bound.
Find the largest size of the derivative of order \(n+1=4\) on the interval from 0 to 0.3. Your bound must be above the solid red curve at \(x=0.3\).
Solution
The size of the derivative of order 4 falls as \(t\) increases, so its largest size on the interval is at \(t=0\), which gives \(M=6\).
\[f^{(4)}(t)=-\dfrac{6}{(1+t)^4}\]Substitute \(M=6\), the distance 0.3 and \(n+1=4\).
\[\left|R_3(0.3)\right|\le\cr{\dfrac{6\,(0.3)^4}{4!}=0.002025}\]The polynomial gives 0.264, and \(\ln1.3\approx0.26236\). The true error is about 0.0016, which is below the bound.
Questions
Questions 1 and 2 use the figure from the opening. The solid red curve is the true error of \(P_3\) for the sine, and the dashed red curve is the bound \(\frac{x^4}{24}\).
Read the dashed curve at \(x=2\). What is the bound?
- About 0.67
- About 0.24
- About 0.33
Answer
About 0.67
The input doubles from \(x=1\) to \(x=2\). By what factor does the bound grow?
- 16
- 2
- 8
Answer
16
The Taylor polynomial of degree 4 at 0 approximates \(\cos x\) at \(x=\tfrac12\). Use \(M=1\). What is the error bound?
- \(\dfrac{1}{3840}\)
- \(\dfrac{1}{768}\)
- \(\dfrac{1}{1920}\)
Answer
\(\dfrac{1}{3840}\)
Summary
You multiply the bound \(M\) by the distance from the center to the power \(n+1\), and you divide by \((n+1)!\).
This works because the error equals the next Taylor term with its derivative taken at an unknown point, where its size is at most M.
The result guarantees how far a Taylor approximation can be from the true value.
This is one of four skills in topic 10.12 of Which & Why: AP Calculus.