Math Insight

Determining tolerance/error in Taylor polynomials.

This section treats a simple example of the second kind of question mentioned above: ‘Given a Taylor polynomial approximation to a function, expanded at some given point, and given an interval around that given point, within what tolerance does the Taylor polynomial approximate the function on that interval?’

Let's look at the approximation $1-{x^2\over 2}+{x^4\over 4!}$ to $f(x)=\cos^x$ on the interval $[-{1\over 2}, {1\over 2}]$. We might ask ‘Within what tolerance does this polynomial approximate $\cos x$ on that interval?’

To answer this, we first recall that the error term we have after those first (oh-so-familiar) terms of the expansion of cosine is $${-\sin c\over 5!}x^5$$ For $x$ in the indicated interval, we want to know the worst-case scenario for the size of this thing. A sloppy but good and simple estimate on $\sin c$ is that $|\sin c|\le 1$, regardless of what $c$ is. This is a very happy kind of estimate because it's not so bad and because it doesn't depend at all upon $x$. And the biggest that $x^5$ can be is $({1\over 2})^5\approx 0.03$. Then the error is estimated as $$|{-\sin c\over 5!}x^5|\le {1\over 2^5\cdot 5!}\le 0.0003$$ This is not so bad at all!

We could have been a little clever here, taking advantage of the fact that a lot of the terms in the Taylor expansion of cosine at $0$ are already zero. In particular, we could choose to view the original polynomial $1-{x^2\over 2}+{x^4\over 4!}$ as including the fifth-degree term of the Taylor expansion as well, which simply happens to be zero, so is invisible. Thus, instead of using the remainder term with the ‘5’ in it, we are actually entitled to use the remainder term with a ‘6’. This typically will give a better outcome.

That is, instead of the remainder we had must above, we would have an error term $${-\cos c\over 6!}x^6$$ Again, in the worst-case scenario $|-\cos c|\le 1$. And still $|x|\le {1\over 2}$, so we have the error estimate $$|{-\cos c\over 6!}x^6|\le {1\over 2^6\cdot 6!}\le 0.000022$$ This is less than a tenth as much as in the first version.

But what happened here? Are there two different answers to the question of how well that polynomial approximates the cosine function on that interval? Of course not. Rather, there were two approaches taken by us to estimate how well it approximates cosine. In fact, we still do not know the exact error!

The point is that the second estimate (being a little wiser) is closer to the truth than the first. The first estimate is true, but is a weaker assertion than we are able to make if we try a little harder.

This already illustrates the point that ‘in real life’ there is often no single ‘right’ or ‘best’ estimate of an error, in the sense that the estimates that we can obtain by practical procedures may not be perfect, but represent a trade-off between time, effort, cost, and other priorities.

Exercises

1. How well (meaning ‘within what tolerance’) does $1-x^2/2+x^4/24-x^6/720$ approximate $\cos x$ on the interval $[-0.1,0.1]$?
2. How well (meaning ‘within what tolerance’) does $1-x^2/2+x^4/24-x^6/720$ approximate $\cos x$ on the interval $[-1,1]$?
3. How well (meaning ‘within what tolerance’) does $1-x^2/2+x^4/24-x^6/720$ approximate $\cos x$ on the interval $[{ -\pi \over 2 },{ \pi \over 2 }]$?