# 8.5: Taylor Polynomials and Taylor Series

- Page ID
- 107850

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\id}{\mathrm{id}}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\kernel}{\mathrm{null}\,}\)

\( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\)

\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\)

\( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)

\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)

\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vectorC}[1]{\textbf{#1}} \)

\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)What is a Taylor polynomial? For what purposes are Taylor polynomials used?

What is a Taylor series?

How do we determine the accuracy when we use a Taylor polynomial to approximate a function?

So far, each infinite series we have discussed has been a series of real numbers, such as

\[

1+\frac{1}{2}+\frac{1}{4}+\cdots+\frac{1}{2^k}+\cdots=\sum_{k=0}^{\infty} \frac{1}{2^k}

\]

In the remainder of this chapter, we will include series that involve a variable. For instance, if in the geometric series in Equation (8.5.1) we replace the ratio \(r=\frac{1}{2}\) with the variable \(x\), we have the infinite (still geometric) series

\[

1+x+x^2+\cdots+x^k+\cdots=\sum_{k=0}^{\infty} x^k

\]

Here we see something very interesting: because a geometric series converges whenever its ratio \(r\) satisfies \(|r|<1\), and the sum of a convergent geometric series is \(\frac{a}{1-r}\), we can say that for \(|x|<1\)

\[

1+x+x^2+\cdots+x^k+\cdots=\frac{1}{1-x} .

\]

Equation (8.5.3) states that the non-polynomial function \(\frac{1}{1-x}\) on the right is equal to the infinite polynomial expresssion on the left. Because the terms on the left get very small as \(k\) gets large, we can truncate the series and say, for example, that

\[

1+x+x^2+x^3 \approx \frac{1}{1-x} \nonumber

\]

Preview Activity 8.3.1 showed how we can approximate the number \(e\) using linear, quadratic, and other polynomial functions; we then used similar ideas in Preview Activity 8.4.1 to approximate \(\ln (2)\). In this activity, we review and extend the process to find the "best" quadratic approximation to the exponential function \(e^x\) around the origin. Let \(f(x)=e^x\) throughout this activity.

a. Find a formula for \(P_1(x)\), the linearization of \(f(x)\) at \(x=0\). (We label this linearization \(P_1\) because it is a first degree polynomial approximation.) Recall that \(P_1(x)\) is a good approximation to \(f(x)\) for values of \(x\) close to 0 . Plot \(f\) and \(P_1\) near \(x=0\) to illustrate this fact.

b. Since \(f(x)=e^x\) is not linear, the linear approximation eventually is not a very good one. To obtain better approximations, we want to develop a different approximation that "bends" to make it more closely fit the graph of \(f\) near \(x=0\). To do so, we add a quadratic term to \(P_1(x)\). In other words, we let

\[

P_2(x)=P_1(x)+c_2 x^2 \nonumber

\]

for some real number \(c_2\). We need to determine the value of \(c_2\) that makes the graph of \(P_2(x)\) best fit the graph of \(f(x)\) near \(x=0\).

Remember that \(P_1(x)\) was a good linear approximation to \(f(x)\) near 0 ; this is because \(P_1(0)=f(0)\) and \(P_1^{\prime}(0)=f^{\prime}(0)\). It is therefore reasonable to seek a value of \(c_2\) so that

\[

P_2(0)=f(0), \quad P_2^{\prime}(0)=f^{\prime}(0), \quad \text { and } P_2^{\prime \prime}(0)=f^{\prime \prime}(0) . \nonumber

\]

Remember, we are letting \(P_2(x)=P_1(x)+c_2 x^2\).

- Calculate \(P_2(0)\) to show that \(P_2(0)=f(0)\).
- Calculate \(P_2^{\prime}(0)\) to show that \(P_2^{\prime}(0)=f^{\prime}(0)\).
- Calculate \(P_2^{\prime \prime}(x)\). Then find a value for \(c_2\) so that \(P_2^{\prime \prime}(0)=f^{\prime \prime}(0)\).
- Explain why the condition \(P_2^{\prime \prime}(0)=f^{\prime \prime}(0)\) will put an appropriate "bend" in the graph of \(P_2\) to make \(P_2\) fit the graph of \(f\) around \(x=0\).

## Taylor Polynomials

Preview Activity \(\PageIndex{1}\) illustrates the first steps in the process of approximating functions with polynomials. Using this process we can approximate trigonometric, exponential, logarithmic, and other nonpolynomial functions as closely as we like (for certain values of \(x\) ) with polynomials. This is extraordinarily useful in that it allows us to calculate values of these functions to whatever precision we like using only the operations of addition, subtraction, multiplication, and division, which can be easily programmed in a computer.

We next extend the approach in Preview Activity 8.5.1 to arbitrary functions at arbitrary points. Let \(f\) be a function that has as many derivatives as we need at a point \(x=a\). Recall that \(P_1(x)\) is the tangent line to \(f\) at \((a, f(a))\) and is given by the formula

\[

P_1(x)=f(a)+f^{\prime}(a)(x-a) . \nonumber

\]

\(P_1(x)\) is the linear approximation to \(f\) near \(a\) that has the same slope and function value as \(f\) at the point \(x=a\).

We next want to find a quadratic approximation

\[

P_2(x)=P_1(x)+c_2(x-a)^2 \nonumber

\]

so that \(P_2(x)\) more closely models \(f(x)\) near \(x=a\). Consider the following calculations of the values and derivatives of \(P_2(x)\) :

\(P_2(x)=P_1(x)+c_2(x-a)^2 \quad P_2(a)=P_1(a)=f(a)\)

\(P_2^{\prime}(x)=P_1^{\prime}(x)+2 c_2(x-a) \quad P_2^{\prime}(a)=P_1^{\prime}(a)=f^{\prime}(a)\)

\(P_2^{\prime \prime}(x)=2 c_2 \quad P_2^{\prime \prime}(a)=2 c_2\).

To make \(P_2(x)\) fit \(f(x)\) better than \(P_1(x)\), we want \(P_2(x)\) and \(f(x)\) to have the same concavity at \(x=a\), in addition to having the same slope and function value. That is, we want to have

\[

P_2^{\prime \prime}(a)=f^{\prime \prime}(a) . \nonumber

\]

This implies that

\[

2 c_2=f^{\prime \prime}(a) \nonumber

\]

and thus

\[

c_2=\frac{f^{\prime \prime}(a)}{2} . \nonumber

\]

Therefore, the quadratic approximation \(P_2(x)\) to \(f\) centered at \(x=a\) is

\[

P_2(x)=f(a)+f^{\prime}(a)(x-a)+\frac{f^{\prime \prime}(a)}{2 !}(x-a)^2 . \nonumber

\]

This approach extends naturally to polynomials of higher degree. We define polynomials

\[

\begin{array}{l}

P_3(x)=P_2(x)+c_3(x-a)^3, \\

P_4(x)=P_3(x)+c_4(x-a)^4, \\

P_5(x)=P_4(x)+c_5(x-a)^5,

\end{array} \nonumber

\]

and in general

\[

P_n(x)=P_{n-1}(x)+c_n(x-a)^n . \nonumber

\]

The defining property of these polynomials is that for each \(n, P_n(x)\) and all its first \(n\) derivatives must agree with those of \(f\) at \(x=a\). In other words we require that

\[

P_n^{(k)}(a)=f^{(k)}(a) \nonumber

\]

for all \(k\) from 0 to \(n\).

To see the conditions under which this happens, suppose

\[

P_n(x)=c_0+c_1(x-a)+c_2(x-a)^2+\cdots+c_n(x-a)^n . \nonumber

\]

Then

\[

\begin{array}{l}

P_n^{(0)}(a)=c_0 \\

P_n^{(1)}(a)=c_1 \\

P_n^{(2)}(a)=2 c_2 \\

P_n^{(3)}(a)=(2)(3) c_3 \\

P_n^{(4)}(a)=(2)(3)(4) c_4 \\

P_n^{(5)}(a)=(2)(3)(4)(5) c_5

\end{array} \nonumber

\]

and, in general,

\[

P_n^{(k)}(a)=(2)(3)(4) \cdots(k-1)(k) c_k=k ! c_k . \nonumber

\]

So having \(P_n^{(k)}(a)=f^{(k)}(a)\) means that \(k ! c_k=f^{(k)}(a)\) and therefore

\[

c_k=\frac{f^{(k)}(a)}{k !} \nonumber

\]

for each value of \(k\). Using this expression for \(c_k\), we have found the formula for the polynomial approximation of \(f\) that we seek. Such a polynomial is called a Taylor polynomial.

##### \(\PageIndex{1}\):

The \(n\)th order Taylor polynomial of \(f\) centered at \(x=a\) is given by

\[

\begin{aligned}

P_n(x) &=f(a)+f^{\prime}(a)(x-a)+\frac{f^{\prime \prime}(a)}{2 !}(x-a)^2+\cdots+\frac{f^{(n)}(a)}{n !}(x-a)^n \\

&=\sum_{k=0}^n \frac{f^{(k)}(a)}{k !}(x-a)^k .

\end{aligned} \nonumber

\]

This degree \(n\) polynomial approximates \(f(x)\) near \(x=a\) and has the property that \(P_n^{(k)}(a)=f^{(k)}(a)\) for \(k=0,1, \ldots, n\).

Example 8.5.1. Determine the third order Taylor polynomial for \(f(x)=e^x\), as well as the general \(n\)th order Taylor polynomial for \(f\) centered at \(x=0\).

###### Solution

We know that \(f^{\prime}(x)=e^x\) and so \(f^{\prime \prime}(x)=e^x\) and \(f^{\prime \prime \prime}(x)=e^x\). Thus,

\[

f(0)=f^{\prime}(0)=f^{\prime \prime}(0)=f^{\prime \prime \prime}(0)=1 . \nonumber

\]

So the third order Taylor polynomial of \(f(x)=e^x\) centered at \(x=0\) is

\[

\begin{aligned}

P_3(x) &=f(0)+f^{\prime}(0)(x-0)+\frac{f^{\prime \prime}(0)}{2 !}(x-0)^2+\frac{f^{\prime \prime \prime}(0)}{3 !}(x-0)^3 \\

&=1+x+\frac{x^2}{2}+\frac{x^3}{6} .

\end{aligned} \nonumber

\]

In general, for the exponential function \(f\) we have \(f^{(k)}(x)=e^x\) for every positive integer \(k\). Thus, the \(k\) th term in the \(n\)th order Taylor polynomial for \(f(x)\) centered at \(x=0\) is

\[

\frac{f^{(k)}(0)}{k !}(x-0)^k=\frac{1}{k !} x^k . \nonumber

\]

Therefore, the \(n\)th order Taylor polynomial for \(f(x)=e^x\) centered at \(x=0\) is

\[

P_n(x)=1+x+\frac{x^2}{2 !}+\cdots+\frac{1}{n !} x^n=\sum_{k=0}^n \frac{x^k}{k !} . \nonumber

\]

We have just seen that the \(n\)th order Taylor polynomial centered at \(a=0\) for the exponential function \(e^x\) is

\[

\sum_{k=0}^n \frac{x^k}{k !} . \nonumber

\]

In this activity, we determine small order Taylor polynomials for several other familiar functions, and look for general patterns.

a. Let \(f(x)=\frac{1}{1-x}\).

i. Calculate the first four derivatives of \(f(x)\) at \(x=0\). Then find the fourth order Taylor polynomial \(P_4(x)\) for \(\frac{1}{1-x}\) centered at 0 .

ii. Based on your results from part (i), determine a general formula for \(f^{(k)}(0)\)

b. Let \(f(x)=\cos (x)\).

i. Calculate the first four derivatives of \(f(x)\) at \(x=0\). Then find the fourth order Taylor polynomial \(P_4(x)\) for \(\cos (x)\) centered at 0 .

ii. Based on your results from part (i), find a general formula for \(f^{(k)}(0)\). (Think about how \(k\) being even or odd affects the value of the \(k\) th derivative.)

c. Let \(f(x)=\sin (x)\).

i. Calculate the first four derivatives of \(f(x)\) at \(x=0\). Then find the fourth order Taylor polynomial \(P_4(x)\) for \(\sin (x)\) centered at 0 .

ii. Based on your results from part (i), find a general formula for \(f^{(k)}(0)\). (Think about how \(k\) being even or odd affects the value of the \(k\) th derivative.)

It is possible that an \(n\)th order Taylor polynomial is not a polynomial of degree \(n\); that is, the order of the approximation can be different from the degree of the polynomial. For example, in Activity 8.5.3 we found that the second order Taylor polynomial \(P_2(x)\) centered at 0 for \(\sin (x)\) is \(P_2(x)=x\). In this case, the second order Taylor polynomial is a degree 1 polynomial.

## Taylor Series

In Activity \(\PageIndex{2}\) we saw that the fourth order Taylor polynomial \(P_4(x)\) for \(\sin (x)\) centered at 0 is

\[

P_4(x)=x-\frac{x^3}{3 !} . \nonumber

\]

The pattern we found for the derivatives \(f^{(k)}(0)\) describe the higher-order Taylor polynomials, e.g.,

\[

\begin{array}{l}

P_5(x)=x-\frac{x^3}{3 !}+\frac{x^5}{5 !}, \\

P_7(x)=x-\frac{x^3}{3 !}+\frac{x^5}{5 !}-\frac{x^7}{7 !}, \\

P_9(x)=x-\frac{x^3}{3 !}+\frac{x^5}{5 !}-\frac{x^7}{7 !}+\frac{x^9}{9 !},

\end{array} \nonumber

\]

and so on. It is instructive to consider the graphical behavior of these functions; Figure \(\PageIndex{1}\) shows the graphs of a few of the Taylor polynomials centered at 0 for the sine function.

Notice that \(P_1(x)\) is close to the sine function only for values of \(x\) that are close to 0 , but as we increase the degree of the Taylor polynomial the Taylor polynomials provide a better fit to the graph of the sine function over larger intervals. This illustrates the general behavior of Taylor polynomials: for any sufficiently well-behaved function, the sequence \(\left\{P_n(x)\right\}\) of Taylor polynomials converges to the function \(f\) on larger and larger intervals (though those intervals may not necessarily increase without bound). If the Taylor polynomials ultimately converge to \(f\) on its entire domain, we write

\[

f(x)=\sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k !}(x-a)^k . \nonumber

\]

