Approximating Functions with Taylor and Maclaurin Polynomial

# Approximating Functions with Taylor and Maclaurin Polynomial

Recall from the Taylor and Maclaurin Polynomials page that $f$ is a function that is $n$ times differentiable on an open interval containing $c$, then the $n^{\mathrm{th}}$ order Taylor polynomial of $f$ at $c$ is given by the following formula:

(1)
\begin{align} \quad P_n(x) = f(c) + \frac{f^{(1)}(c)}{1!}(x - c) + \frac{f^{(2)}(c)}{2!}(x - c)^2 + ... + \frac{f^{(n)}(c)}{n!}(x - c)^n \end{align}

We also saw that error remainder $E_n(x)$ can be estimated using either the Lagrange Remainder formula, $E_n(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!}(x - c)^{n+1}$ for some $\xi$ between $c$ and $x$, or sometimes using the Integral Remainder formula, $E_n(x) = \frac{1}{n!} \int_c^x (x - t)^n f^{(n+1)}(t) \: dt$.

If we take the absolute value of the Lagrange formula of the remainder for some $x_0$ that we're approximating $f(x_0)$ for, then we have that:

(2)
\begin{align} \quad \mid E_n(x_0) \mid = \biggr \rvert \frac{f^{(n+1)}(\xi)}{(n+1)!}(x_0 - c)^{n+1} \biggr \rvert \end{align}

If we can find $\xi$ between $c$ and $x_0$ for which $f^{(n+1)}(\xi)$ is maximized, then $E_n(x_0)$ will be maximized. Let's look at some examples.

## Example 1

Estimate the maximum error by approximating the value $\sqrt{e}$ using the fourth degree Taylor polynomial of $f(x) = e^x$ centered at $0$.

Let's first construct the fourth degree Taylor polynomial of $f$. We note that $f^{(n)}(x) = e^x$ for all natural numbers $n$, and hence:

(3)
\begin{align} \quad P_4(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \frac{x^4}{24} \\ \quad P_4(0.5) = 1 + (0.5) + \frac{(0.5)^2}{2} + \frac{(0.5)^3}{6} + \frac{(0.5)^4}{24} \\ \quad P_4(0.5) \approx 1.6484375... \end{align}

Now the absolute value of the Lagrange formula for the remainder for some $\xi$ between $0$ and $0.5$ is given by:

(4)
\begin{align} \quad \mid E_4(0.5) \mid = \biggr \rvert \frac{f^{(5)}(\xi)}{5!}(0.5)^{5} \biggr \rvert = \biggr \rvert \frac{e^{\xi}}{5!}(0.5)^{5} \biggr \rvert \end{align}

Note that $f(x) = e^x$ is an increasing function on the interval $[0, 0.5]$. This can easily be since the derivative $f'(x) = e^x > 0$ for all $x \in \mathbb{R}$. Therefore $e^{\xi} < e^{0.5}$ for any $\xi$ between $0$ and $0.5$. However, we're trying to estimate $e^{0.5}$, so let's try to approximate further. Notice that $e^{0.5} = \sqrt{e} < \sqrt{3} < 2$, and so:

(5)
\begin{align} \quad \mid E_4 (0.5) \mid ≤ \biggr \rvert \frac{2}{5!}(0.5)^{5} \biggr \rvert = \frac{2}{5!}(0.5)^{5} = \frac{2(0.5)^5}{120} \end{align}

So our approximation $P_n(4) \approx 1.6484375...$ has error less than $E_n(4) = \frac{2(0.5)^5}{120}$ from the actual value of $e^{0.5}$. In fact, the true value is $e^{0.5} = 1.6487212...$, and thus:

(6)
\begin{align} \quad \mid f(0.5) - P_n(4) \mid = 1.6487212... - 1.6484375... = 0.0002837 < \frac{2(0.5)^5}{120} \approx 0.0005208... \end{align}

The blue curve below is the graph of the polynomial $P_4(x)$, and the black curve if the graph of $f(x) = e^x$.