Use the bound to support an approximation
Cosine of 1 to three decimals
The problem is to approximate \(\cos 1\) within 0.001, using a Taylor polynomial with the center 0. The tolerance is the largest error that the problem allows.
Each red bar shows the Lagrange error bound for one degree \(n\) at \(x=1\). Every derivative of the cosine has size at most 1 and the distance is 1, so the bound is \(\frac{1}{(n+1)!}\).
The vertical axis is logarithmic, so each gridline is 10 times lower than the one above it. The orange line marks the tolerance 0.001, and a degree works when its bar is below the line.
Move the slider from \(n=4\) to \(n=6\). The bars for \(n=4\) and \(n=5\) are above the line, but the bar for \(n=6\) is below it.
The smallest degree that the bound guarantees is 6.
Any function, any tolerance
The bars now show the bounds for any function, and the buttons move the orange line to a new tolerance.
A bar below the line is a guarantee, because the error is at most the bar and the bar is at most the tolerance.
A bar above the line gives no guarantee, because the true error may be small but the bound cannot show it.
The slider changes the distance from the center. A smaller distance lowers every bar, and so does a higher degree.
Notation
The orange line marks the tolerance.
The true error is at most the bound, so the bound supports the approximation when it is at most the tolerance.
\[\cr{\dfrac{M\,|x-a|^{n+1}}{(n+1)!}}\le\cy{\text{tolerance}}\]To choose a degree, find the bound for \(n=1,2,3,\ldots\). Stop at the first \(n\) whose bound is at most the tolerance.
The guarantee holds only at the input you used, because a new input changes \(|x-a|\) and can change \(M\).
When it fails
At \(x=3\) the bound for \(n=6\) is \(\frac{3^7}{7!}\approx0.434\), far above 0.001, so the degree that works at \(x=1\) fails at \(x=3\).
Every bar rises because the bound contains the distance, now 3, to the power \(n+1\).
Example 1: A cube root
The Taylor polynomial of degree 2 for \(f(x)=(1+x)^{1/3}\) at 0 is \(1+\tfrac{x}{3}-\tfrac{x^2}{9}\). Is it within 0.001 of \(1.2^{1/3}\)?
Degree 2 needs the third derivative on the interval from 0 to 0.2. It has \(1+t\) to a negative power, so it falls as \(t\) increases and is largest at \(t=0\).
\[\begin{aligned}f'''(t)&=\dfrac{10}{27}(1+t)^{-8/3}\\ M&=\dfrac{10}{27}\end{aligned}\]Substitute \(M\), the distance 0.2 and \(n+1=3\).
\[\begin{aligned}&\cr{\dfrac{(10/27)(0.2)^3}{3!}}\\ &=\cr{\dfrac{1}{2025}}\approx0.00049\end{aligned}\]The bound is below 0.001, so the answer is yes. The polynomial gives \(\frac{239}{225}\approx1.0622\) at 0.2.
Example 2: Where the guarantee ends
The Taylor polynomial of degree 3 for \(f(x)=e^{x/2}\) at 0 approximates \(f(1)=\sqrt{e}\) with the tolerance 0.005. A second claim says that the same polynomial is within 0.005 at \(x=3\). Decide both claims.
On the interval from 0 to 1, the fourth derivative rises, so its largest value is \(\frac{e^{1/2}}{16}<\frac{1.65}{16}<0.11\). This makes \(M=0.11\) valid.
\[f^{(4)}(t)=\dfrac{e^{t/2}}{16}\]Substitute \(M=0.11\), the distance 1 and \(n+1=4\). The bound is below 0.005, so the first claim is correct.
\[\cr{\dfrac{0.11\cdot 1^4}{4!}}\approx0.0046\]A tempting wrong move: The bound 0.0046 is below 0.005, so the polynomial is also within 0.005 at \(x=3\).
\[\cr{\left|R_3(3)\right|\le0.0046}\]At \(x=3\) the polynomial gives 4.1875 but \(e^{1.5}\approx4.4817\), an error of about 0.29. The bound 0.0046 used the distance 1 and an \(M\) found only on the interval from 0 to 1.
On the interval from 0 to 3, the largest value of the derivative is \(\frac{e^{1.5}}{16}<\frac{4.5}{16}=\frac{9}{32}\), so \(M=\frac{9}{32}\) is valid. The new bound is far above 0.005, so it gives no guarantee, and the error of about 0.29 shows that the second claim is false.
\[\cr{\dfrac{(9/32)\,3^4}{4!}=\dfrac{243}{256}}\approx0.95\]
Practice
The Taylor polynomial at 0 of \(f(x)=(1+x)^{-1/2}\) approximates \(\dfrac{1}{\sqrt{1.1}}\). Find the smallest degree \(n\) for which the Lagrange bound guarantees an error of at most 0.0001.
Find the bound for n = 1, 2, 3, … at the distance 0.1. Stop at the first bar below the orange line at 0.0001.
Solution
Each derivative has \(1+t\) to a negative power, so its size falls as \(t\) increases, and \(M\) is its size at \(t=0\).
\[M=\tfrac34,\ \tfrac{15}{8},\ \tfrac{105}{16}\quad\text{for } n=1,2,3\]Substitute each \(M\), the distance 0.1 and the power \(n+1\).
\[\begin{aligned}\dfrac{\frac34(0.1)^2}{2!}&\approx0.00375\\ \dfrac{\frac{15}{8}(0.1)^3}{3!}&\approx0.00031\\ \dfrac{\frac{105}{16}(0.1)^4}{4!}&\approx0.000027\end{aligned}\]The first two bounds are above 0.0001. The third is below it, so the smallest degree is \(n=3\).
Questions
Questions 1 and 2 use the figure. The dashed red curve is the Lagrange bound \(\frac{x^6}{720}\) for the Taylor polynomial of degree 5 of the cosine at 0. The horizontal orange line in the lower graph is the tolerance 0.01.
For which input does the bound guarantee an error of at most 0.01?
- \(x=1.2\)
- \(x=1.5\)
- \(x=2\)
Answer
\(x=1.2\)
At \(x=1.5\) the bound is about 0.016, above the tolerance 0.01. What follows?
- The bound gives no guarantee of 0.01 there. The true error may still be smaller.
- The true error is more than 0.01.
- The true error is 0.016.
Answer
The bound gives no guarantee of 0.01 there. The true error may still be smaller.
For \(e^x\) on the interval from 0 to 1, use \(M=3\). What is the smallest degree \(n\) whose bound is at most 0.01?
- 5
- 4
- 6
Answer
5
Summary
A bound at or below the tolerance guarantees the approximation, because the true error is at most the bound.
As the degree rises the bound falls, so the first degree whose bound is at most the tolerance is the smallest sufficient degree.
The guarantee belongs to one input, because a new input changes the distance and can change \(M\).
This is one of four skills in topic 10.12 of Which & Why: AP Calculus.