### Achieving desired tolerance of a Taylor polynomial on desired interval

This third question is usually the most difficult, since it requires
both *estimates* and adjustment of *number of terms* in the
Taylor expansion: Given a function, given a fixed point, given
an interval around that fixed point, and given a required tolerance,
find *how many terms* must be used in the Taylor expansion to
approximate the function to within the required tolerance on the given
interval.

For example, let's get a Taylor polynomial approximation to
$e^x$ which is within $0.001$ on the interval
$[-{1\over 2},+{1\over 2}]$. We use
$$e^x=1+x+{x^2\over 2!}+{x^3\over 3!}+\ldots+{x^n\over n!}+
{e^c\over (n+1)!}x^{n+1}$$
for some $c$ between $0$ and $x$, and where we do not yet know what we
want $n$ to be. It is very convenient here that the $n$th derivative
of $e^x$ is still just $e^x$! We are wanting to *choose $n$ large-enough to guarantee that*
$$\left|{e^c\over (n+1)!}x^{n+1}\right|\le 0.001$$
for all $x$ in that interval (without knowing anything too detailed
about what the corresponding $c$'s are!).

The error term is estimated as follows,
by thinking
about the *worst-case scenario* for the sizes of the parts of that
term: we know that the exponential function is increasing along the
whole real line, so in any event $c$ lies in
$[-{1\over 2},+{1\over 2}]$ and
$$|e^c|\le e^{1/2}\le 2$$
(where we've not been too fussy about being accurate about how big the
square root of $e$ is!). And for $x$ in that interval we know that
$$|x^{n+1}|\le \left({1\over 2}\right)^{n+1}$$
So we are wanting to *choose $n$ large-enough to guarantee that*
$$\left|{e^c\over (n+1)!} ({1\over 2})^{n+1}\right|\le 0.001$$
Since
$$\left|{e^c\over (n+1)!} ({1\over 2})^{n+1}\right|
\le {2\over (n+1)!}\left({1\over 2}\right)^{n+1}$$
we can be confident of the desired inequality if we can be sure that
$${2\over (n+1)!}\left({1\over 2}\right)^{n+1}\le 0.001$$
That is, we want to ‘solve’ for $n$ in the inequality
$${2\over (n+1)!}\left({1\over 2}\right)^{n+1}\le 0.001$$

There is no genuine formulaic way to ‘solve’ for $n$ to accomplish this. Rather, we just evaluate the left-hand side of the desired inequality for larger and larger values of $n$ until (hopefully!) we get something smaller than $0.001$. So, trying $n=3$, the expression is $${2\over (3+1)!}\left({1\over 2}\right)^{3+1}={1\over 12\cdot 16}$$ which is more like $0.01$ than $0.001$. So just try $n=4$: $${2\over (4+1)!}\left({1\over 2}\right)^{4+1}={1\over 60\cdot 32}\le 0.00052$$ which is better than we need.

The conclusion is that we needed to take the Taylor polynomial of degree $n=4$ to achieve the desired tolerance along the whole interval indicated. Thus, the polynomial $$1+x+{x^2\over 2}+{x^3\over 3}+{x^4\over 4}$$ approximates $e^x$ to within $0.00052$ for $x$ in the interval $[-{1\over 2},{1\over 2}]$.

Yes, such questions can easily become very difficult. And, as a reminder, there is no real or genuine claim that this kind of approach to polynomial approximation is ‘the best’.

#### Exercises

- Determine how many terms are needed in order to have the corresponding Taylor polynomial approximate $e^x$ to within $0.001$ on the interval $[-1,+1]$.
- Determine how many terms are needed in order to have the corresponding Taylor polynomial approximate $\cos x$ to within $0.001$ on the interval $[-1,+1]$.
- Determine how many terms are needed in order to have the corresponding Taylor polynomial approximate $\cos x$ to within $0.001$ on the interval $[{ -\pi \over 2 },{ \pi \over 2 }]$.
- Determine how many terms are needed in order to have the corresponding Taylor polynomial approximate $\cos x$ to within $0.001$ on the interval $[-0.1,+0.1]$.
- Approximate $e^{1/2}=\sqrt{e}$ to within $.01$ by
using a Taylor polynomial with remainder term, expanded at $0$.
*(Do NOT add up the finite sum you get!)* - Approximate $\sqrt{101}=(101)^{1/2}$ to within
$10^{-15}$ using a Taylor polynomial with remainder term.
*(Do NOT add up the finite sum you get! One point here is that most hand calculators do not easily give 15 decimal places. Hah!)*

#### Thread navigation

##### Calculus Refresher

#### Similar pages

- How large an interval with given tolerance for a Taylor polynomial?
- Determining tolerance/error in Taylor polynomials.
- Taylor polynomials: formulas
- Computational tricks regarding Taylor polynomials
- Prototypes: More serious questions about Taylor polynomials
- Integrating the error term of a Taylor polynomial: example
- Classic examples of Taylor polynomials
- Integrating Taylor polynomials: first example
- Intermediate Value Theorem, location of roots
- A refresher on the chain rule
- More similar pages