##### \(\PageIndex{2}\)

Let \(f\) be a function all of whose derivatives exist at \(x=a\). The Taylor series for \(f\) centered at \(x=a\) is the series \(T_f(x)\) defined by

\[

T_f(x)=\sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k !}(x-a)^k .

\]

In the special case where \(a=0\) in Definition 8.5.3, the Taylor series is also called the Maclaurin series for \(f\). From Example 8.5.1 we know the \(n\)th order Taylor polynomial centered at 0 for the exponential function \(e^x\); thus, the Maclaurin series for \(e^x\) is

\[

\sum_{k=0}^{\infty} \frac{x^k}{k !} . \nonumber

\]

In Activity \(\PageIndex{2}\ we determined small order Taylor polynomials for a few familiar functions, and also found general patterns in the derivatives evaluated at 0 . Use that information to write the Taylor series centered at 0 for the following functions.

a. \(f(x)=\frac{1}{1-x}\)

b. \(f(x)=\cos (x)\) (You will need to carefully consider how to indicate that many of the coefficients are 0 . Think about a general way to represent an even integer.)

c. \(f(x)=\sin (x)\) (You will need to carefully consider how to indicate that many of the coefficients are 0 . Think about a general way to represent an odd integer.)

d. \(f(x)=\frac{1}{1+x}\)

- Plot the graphs of several of the Taylor polynomials centered at 0 (of order at least 5) for \(e^x\) and convince yourself that these Taylor polynomials converge to \(e^x\) for every value of \(x\).
- Draw the graphs of several of the Taylor polynomials centered at 0 (of order at least 6\()\) for \(\cos (x)\) and convince yourself that these Taylor polynomials converge to \(\cos (x)\) for every value of \(x\). Write the Taylor series centered at 0 for \(\cos (x)\).
- Draw the graphs of several of the Taylor polynomials centered at 0 for \(\frac{1}{1-x}\). Based on your graphs, for what values of \(x\) do these Taylor polynomials appear to converge to \(\frac{1}{1-x}\) ? How is this situation different from what we observe with \(e^x\) and \(\cos (x)\) ? In addition, write the Taylor series centered at 0 for \(\frac{1}{1-x}\).

The Maclaurin series for \(e^x, \sin (x), \cos (x)\), and \(\frac{1}{1-x}\) will be used frequently, so we should be certain to know and recognize them well.

## The Interval of Convergence of a Taylor Series

In the previous section (in Figure \(\PageIndex{1}\) and Activity \(\PageIndex{4}\)) we observed that the Taylor polynomials centered at 0 for \(e^x, \cos (x)\), and \(\sin (x)\) converged to these functions for all values of \(x\) in their domain, but that the Taylor polynomials centered at 0 for \(\frac{1}{1-x}\) converge to \(\frac{1}{1-x}\) on the interval \((-1,1)\) and diverge for all other values of \(x\). So the Taylor series for a function \(f(x)\) does not need to converge for all values of \(x\) in the domain of \(f\).

Our observations suggest two natural questions: can we determine the values of \(x\) for which a given Taylor series converges? And does the Taylor series for a function \(f\) actually converge to \(f(x)\) ?

Graphical evidence suggests that the Taylor series centered at 0 for \(e^x\) converges for all values of \(x\). To verify this, use the Ratio Test to determine all values of \(x\) for which the Taylor series

\[

\sum_{k=0}^{\infty} \frac{x^k}{k !}

\]

converges absolutely.

###### Solution

Recall that the Ratio Test applies only to series of nonnegative terms. In this example, the variable \(x\) may have negative values. But we are interested in absolute convergence, so we apply the Ratio Test to the series

\[

\sum_{k=0}^{\infty}\left|\frac{x^k}{k !}\right|=\sum_{k=0}^{\infty} \frac{|x|^k}{k !} . \nonumber

\]

Now, observe that

\[

\begin{aligned}

\lim _{k \rightarrow \infty} \frac{a_{k+1}}{a_k} &=\lim _{k \rightarrow \infty} \frac{\frac{|x|^{k+1}}{(k+1) !}}{\frac{|x|^k}{k}} \\

&=\lim _{k \rightarrow \infty} \frac{|x|^{k+1} k !}{|x|^k(k+1) !} \\

&=\lim _{k \rightarrow \infty} \frac{|x|}{k+1} \\

&=0

\end{aligned} \nonumber

\]

for any value of \(x\). So the Taylor series (\(\PageIndex{4}\)) converges absolutely for every value of \(x\), and thus converges for every value of \(x\).

One question still remains: while the Taylor series for \(e^x\) converges for all \(x\), what we have done does not tell us that this Taylor series actually converges to \(e^x\) for each \(x\). We'll return to this question when we consider the error in a Taylor approximation near the end of this section.

We can apply the main idea from Example 8.5.4 in general. To determine the values of \(x\) for which a Taylor series

\[

\sum_{k=0}^{\infty} c_k(x-a)^k \nonumber

\]

centered at \(x=a\) will converge, we apply the Ratio Test with \(a_k=\left|c_k(x-a)^k\right|\). The series converges if \(\lim _{k \rightarrow \infty} \frac{a_{k+1}}{a_k}<1\).

Observe that

\[

\frac{a_{k+1}}{a_k}=|x-a| \frac{\left|c_{k+1}\right|}{\left|c_k\right|} \nonumber

\]

so when we apply the Ratio Test, we get

\[

\lim _{k \rightarrow \infty} \frac{a_{k+1}}{a_k}=\lim _{k \rightarrow \infty}|x-a| \frac{\left|c_{k+1}\right|}{\left|c_k\right|} . \nonumber

\]

Note suppose that

\[

\lim _{k \rightarrow \infty} \frac{\left|c_{k+1}\right|}{\left|c_k\right|}=L \nonumber

\]

so that

\[

\lim _{k \rightarrow \infty} \frac{a_{k+1}}{a_k}=|x-a| \cdot L . \nonumber

\]

There are three possibilities for \(L: L\) can be 0 , it can be a finite positive value, or it can be infinite. Based on this value of \(L\), we can determine for which values of \(x\) the original Taylor series converges.

- If \(L=0\), then the Taylor series converges on \((-\infty, \infty)\).
- If \(L\) is infinite, then the Taylor series converges only at \(x=a\).
- If \(L\) is finite and nonzero, then the Taylor series converges absolutely for all \(x\) that satisfy

\[|x-a| \cdot L<1 \nonumber\]

or for all \(x\) such that

\[|x-a|<\frac{1}{L},\nonumber\]

which is the interval

\[\left(a-\frac{1}{L}, a+\frac{1}{L}\right). \nonumber\]

Because the Ratio Test is inconclusive when the \(|x-a| \cdot L=1\), the endpoints \(a \pm \frac{1}{L}\) have to be checked separately.

It is important to notice that the set of \(x\) values at which a Taylor series converges is always an interval centered at \(x=a\). For this reason, the set on which a Taylor series converges is called the interval of convergence. Half the length of the interval of convergence is called the radius of convergence. If the interval of convergence of a Taylor series is infinite, then we say that the radius of convergence is infinite.

- Use the Ratio Test to explicitly determine the interval of convergence of the Taylor series for \(f(x)=\frac{1}{1-x}\) centered at \(x=0\).
- Use the Ratio Test to explicitly determine the interval of convergence of the Taylor series for \(f(x)=\cos (x)\) centered at \(x=0\).
- Use the Ratio Test to explicitly determine the interval of convergence of the Taylor series for \(f(x)=\sin (x)\) centered at \(x=0\).

The Ratio Test allows us to determine the set of \(x\) values for which a Taylor series converges absolutely. However, just because a Taylor series for a function \(f\) converges, we cannot be certain that the Taylor series actually converges to \(f(x)\). To show why and where a Taylor series does in fact converge to the function \(f\), we next consider the error that is present in Taylor polynomials.

## Error Approximations for Taylor Polynomials

We now know how to find Taylor polynomials for functions such as \(\sin (x)\), and how to determine the interval of convergence of the corresponding Taylor series. We next develop an error bound that will tell us how well an \(n\)th order Taylor polynomial \(P_n(x)\) approximates its generating function \(f(x)\). This error bound will also allow us to determine whether a Taylor series on its interval of convergence actually equals the function \(f\) from which the Taylor series is derived. Finally, we will be able to use the error bound to determine the order of the Taylor polynomial \(P_n(x)\) that we will ensure that \(P_n(x)\) approximates \(f(x)\) to the desired degree of accuracy.

For this argument, we assume throughout that we center our approximations at 0 (but a similar argument holds for approximations centered at \(a\) ). We define the exact error, \(E_n(x)\), that results from approximating \(f(x)\) with \(P_n(x)\) by

\[

E_n(x)=f(x)-P_n(x) . \nonumber

\]

We are particularly interested in \(\left|E_n(x)\right|\), the distance between \(P_n\) and \(f\).

Because

\[

P_n^{(k)}(0)=f^{(k)}(0) \nonumber

\]

for \(0 \leq k \leq n\), we know that

\[

E_n^{(k)}(0)=0 \nonumber

\]

for \(0 \leq k \leq n\). Furthermore, since \(P_n(x)\) is a polynomial of degree less than or equal to \(n\), we know that

\[

P_n^{(n+1)}(x)=0 . \nonumber

\]

Thus, since \(E_n^{(n+1)}(x)=f^{(n+1)}(x)-P_n^{(n+1)}(x)\), it follows that

\[

E_n^{(n+1)}(x)=f^{(n+1)}(x) \nonumber

\]

for all \(x\).

Suppose that we want to approximate \(f(x)\) at a number \(c\) close to 0 using \(P_n(c)\). If we assume \(\left|f^{(n+1)}(t)\right|\) is bounded by some number \(M\) on \([0, c]\), so that

\[

\left|f^{(n+1)}(t)\right| \leq M \nonumber

\]

for all \(0 \leq t \leq c\), then we can say that

\[

\left|E_n^{(n+1)}(t)\right|=\left|f^{(n+1)}(t)\right| \leq M \nonumber

\]

for all \(t\) between 0 and \(c\). Equivalently,

\[

-M \leq E_n^{(n+1)}(t) \leq M

\]

on \([0, c]\). Next, we integrate the three terms in Inequality \(\PageIndex{5}\) from \(t=0\) to \(t=x\), and thus find that

\[

\int_0^x-M d t \leq \int_0^x E_n^{(n+1)}(t) d t \leq \int_0^x M d t \nonumber

\]

for every value of \(x\) in \([0, c]\). Since \(E_n^{(n)}(0)=0\), the First FTC tells us that

\[

-M x \leq E_n^{(n)}(x) \leq M x \nonumber

\]

for every \(x\) in \([0, c]\).

Integrating this last inequality, we obtain

\[

\int_0^x-M t d t \leq \int_0^x E_n^{(n)}(t) d t \leq \int_0^x M t_{-} d t \nonumber

\]

and thus

\[

-M \frac{x^2}{2} \leq E_n^{(n-1)}(x) \leq M \frac{x^2}{2} \nonumber

\]

for all \(x\) in \([0, c]\).

Integrating \(n\) times, we arrive at

\[

-M \frac{x^{n+1}}{(n+1) !} \leq E_n(x) \leq M \frac{x^{n+1}}{(n+1) !} \nonumber

\]

for all \(x\) in \([0, c]\). This enables us to conclude that

\[

\left|E_n(x)\right| \leq M \frac{|x|^{n+1}}{(n+1) !} \nonumber

\]

for all \(x\) in \([0, c]\), and we have found a bound on the approximation's error, \(E_n\).

Our work above was based on the approximation centered at \(a=0\); the argument may be generalized to hold for any value of \(a\), which results in the following theorem.

##### \(\PageIndex{3}\): The Lagrange Error Bound

The Lagrange Error Bound for \(P_n(x)\).

Let \(f\) be a continuous function with \(n+1\) continuous derivatives. Suppose that \(M\) is a positive real number such that \(\left|f^{(n+1)}(x)\right| \leq M\) on the interval \([a, c]\). If \(P_n(x)\) is the \(n\)th order Taylor polynomial for \(f(x)\) centered at \(x=a\), then

\[

\left|P_n(c)-f(c)\right| \leq M \frac{|c-a|^{n+1}}{(n+1) !} . \nonumber

\]

We can use this error bound to tell us important information about Taylor polynomials and Taylor series, as we see in the following examples and activities.

Determine how well the 10th order Taylor polynomial \(P_{10}(x)\) for \(\sin (x)\), centered at 0 , approximates \(\sin (2)\).

###### Solution

To answer this question we use \(f(x)=\sin (x), c=2, a=0\), and \(n=10\) in the Lagrange error bound formula. We also need to find an appropriate value for \(M\). Note that the derivatives of \(f(x)=\sin (x)\) are all equal to \(\pm \sin (x)\) or \(\pm \cos (x)\). Thus,

\[

\left|f^{(n+1)}(x)\right| \leq 1 \nonumber

\]

for any \(n\) and \(x\). Therefore, we can choose \(M\) to be 1 . Then

\[

\left|P_{10}(2)-f(2)\right| \leq(1) \frac{|2-0|^{11}}{(11) !}=\frac{2^{11}}{(11) !} \approx 0.00005130671797 . \nonumber

\]

So \(P_{10}(2)\) approximates \(\sin (2)\) to within at most \(0.00005130671797\). A computer algebra system tells us that

\[

P_{10}(2) \approx 0.9093474427 \text { and } \sin (2) \approx 0.9092974268 \nonumber

\]

with an actual difference of about \(0.0000500159\).

Let \(P_n(x)\) be the \(n\)th order Taylor polynomial for \(\sin (x)\) centered at \(x=0\). Determine how large we need to choose \(n\) so that \(P_n(2)\) approximates \(\sin (2)\) to 20 decimal places.

Show that the Taylor series for \(\sin (x)\) actually converges to \(\sin (x)\) for all \(x\).

###### Solution

Recall from the previous example that since \(f(x)=\sin (x)\), we know

\[

\left|f^{(n+1)}(x)\right| \leq 1 \nonumber

\]

for any \(n\) and \(x\). This allows us to choose \(M=1\) in the Lagrange error bound formula. Thus,

\[

\left|P_n(x)-\sin (x)\right| \leq \frac{|x|^{n+1}}{(n+1) !}

\]

for every \(x\).

We showed in earlier work that the Taylor series \(\sum_{k=0}^{\infty} \frac{x^k}{k !}\) converges for every value of \(x\). Because the terms of any convergent series must approach zero, it follows that

\[

\lim _{n \rightarrow \infty} \frac{x^{n+1}}{(n+1) !}=0 \nonumber

\]

for every value of \(x\). Thus, taking the limit as \(n \rightarrow \infty\) in the inequality \(\PageIndex{6}\), it follows that

\[

\lim _{n \rightarrow \infty}\left|P_n(x)-\sin (x)\right|=0 . \nonumber

\]

As a result, we can now write

\[

\sin (x)=\sum_{n=0}^{\infty} \frac{(-1)^n x^{2 n+1}}{(2 n+1) !} \nonumber

\]

for every real number \(x\).

- Show that the Taylor series centered at 0 for \(\cos (x)\) converges to \(\cos (x)\) for every real number \(x\).
- Next we consider the Taylor series for \(e^x\).

- Show that the Taylor series centered at 0 for \(e^x\) converges to \(e^x\) for every nonnegative value of \(x\).
- Show that the Taylor series centered at 0 for \(e^x\) converges to \(e^x\) for every negative value of \(x\).
- Explain why the Taylor series centered at 0 for \(e^x\) converges to \(e^x\) for every real number \(x\). Recall that we earlier showed that the Taylor series centered at 0 for \(e^x\) converges for all \(x\), and we have now completed the argument that the Taylor series for \(e^x\) actually converges to \(e^x\) for all \(x\).

- Let \(P_n(x)\) be the \(n\)th order Taylor polynomial for \(e^x\) centered at 0 . Find a value of \(n\) so that \(P_n(5)\) approximates \(e^5\) correct to 8 decimal places.

## Summary

- We can use Taylor polynomials to approximate functions. This allows us to approximate values of functions using only addition, subtraction, multiplication, and division of real numbers. The \(n\)th order Taylor polynomial centered at \(x=a\) of a function \(f\) is

\[\begin{aligned} P_n(x) &=f(a)+f^{\prime}(a)(x-a)+\frac{f^{\prime \prime}(a)}{2 !}(x-a)^2+\cdots+\frac{f^{(n)}(a)}{n !}(x-a)^n \\&=\sum_{k=0}^n \frac{f^{(k)}(a)}{k !}(x-a)^k .\end{aligned} \nonumber \] - The Taylor series centered at \(x=a\) for a function \(f\) is

\[\sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k !}(x-a)^k .\]

The \(n\)th order Taylor polynomial centered at \(a\) for \(f\) is the \(n\)th partial sum of its Taylor series centered at \(a\). So the \(n\)th order Taylor polynomial for a function \(f\) is an approximation to \(f\) on the interval where the Taylor series converges; for the values of \(x\) for which the Taylor series converges to \(f\) we write

\[f(x)=\sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k !}(x-a)^k .\] - The Lagrange Error Bound shows us how to determine the accuracy in using a Taylor polynomial to approximate a function. More specifically, if \(P_n(x)\) is the \(n\)th order Taylor polynomial for \(f\) centered at \(x=a\) and if \(M\) is an upper bound for \(\left|f^{(n+1)}(x)\right|\) on the interval \([a, c]\), then

\[\left|P_n(c)-f(c)\right| \leq M \frac{|c-a|^{n+1}}{(n+1) !} .\]