Lecture 23 Taylor’s Inequality
Text References: Course notes pp. 107-110 & Rogawski 10.7
23.1 Recap
Last time, we learned about Taylor’s Remainder Theorem:
Theorem 23.1 If \(f(x)\) has \(n+1\) derivatives at \(x_0\), then \[f(x)=\sum_{k=0}^n \frac{f^{(k)}(x_0)(x-x_0)^k}{k!}+R_n(x)\] where \[R_n(x)=\int_{x_0}^x\frac{(x-t)^n}{n!}f^{(n+1)}(t)dt\]
23.2 Learning Objectives
- Compute an upper bound on the error in an \(n\)th order Taylor polynomial.
23.3 Taylor’s Inequality
Remember that we’re still working towards the goal of determining how accurate our Taylor polynomial approximations are. Last time, we were able to derive a relatively tidy expression for the remainder or error of a Taylor polynomial. Today, we’re going to work on determining an upper bound for the error. In order to do this, we will rely on a generalization of the triangle inequality.
The triangle inequality you might be familiar with is \(|a+b|\leq |a|+|b|\). We can generalize it to an arbitrary number of sums to get \(\displaystyle \left | \sum_{i=1}n a_i \right | \leq \sum_{i=1}^n |a_i|\). Generalizing a bit more to Riemann sums gives \[\left |\int_a^b f(x)fx \right |\leq \int_a^b |f(x)|dx \quad \mbox{(assuming $a<b$)}\]
Going back to our expression for the error and applying the generalized triangle inequality, the magnitude of the error is:
\[\begin{align*} |R_n(x)|&= \left | \int_{x_0}^x\frac{(x-t)^n}{n!}f^{(n+1)}(t)dt\right |\\ & \leq \int_{x_0}^x\frac{|x-t|^n}{n!}|f^{(n+1)}(t)|dt \quad \mbox{by the triangle inequality}\\ &= \leq \int_{x_0}^x\frac{|x-t|^n}{n!}Kdt \quad \mbox{for a constant $K$ such that $|f^{(n+1)}(t)|\leq K$} \\ &= -K \left. \frac{|x-t|^{n+1}}{(n+1)!}\right |_{x_0}^x \\ &= K \frac{|x-x_0|^{n+1}}{(n+1)!} \end{align*}\]
We can now state the general result:
Theorem 23.2 The error in using an \(n\)th order Taylor polynomial \(P_{n, x_0}(x)\) as an approximatino to \(f(x)\) satisfies the inequality \[|R_n(x)|\leq K \frac{|x-x_0|^{n+1}}{(n+1)!} \] where \(f^{(n+1)}(t)|\leq K\) for all values of \(z\) between \(x_0\) and \(x\).
You might be wondering about this constant \(K\) and how to find it. In practice, we will know that the function \(f(x)\) is and we will be able to calculate the relevant derivative and bound it. There are a few tricks you can use:
- If the function is monotonic (i.e. non-increasing or non-decreasing) on the interval \([x_0,x]\), then its maximum on the interval is found by evaluating the function at the endpoints.
- If the function is not monotonic on the interval \([x_0,x]\) but can be written as products of monotonic functions, we can find the maximum for each factor and multiply them together.
- If the function is not monotonic on the interval \([x_0,x]\) but can be written as a sum, we can use the triangle inequality to find a monotonic function that bounds it.
- If the function is not monotonic on the interval \([x_0,x]\) we can find its maximum on that interval using our usual maximization techniques.
Exercise 23.1 Let \(f(x)=\cos(x)\) and suppose that \(P_{6,0}(x)=1- \frac{x^2}{2!}+\frac{x^4}{4!}-\frac{x^6}{6!}\) (You should check this for yourself!)
- Use \(P_{6,0}(x)\) to approximate \(\cos(2)\).
- Find an upper bound on the error term from part a.
- For what values of \(n\) does \(P_{n,0}(2)\) approximate \(\cos(2)\) correct to \(4\) decimal places?
Solution. We are given that \(P_{6,0}(x)=1- \frac{x^2}{2!}+\frac{x^4}{4!}-\frac{x^6}{6!}\).
- Our estimate for \(\cos(2)\) is \[P_{6,0}(2)=1- \frac{2^2}{2!}+\frac{2^4}{4!}-\frac{2^6}{6!}=-\frac{19}{45}\approx -0.422\]
- We will use Taylor’s Inequality to find an upper bound on the error term. Note that \(\sin(x)\) is monotonic on \([0,2]\). We have \[f^{(7)}(x)=|\sin(x)|\leq 1\quad\mbox{for all $x\in[0,2]$}\] so we can set \(K=1\). Applying Taylor’s Inequality, \[|R_6(2)|\leq K \frac{|2-0|^{6+1}}{(6+1)!}=\frac{1\cdot 2^7}{7!}=\frac{8}{315}\] This means that the error is bounded above by \(\frac{8}{315}\approx 0.0254\). In other words, the value of \(\cos(2)\) lies in the interval \([-\frac{19}{45}-\frac{8}{315}, -\frac{19}{45}+\frac{8}{315}]\approx [-0.448, -0.396]\)
- The approximation \(P_{n,0}(2)\) being correct to \(4\) decimal places means that the error term is less than \(10^{-4}\). That is, \[R_{n}(2)\leq K \frac{(x-x_0)^{n+1}}{(n+1)!} < 10^{-4}\]
We have \[R_{n}(2)\leq K \frac{|x-x_0|^{n+1}}{(n+1)!} = \frac{1\cdot |2-0|^{n+1}}{(n+1)!} = \frac{2^{n+1}}{(n+1)!}\] At this point, we’re going to have to do a bit of trial and error to find a value of \(n\) that works. Remember, we’re looking for a value of \(n\) that makes the remainder less than \(10^{-4}\). Our previous work found that at \(n=6\), the error is approximately \(0.0254\), which is greater than \(10^{-4}\). Let’s start from \(n=7\) and go from there.
- When \(n=7\), \(|R_7(x)|\leq \frac{2^8}{8!}\approx 0.00635\)
- When \(n=8\), \(|R_8(x)|\leq \frac{2^9}{9!}\approx 0.00142\)
- When \(n=9\), \(|R_9(x)|\leq \frac{2^{10}}{10!}\approx 0.00029\)
- When \(n=10\), \(|R_{10}(x)|\leq \frac{2^{11}}{11!}\approx 0.00006 < 10^{-4}\)
Therefore \(P_{n,0}(2)\) approximates \(\cos(2)\) correct to \(4\) decimal places for values of \(n\) greater than or equal to \(10\).
Use this interactive applet to observe what’s happening. The applet shows the function \(f(x)=\cos(x)\) along with the Taylor polynomial \(P_{n,0}(x)\). Use the slider to increase the value of \(n\) and observe how the magnitude of the remainder changes for \(x=2\). Note that the only two decimals can be displayed.