Consider a function $y=f(x)$ and a point $\big(c,f(c)\big)\text{.}$ The derivative, $\fp(c)\text{,}$ gives the instantaneous rate of change of $f$ at $x=c\text{.}$ Of all lines that pass through the point $\big(c,f(c)\big)\text{,}$ the line that best approximates $f$ at this point is the tangent line; that is, the line whose slope (rate of change) is $\fp(c)\text{.}$

In <<Unresolved xref, reference "fig_taypolyintroa_1"; check spelling or use "provisional" attribute>>, we see a function $y=f(x)$ graphed. The table in Figure 8.7.1.(b) that $f(0)=2$ and $\fp(0) = 1\text{;}$ therefore, the tangent line to $f$ at $x=0$ is $p_1(x) = 1(x-0)+2 = x+2\text{.}$ The tangent line is also given in the figure. Note that “near” $x=0\text{,}$ $p_1(x) \approx f(x)\text{;}$ that is, the tangent line approximates $f$ well.

 $f(0) = 2$ $\fp''(0) = -1$ $\fp(0) = 1$ $f^{(4)}(0)=-12$ $\fpp(0) = 2$ $f^{(5)}(0)=-19$

One shortcoming of this approximation is that the tangent line only matches the slope of $f\text{;}$ it does not, for instance, match the concavity of $f\text{.}$ We can find a polynomial, $p_2(x)\text{,}$ that does match the concavity near $0$ without much difficulty, though. The table in Figure 8.7.1 gives the following information: \begin{equation*} f(0) = 2 \qquad \fp(0) = 1\qquad \fp'(0) = 2. \end{equation*}

Therefore, we want our polynomial $p_2(x)$ to have these same properties. That is, we need \begin{equation*} p_2(0) = 2 \qquad p_2'(0) = 1 \qquad p_2''(0) = 2. \end{equation*}

This is simply an initial–value problem. We can solve this using the techniques first described in Section 5.1. To keep $p_2(x)$ as simple as possible, we'll assume that not only $p_2''(0)=2\text{,}$ but that $p_2''(x)=2\text{.}$ That is, the second derivative of $p_2$ is constant, meaning $p_2$ is a quadratic function.

If $p_2''(x) = 2\text{,}$ then $p_2'(x) = 2x+C$ for some constant $C\text{.}$ Since we have determined that $p_2'(0) = 1\text{,}$ we find that $C=1$ and so $p_2'(x) = 2x+1\text{.}$ Finally, we can compute $p_2(x) = x^2+x+C\text{.}$ Using our initial values, we know $p_2(0) = 2$ so $C=2\text{.}$ We conclude that $p_2(x) = x^2+x+2\text{.}$ This function is plotted with $f$ in Figure 8.7.2.

We can repeat this approximation process by creating polynomials of higher degree that match more of the derivatives of $f$ at $x=0\text{.}$ In general, a polynomial of degree $n$ can be created to match the first $n$ derivatives of $f\text{.}$ Figure 8.7.2 also shows $p_4(x)= -x^4/2-x^3/6+x^2+x+2\text{,}$ whose first four derivatives at 0 match those of $f\text{.}$ (Using the table in Figure 8.7.1, start with $p_4^{(4)}(x)=-12$ and solve the related initial–value problem.)

As we use more and more derivatives, our polynomial approximation to $f$ gets better and better. In this example, the interval on which the approximation is “good” gets bigger and bigger. Figure 8.7.3 shows $p_{13}(x)\text{;}$ we can visually affirm that this polynomial approximates $f$ very well on $[-2,3]\text{.}$ (The polynomial $p_{13}(x)$ is not particularly “nice”. It is \begin{align*} \amp p_{13}=(x)\frac{16901x^{13}}{6227020800}+\frac{13x^{12}}{1209600}-\frac{1321x^{11}}{39916800}-\frac{779x^{10}}{1814400} -\frac{359x^9}{362880}\\ \amp +\frac{x^8}{240}+\frac{139x^7}{5040}+\frac{11 x^6}{360}-\frac{19x^5}{120}-\frac{x^4}{2}-\frac{x^3}{6}+x^2+x+2 \end{align*}

The polynomials we have created are examples of Taylor polynomials, named after the British mathematician Brook Taylor who made important discoveries about such functions. While we created the above Taylor polynomials by solving initial–value problems, it can be shown that Taylor polynomials follow a general pattern that make their formation much more direct. This is described in the following definition.

##### Definition8.7.4Taylor Polynomial, Maclaurin Polynomial

Let $f$ be a function whose first $n$ derivatives exist at $x=c\text{.}$

1. The Taylor polynomial of degree $n$ of $f$ at $x=c$ is \begin{equation*} p_n(x) = f(c) + \fp(c)(x-c) + \frac{\fpp(c)}{2!}(x-c)^2+\frac{\fp''(c)}{3!}(x-c)^3+\cdots+\frac{f^{(n)}(c)}{n!}(x-c)^n. \end{equation*}

2. A special case of the Taylor polynomial is the Maclaurin polynomial, where $c=0\text{.}$ That is, the Maclaurin polynomial of degree $n$ of $f$ is \begin{equation*} p_n(x) = f(0) + \fp(0)x + \frac{\fpp(0)}{2!}x^2+\frac{\fp''(0)}{3!}x^3+\cdots+\frac{f^{(n)}(0)}{n!}x^n. \end{equation*}

We will practice creating Taylor and Maclaurin polynomials in the following examples.

##### Example8.7.5Finding and using Maclaurin polynomials
1. Find the $n^\text{ th }$ Maclaurin polynomial for $f(x) = e^x\text{.}$

2. Use $p_5(x)$ to approximate the value of $e\text{.}$

Solution
##### Example8.7.8Finding and using Taylor polynomials
1. Find the $n^\text{ th }$ Taylor polynomial of $y=\ln(x)$ at $x=1\text{.}$

2. Use $p_6(x)$ to approximate the value of $\ln(1.5)\text{.}$

3. Use $p_6(x)$ to approximate the value of $\ln(2)\text{.}$

Solution

Taylor polynomials are used to approximate functions $f(x)$ in mainly two situations:

1. When $f(x)$ is known, but perhaps “hard” to compute directly. For instance, we can define $y=\cos(x)$ as either the ratio of sides of a right triangle (“adjacent over hypotenuse”) or as the horizontal coordinate where the terminal ray of an angle intersects the unit circle. However, neither of these provides a convenient way of computing $\cos(2)$ (as with all calculus, we default to using radian measure, so this is an angle of $2$ radians). A Taylor polynomial of sufficiently high degree can provide a reasonable method of computing such values using only operations usually hard–wired into a computer ($+\text{,}$ $-\text{,}$ × and $\div$).

2. When $f(x)$ is not known, but information about its derivatives is known. This occurs more often than one might think, especially in the study of differential equations.

Even though Taylor polynomials could be used in calculators and computers to calculate values of trigonometric functions, in practice they generally aren't. Other more efficient and accurate methods have been developed, such as the CORDIC algorithm. However, understanding how Taylor polynomials could be used is important to developing an understanding of various approximating techniques.

In both situations, a critical piece of information to have is “How good is my approximation?” If we use a Taylor polynomial to compute $\cos(2)\text{,}$ how do we know how accurate the approximation is?

We had the same problem when studying Numerical Integration. Theorem 5.5.24 provided bounds on the error when using, say, Simpson's Rule to approximate a definite integral. These bounds allowed us to determine that, for instance, using $10$ subintervals provided an approximation within $\pm .01$ of the exact value. The following theorem gives similar bounds for Taylor (and hence Maclaurin) polynomials.

The first part of Taylor's Theorem states that $f(x) = p_n(x) + R_n(x)\text{,}$ where $p_n(x)$ is the $n^\text{ th }$ order Taylor polynomial and $R_n(x)$ is the remainder, or error, in the Taylor approximation. The second part gives bounds on how big that error can be. If the $(n+1)^\text{ th }$ derivative is large, the error may be large; if $x$ is far from $c\text{,}$ the error may also be large. However, the $(n+1)!$ term in the denominator tends to ensure that the error gets smaller as $n$ increases.

The following example computes error estimates for the approximations of $\ln(1.5)$ and $\ln(2)$ made in Example 8.7.8.

##### Example8.7.13Finding error bounds of a Taylor polynomial

Use Theorem 8.7.12 to find error bounds when approximating $\ln(1.5)$ and $\ln(2)$ with $p_6(x)\text{,}$ the Taylor polynomial of degree 6 of $f(x)=\ln(x)$ at $x=1\text{,}$ as calculated in Example 8.7.8.

Solution

We practice again. This time, we use Taylor's theorem to find $n$ that guarantees our approximation is within a certain amount.

##### Example8.7.14Finding sufficiently accurate Taylor polynomials

Find $n$ such that the $n^\text{ th }$ Taylor polynomial of $f(x)=\cos(x)$ at $x=0$ approximates $\cos(2)$ to within $0.001$ of the actual answer. What is $p_n(2)\text{?}$

Solution
##### Example8.7.17Finding and using Taylor polynomials
1. Find the degree 4 Taylor polynomial, $p_4(x)\text{,}$ for $f(x)=\sqrt{x}$ at $x=4\text{.}$

2. Use $p_4(x)$ to approximate $\sqrt{3}\text{.}$

3. Find bounds on the error when approximating $\sqrt{3}$ with $p_4(3)\text{.}$

Solution

Our final example gives a brief introduction to using Taylor polynomials to solve differential equations.

##### Example8.7.20Approximating an unknown function

A function $y=f(x)$ is unknown save for the following two facts.

1. $y(0) = f(0) = 1\text{,}$ and

2. $y'= y^2$

(This second fact says that amazingly, the derivative of the function is actually the function squared!)

Find the degree 3 Maclaurin polynomial $p_3(x)$ of $y=f(x)\text{.}$

Solution

It is beyond the scope of this text to pursue error analysis when using Taylor polynomials to approximate solutions to differential equations. This topic is often broached in introductory Differential Equations courses and usually covered in depth in Numerical Analysis courses. Such an analysis is very important; one needs to know how good their approximation is. We explored this example simply to demonstrate the usefulness of Taylor polynomials.

Most of this chapter has been devoted to the study of infinite series. This section has taken a step back from this study, focusing instead on finite summation of terms. In the next section, we explore Taylor Series, where we represent a function with an infinite series.

# Subsection8.7.1Exercises

Terms and Concepts

In the following exercises, find the Maclaurin polynomial of degree $n$ for the given function.