# 9.10 Taylor Series

In Section 9.8, we showed how certain functions can be represented by a power series function. In Section 9.9, we showed how we can approximate functions with polynomials, given that enough derivative information is available. In this section we combine these concepts: if a function $f(x)$ is infinitely differentiable, we show how to represent it with a power series function.

###### Definition 9.10.1 Taylor and Maclaurin Series

Let $f(x)$ have derivatives of all orders at $x=c$.

1. (a)

The Taylor Series of $f(x)$, centered at $c$ is

 $\sum_{n=0}^{\infty}\frac{f\,^{(n)}(c)}{n!}(x-c)^{n}.$
2. (b)

Setting $c=0$ gives the Maclaurin Series of $f(x)$:

 $\sum_{n=0}^{\infty}\frac{f\,^{(n)}(0)}{n!}x^{n}.$

The difference between a Taylor polynomial and a Taylor series is the former is a polynomial, containing only a finite number of terms, whereas the latter is a series, a summation of an infinite set of terms. When creating the Taylor polynomial of degree $n$ for a function $f(x)$ at $x=c$, we needed to evaluate $f$, and the first $n$ derivatives of $f$, at $x=c$. When creating the Taylor series of $f$, we need to find a pattern that describes the $n^{\text{th}}$ derivative of $f$ at $x=c$. We demonstrate this in the next two examples.

###### Example 9.10.1 The Maclaurin series of $f(x)=\cos x$

Find the Maclaurin series of $f(x)=\cos x$.

SolutionIn Example 9.9.4 we found the $8^{\text{th}}$ degree Maclaurin polynomial of $\cos x$. In doing so, we created the table shown in Figure 9.10.1. margin: $\displaystyle f(x)$ $\displaystyle=\phantom{-}\cos x$ $\displaystyle\Rightarrow$ $\displaystyle f(0)$ $\displaystyle=\phantom{-}1$ $\displaystyle f\,^{\prime}(x)$ $\displaystyle=-\sin x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{\prime}(0)$ $\displaystyle=\phantom{-}0$ $\displaystyle f\,^{\prime\prime}(x)$ $\displaystyle=-\cos x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{\prime\prime}(0)$ $\displaystyle=-1$ $\displaystyle f\,^{\prime\prime\prime}(x)$ $\displaystyle=\phantom{-}\sin x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{\prime\prime\prime}(0)$ $\displaystyle=\phantom{-}0$ $\displaystyle f\,^{(4)}(x)$ $\displaystyle=\phantom{-}\cos x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{(4)}(0)$ $\displaystyle=\phantom{-}1$ $\displaystyle f\,^{(5)}(x)$ $\displaystyle=-\sin x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{(5)}(0)$ $\displaystyle=\phantom{-}0$ $\displaystyle f\,^{(6)}(x)$ $\displaystyle=-\cos x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{(6)}(0)$ $\displaystyle=-1$ $\displaystyle f\,^{(7)}(x)$ $\displaystyle=\phantom{-}\sin x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{(7)}(0)$ $\displaystyle=\phantom{-}0$ $\displaystyle f\,^{(8)}(x)$ $\displaystyle=\phantom{-}\cos x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{(8)}(0)$ $\displaystyle=\phantom{-}1$ $\displaystyle f\,^{(9)}(x)$ $\displaystyle=-\sin x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{(9)}(0)$ $\displaystyle=\phantom{-}0$ Figure 9.10.1: A table of the derivatives of $f(x)=\cos x$ evaluated at $x=0$. Λ Notice how $f\,^{(n)}(0)=0$ when $n$ is odd, $f\,^{(n)}(0)=1$ when $n$ is divisible by $4$, and $f\,^{(n)}(0)=-1$ when $n$ is even but not divisible by 4. Thus the Maclaurin series of $\cos x$ is

 $1-\frac{x^{2}}{2}+\frac{x^{4}}{4!}-\frac{x^{6}}{6!}+\frac{x^{8}}{8!}-\dotsb$

We can go further and write this as a summation. Since we only need the terms where the power of $x$ is even, we write the power series in terms of $x^{2n}$:

 $\sum_{n=0}^{\infty}(-1)^{n}\frac{x^{2n}}{(2n)!}.$
###### Example 9.10.2 The Taylor series of $f(x)=\ln x$ at $x=1$

Find the Taylor series of $f(x)=\ln x$ centered at $x=1$.

SolutionFigure 9.10.2 shows the $n^{\text{th}}$ derivative of $\ln x$ evaluated at $x=1$ for $n=0,\dotsc,5$, along with an expression for the $n^{\text{th}}$ term:

 $f\,^{(n)}(1)=(-1)^{n+1}(n-1)!\quad\text{for n\geq 1.}$

Remember that this is what distinguishes Taylor series from Taylor polynomials; we are very interested in finding a pattern for the $n^{\text{th}}$ term, not just finding a finite set of coefficients for a polynomial. margin: $\displaystyle f(x)$ $\displaystyle=\ln x$ $\displaystyle\Rightarrow$ $\displaystyle f(1)$ $\displaystyle=\phantom{-}0$ $\displaystyle f\,^{\prime}(x)$ $\displaystyle=\phantom{-}1/x$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{\prime}(1)$ $\displaystyle=\phantom{-}1$ $\displaystyle f\,^{\prime\prime}(x)$ $\displaystyle=-1/x^{2}$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{\prime\prime}(1)$ $\displaystyle=-1$ $\displaystyle f\,^{\prime\prime\prime}(x)$ $\displaystyle=\phantom{-}2/x^{3}$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{\prime\prime\prime}(1)$ $\displaystyle=\phantom{-}2$ $\displaystyle f\,^{(4)}(x)$ $\displaystyle=-6/x^{4}$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{(4)}(1)$ $\displaystyle=-6$ $\displaystyle f\,^{(5)}(x)$ $\displaystyle=24/x^{5}$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{(5)}(1)$ $\displaystyle=24$ $\displaystyle\ \vdots$ $\displaystyle\ \vdots$ $\displaystyle f\,^{(n)}(x)$ $\displaystyle=$ $\displaystyle\Rightarrow$ $\displaystyle f\,^{(n)}(1)$ $\displaystyle=\vskip 3.0pt plus 1.0pt minus 1.0pt$ $\dfrac{(-1)^{n+1}(n-1)!}{x^{n}}$ $(-1)^{n+1}(n-1)!$ Figure 9.10.2: Derivatives of $\ln x$ evaluated at $x=1$. Λ Since $f(1)=\ln 1=0$, we skip the first term and start the summation with $n=1$, giving the Taylor series for $\ln x$, centered at $x=1$, as

 $\sum_{n=1}^{\infty}(-1)^{n+1}(n-1)!\frac{1}{n!}(x-1)^{n}=\sum_{n=1}^{\infty}(-% 1)^{n+1}\frac{(x-1)^{n}}{n}.$

It is important to note that Definition 9.10.1 defines a Taylor series given a function $f(x)$; however, we cannot yet state that $f(x)$ is equal to its Taylor series. We will find that “most of the time” they are equal, but we need to consider the conditions that allow us to conclude this.

Theorem 9.9.1 states that the error between a function and its $n^{\text{th}}$-degree Taylor polynomial is $R_{n}(x)$, where

 $\left\lvert R_{n}(x)\right\rvert\leq\frac{\max\left\lvert\,f\,^{(n+1)}(z)% \right\rvert}{(n+1)!}\left\lvert x-c\right\rvert^{n+1}.$

If $R_{n}(x)$ goes to 0 for each $x$ in an interval $I$ as $n$ approaches infinity, we conclude that the function is equal to its Taylor series expansion.

###### Theorem 9.10.1 Function and Taylor Series Equality

Let $f(x)$ have derivatives of all orders at $x=c$, let $R_{n}(x)$ be as stated in Theorem 9.9.1, and let $I$ be an interval on which the Taylor series of $f(x)$ converges. If $\displaystyle\lim_{n\to\infty}R_{n}(x)=0$ for all $x$ in $I$, then

 $f(x)=\sum_{n=0}^{\infty}\frac{f\,^{(n)}(c)}{n!}(x-c)^{n}\ \text{ on I.}$

We demonstrate the use of this theorem in an example.

###### Example 9.10.3 Establishing equality of a function and its Taylor series

Show that, for all $x$, $f(x)=\cos x$ is equal to its Maclaurin series as found in Example 9.10.1.

SolutionGiven a value $x$, the magnitude of the error term $R_{n}(x)$ is bounded by

 $\left\lvert R_{n}(x)\right\rvert\leq\frac{\max\left\lvert\,f\,^{(n+1)}(z)% \right\rvert}{(n+1)!}\left\lvert x\right\rvert^{n+1}.$

Since all derivatives of $\cos x$ are $\pm\sin x$ or $\pm\cos x$, whose magnitudes are bounded by $1$, we can state

 $\left\lvert R_{n}(x)\right\rvert\leq\frac{1}{(n+1)!}\left\lvert x\right\rvert^% {n+1}$

which implies

 $-\frac{\left\lvert x\right\rvert^{n+1}}{(n+1)!}\leq R_{n}(x)\leq\frac{\left% \lvert x\right\rvert^{n+1}}{(n+1)!}.$

For any $x$, $\displaystyle\lim_{n\to\infty}\frac{x^{n+1}}{(n+1)!}=0$. Applying the Squeeze Theorem to our last inequality, we conclude that $\displaystyle\lim_{n\to\infty}R_{n}(x)=0$ for all $x$, and hence

 $\cos x=\sum_{n=0}^{\infty}(-1)^{n}\frac{x^{2n}}{(2n)!}\quad\text{for all x}.$

It is natural to assume that a function is equal to its Taylor series on the series’ interval of convergence, but this is not the case. In order to properly establish equality, one must use Theorem 9.10.1. This is a bit disappointing, as we developed beautiful techniques for determining the interval of convergence of a power series, and proving that $R_{n}(x)\to 0$ can be cumbersome as it deals with high order derivatives of the function.

There is good news. A function $f(x)$ that is equal to its Taylor series, centered at any point the domain of $f(x)$, is said to be an analytic function, and most, if not all, functions that we encounter within this course are analytic functions. Generally speaking, any function that one creates with elementary functions (polynomials, exponentials, trigonometric functions, etc.) that is not piecewise defined is probably analytic. For most functions, we assume the function is equal to its Taylor series on the series’ interval of convergence and only use Theorem 9.10.1 when we suspect something may not work as expected. The converse is also true: if a function is equal to some power series on an interval, then that power series is the Taylor series of the function.

We develop the Taylor series for one more important function, then give a table of the Taylor series for a number of common functions.

###### Example 9.10.4 The Binomial Series

Find the Maclaurin series of $f(x)=(1+x)^{k}$, $k\neq 0$.

SolutionWhen $k$ is a positive integer, the Maclaurin series is finite. For instance, when $k=4$, we have

 $f(x)=(1+x)^{4}=1+4x+6x^{2}+4x^{3}+x^{4}.$

The coefficients of $x$ when $k$ is a positive integer are known as the binomial coefficients, giving the series we are developing its name.

When $k=1/2$, we have $f(x)=\sqrt{1+x}$. Knowing a series representation of this function would give a useful way of approximating $\sqrt{1.3}$, for instance.

To develop the Maclaurin series for $f(x)=(1+x)^{k}$ for any value of $k\neq 0$, we consider the derivatives of $f$ evaluated at $x=0$:

 $\displaystyle f(x)$ $\displaystyle=(1+x)^{k}$ $\displaystyle f(0)$ $\displaystyle=1$ $\displaystyle f\,^{\prime}(x)$ $\displaystyle=k(1+x)^{k-1}$ $\displaystyle f\,^{\prime}(0)$ $\displaystyle=k$ $\displaystyle f\,^{\prime\prime}(x)$ $\displaystyle=k(k-1)(1+x)^{k-2}$ $\displaystyle f\,^{\prime\prime}(0)$ $\displaystyle=k(k-1)$ $\displaystyle f\,^{\prime\prime\prime}(x)$ $\displaystyle=k(k-1)(k-2)(1+x)^{k-3}$ $\displaystyle f\,^{\prime\prime\prime}(0)$ $\displaystyle=k(k-1)(k-2)$ $\displaystyle\vdots$ $\displaystyle\vdots$ $\displaystyle f\,^{(n)}(x)$ $\displaystyle=k(k-1)\dotsm\bigl{(}k-(n-1)\bigr{)}(1+x)^{k-n}\mkern-15.0mu$ $\displaystyle\vdots$ $\displaystyle f\,^{(n)}(0)$ $\displaystyle=k(k-1)\dotsm\bigl{(}k-(n-1)\bigr{)}$

Thus the Maclaurin series for $f(x)=(1+x)^{k}$ is

 $1+kx+\frac{k(k-1)}{2!}x^{2}+\frac{k(k-1)(k-2)}{3!}x^{3}+\dotsb+\frac{k(k-1)% \dotsm\bigl{(}k-(n-1)\bigr{)}}{n!}x^{n}+\dotsb$

It is important to determine the interval of convergence of this series. With

 $a_{n}=\frac{k(k-1)\dotsm\bigl{(}k-(n-1)\bigr{)}}{n!}x^{n},$

we apply the Ratio Test:

 $\displaystyle\lim_{n\to\infty}\frac{\left\lvert a_{n+1}\right\rvert}{\left% \lvert a_{n}\right\rvert}$ $\displaystyle=\lim_{n\to\infty}\frac{\left\lvert\frac{k(k-1)\dotsm(k-n)}{(n+1)% !}x^{n+1}\right\rvert}{\left\lvert\frac{k(k-1)\dotsm\bigl{(}k-(n-1)\bigr{)}}{n% !}x^{n}\right\rvert}$ $\displaystyle=\lim_{n\to\infty}\left\lvert\frac{k-n}{n+1}x\right\rvert$ $\displaystyle=\left\lvert x\right\rvert.$

The series converges absolutely when the limit of the Ratio Test is less than 1; therefore, we have absolute convergence when $\left\lvert x\right\rvert<1$.

While outside the scope of this text, the interval of convergence depends on the value of $k$. When $k>0$, the interval of convergence is $[-1,1]$. When $-1, the interval of convergence is $(-1,1]$. If $k\leq-1$, the interval of convergence is $(-1,1)$.

We learned that Taylor polynomials offer a way of approximating a “difficult to compute” function with a polynomial. Taylor series offer a way of exactly representing a function with a series. One probably can see the use of a good approximation; is there any use of representing a function exactly as a series?

While we appreciate the mathematical beauty of Taylor series (which is reason enough to study them), there are practical uses as well. They provide a valuable tool for solving a variety of problems, including problems relating to integration and differential equations.

In Key Idea 9.10.1 (on the following page) we give a table of the Maclaurin series of a number of common functions. We then give a theorem about the “algebra of power series,” that is, how we can combine power series to create power series of new functions. This allows us to find the Taylor series of functions like $f(x)=e^{x}\cos x$ by knowing the Taylor series of $e^{x}$ and $\cos x$.

Before we investigate combining functions, consider the Taylor series for the arctangent function (see Key Idea 9.10.1). Knowing that $\tan^{-1}(1)=\pi/4$, we can use this series to approximate the value of $\pi$:

 $\displaystyle\frac{\pi}{4}$ $\displaystyle=\tan^{-1}(1)=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}-\dotsb$ $\displaystyle\pi$ $\displaystyle=4\left(1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}-\dotsb\right)$

Unfortunately, this particular expansion of $\pi$ converges very slowly. The first 100 terms approximate $\pi$ as $3.13159$, which is not particularly good.

###### Key Idea 9.10.1 Important Maclaurin Series Expansions
 Function and Series First Few Terms Interval of Convergence $\displaystyle e^{x}=\sum_{n=0}^{\infty}\frac{x^{n}}{n!}$ $\displaystyle 1+x+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+\dotsb$ $(-\infty,\infty)$ $\displaystyle\sin x=\sum_{n=0}^{\infty}(-1)^{n}\frac{x^{2n+1}}{(2n+1)!}$ $\displaystyle x-\frac{x^{3}}{3!}+\frac{x^{5}}{5!}-\frac{x^{7}}{7!}+\dotsb$ $(-\infty,\infty)$ $\displaystyle\cos x=\sum_{n=0}^{\infty}(-1)^{n}\frac{x^{2n}}{(2n)!}$ $\displaystyle 1-\frac{x^{2}}{2!}+\frac{x^{4}}{4!}-\frac{x^{6}}{6!}+\dotsb$ $(-\infty,\infty)$ $\displaystyle\ln(x+1)=\sum_{n=1}^{\infty}(-1)^{n+1}\frac{x^{n}}{n}$ $\displaystyle x-\frac{x^{2}}{2}+\frac{x^{3}}{3}-\dotsb$ $(-1,1]$ $\displaystyle\frac{1}{1-x}=\sum_{n=0}^{\infty}x^{n}$ $\displaystyle 1+x+x^{2}+x^{3}+\dotsb$ $(-1,1)$ $\displaystyle(1+x)^{k}=\sum_{n=0}^{\infty}\frac{k(k-1)\dotsm\bigl{(}k-(n-1)% \bigr{)}}{n!}x^{n}$ $\displaystyle 1+kx+\frac{k(k-1)}{2!}x^{2}+\dotsb$ $\begin{cases}(-1,1)&\phantom{-}k\leq-1\\ {}(-1,1]&-1 $\displaystyle\tan^{-1}x=\sum_{n=0}^{\infty}(-1)^{n}\frac{x^{2n+1}}{2n+1}$ $\displaystyle x-\frac{x^{3}}{3}+\frac{x^{5}}{5}-\frac{x^{7}}{7}+\dotsb$ $[-1,1]$
###### Theorem 9.10.2 Algebra of Power Series

Let $\displaystyle f(x)=\sum_{n=0}^{\infty}a_{n}x^{n}$ and $\displaystyle g(x)=\sum_{n=0}^{\infty}b_{n}x^{n}$ converge absolutely for $\left\lvert x\right\rvert, and let $h(x)$ be continuous.

1. (a)

$\displaystyle f(x)\pm g(x)=\sum_{n=0}^{\infty}(a_{n}\pm b_{n})x^{n}$  for $\left\lvert x\right\rvert.

2. (b)

$\displaystyle f(x)g(x)=\left(\sum_{n=0}^{\infty}a_{n}x^{n}\right)\left(\sum_{n% =0}^{\infty}b_{n}x^{n}\right)=\\ \mbox{}\qquad\sum_{n=0}^{\infty}\bigl{(}a_{0}b_{n}+a_{1}b_{n-1}+\dotsb+a_{n}b_% {0}\bigr{)}x^{n}$ for $\left\lvert x\right\rvert.

3. (c)

$\displaystyle f\bigl{(}h(x)\bigr{)}=\sum_{n=0}^{\infty}a_{n}\bigl{(}h(x)\bigr{% )}^{n}$  for $\left\lvert h(x)\right\rvert.

###### Example 9.10.5 Combining Taylor series

Write out the first 3 terms of the Maclaurin Series for $f(x)=e^{x}\cos x$ using Key Idea 9.10.1 and Theorem 9.10.2.

SolutionKey Idea 9.10.1 informs us that

 $e^{x}=1+x+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+\dotsb\qquad\text{and}\qquad\cos x% =1-\frac{x^{2}}{2!}+\frac{x^{4}}{4!}+\dotsb.$

Applying Theorem 9.10.2, we find that

 $\displaystyle e^{x}\cos x$ $\displaystyle=\left(1+x+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+\dotsb\right)\left(1% -\frac{x^{2}}{2!}+\frac{x^{4}}{4!}+\dotsb\right).$ Distribute the right hand expression across the left: $\displaystyle=1\left(1-\frac{x^{2}}{2!}+\frac{x^{4}}{4!}+\dotsb\right)+x\left(% 1-\frac{x^{2}}{2!}+\frac{x^{4}}{4!}+\dotsb\right)$ $\displaystyle\phantom{=}+\frac{x^{2}}{2!}\left(1-\frac{x^{2}}{2!}+\frac{x^{4}}% {4!}+\dotsb\right)+\frac{x^{3}}{3!}\left(1-\frac{x^{2}}{2!}+\frac{x^{4}}{4!}+% \dotsb\right)$ $\displaystyle\phantom{=}+\frac{x^{4}}{4!}\left(1-\frac{x^{2}}{2!}+\frac{x^{4}}% {4!}+\dotsb\right)+\dotsb$ Distribute again and collect like terms. $\displaystyle=1+x-\frac{x^{3}}{3}-\frac{x^{4}}{6}-\frac{x^{5}}{30}+\frac{x^{7}% }{630}+\dotsb$

While this process is a bit tedious, it is much faster than evaluating all the necessary derivatives of $e^{x}\cos x$ and computing the Taylor series directly.

Because the series for $e^{x}$ and $\cos x$ both converge on $(-\infty,\infty)$, so does the series expansion for $e^{x}\cos x$.

###### Example 9.10.6 Creating new Taylor series

Use Theorem 9.10.2 to create the Taylor series for $y=\sin(x^{2})$ centered at $x=0$ and a series for $y=\ln(\sqrt{x})$ centered at $c=1$. Given that

 $\sin x=\sum_{n=0}^{\infty}(-1)^{n}\frac{x^{2n+1}}{(2n+1)!}=x-\frac{x^{3}}{3!}+% \frac{x^{5}}{5!}-\frac{x^{7}}{7!}+\dotsb,$

we simply substitute $x^{2}$ for $x$ in the series, giving

 $\sin(x^{2})=\sum_{n=0}^{\infty}(-1)^{n}\frac{(x^{2})^{2n+1}}{(2n+1)!}=\sum_{n=% 0}^{\infty}(-1)^{n}\frac{x^{4n+2}}{(2n+1)!}=x^{2}-\frac{x^{6}}{3!}+\frac{x^{10% }}{5!}-\frac{x^{14}}{7!}\dotsb.$

Since the Taylor series for $\sin x$ has an infinite radius of convergence, so does the Taylor series for $\sin(x^{2})$.

The Taylor expansion for $\ln x$ given in Key Idea 9.10.1 is centered at $x=1$, so we will center the series for $\ln(\sqrt{x})$ at $x=1$ as well. With

 $\ln x=\sum_{n=1}^{\infty}(-1)^{n+1}\frac{(x-1)^{n}}{n}=(x-1)-\frac{(x-1)^{2}}{% 2}+\frac{(x-1)^{3}}{3}-\dotsb,$
margin: Note: In Example 9.10.6, one could create a series for $\ln(\sqrt{x})$ by simply recognizing that $\ln(\sqrt{x})=\ln(x^{1/2})=1/2\ln x$, and hence multiplying the Taylor series for $\ln x$ by $1/2$. This example was chosen to demonstrate other aspects of series, such as the fact that the interval of convergence changes. Λ

we substitute $\sqrt{x}$ for $x$ to obtain

 $\ln(\sqrt{x})=\sum_{n=1}^{\infty}(-1)^{n+1}\frac{(\sqrt{x}-1)^{n}}{n}=(\sqrt{x% }-1)-\frac{(\sqrt{x}-1)^{2}}{2}+\frac{(\sqrt{x}-1)^{3}}{3}-\dotsb.$

While this is not strictly a power series because of the $\sqrt{x}$, it is a series that allows us to study the function $\ln(\sqrt{x})$. Since the interval of convergence of $\ln x$ is $(0,2]$, and the range of $\sqrt{x}$ on $(0,4]$ is $(0,2]$, the interval of convergence of this series expansion of $\ln(\sqrt{x})$ is $(0,4]$.

###### Example 9.10.7 Using Taylor series to evaluate definite integrals

Use the Taylor series of $e^{-x^{2}}$ to evaluate $\displaystyle\int_{0}^{1}e^{-x^{2}}\operatorname{d}\!x$.

SolutionWe learned, when studying Numerical Integration, that $e^{-x^{2}}$ does not have an antiderivative expressible in terms of elementary functions. This means any definite integral of this function must have its value approximated, and not computed exactly.

We can quickly write out the Taylor series for $e^{-x^{2}}$ using the Taylor series of $e^{x}$:

 $\displaystyle e^{x}$ $\displaystyle=\sum_{n=0}^{\infty}\frac{x^{n}}{n!}=1+x+\frac{x^{2}}{2!}+\frac{x% ^{3}}{3!}+\dotsb$ and so $\displaystyle e^{-x^{2}}$ $\displaystyle=\sum_{n=0}^{\infty}\frac{(-x^{2})^{n}}{n!}$ $\displaystyle=\sum_{n=0}^{\infty}(-1)^{n}\frac{x^{2n}}{n!}$ $\displaystyle=1-x^{2}+\frac{x^{4}}{2!}-\frac{x^{6}}{3!}+\dotsb.$

We use Theorem 9.8.3 to integrate:

 $\int e^{-x^{2}}\operatorname{d}\!x=C+x-\frac{x^{3}}{3}+\frac{x^{5}}{5\cdot 2!}% -\frac{x^{7}}{7\cdot 3!}+\dotsb+(-1)^{n}\frac{x^{2n+1}}{(2n+1)n!}+\dotsb$

This is the antiderivative of $e^{-x^{2}}$; while we can write it out as a series, we cannot write it out in terms of elementary functions. We can evaluate the definite integral $\displaystyle\int_{0}^{1}e^{-x^{2}}\operatorname{d}\!x$ using this antiderivative; substituting 1 and 0 for $x$ and subtracting gives

 $\int_{0}^{1}e^{-x^{2}}\operatorname{d}\!x=1-\frac{1}{3}+\frac{1}{5\cdot 2!}-% \frac{1}{7\cdot 3!}+\frac{1}{9\cdot 4!}-\dotsb.$

Summing the 5 terms shown above gives the approximation of $0.74749.$ Since this is an alternating series, we can use the Alternating Series Approximation Theorem, (Theorem 9.5.3), to determine how accurate this approximation is. The next term of the series is $1/(11\cdot 5!)\approx 0.00075758$. Thus we know our approximation is within $0.00075758$ of the actual value of the integral. This is arguably much less work than using Simpson’s Rule to approximate the value of the integral.

Another advantage to using Taylor series instead of Simpson’s Rule is for making subsequent approximations. We found in Example 8.7.7 that the error in using Simpson’s Rule for $\displaystyle\int_{0}^{1}e^{-x^{2}}\operatorname{d}\!x$ with four intervals was $0.00026$. If we wanted to decrease that error, we would need to use more intervals, essentially starting the problem over. Using a Taylor series, if we wanted a more accurate approximation, we can just subtract the next term $1/(11\cdot 5!)$ to get an approximation of $0.7467$, with an error of at most $1/(13\cdot 6!)\approx 0.0001$.

Finding a pattern in the coefficients that match the series expansion of a known function, such as those shown in Key Idea 9.10.1, can be difficult. What if the coefficients are given in their reduced form; how could we still recover the function?

Suppose that all we know is that

 $a_{0}=1,\quad a_{1}=2,\quad a_{2}=2,\quad a_{3}=\frac{4}{3},\quad a_{4}=\frac{% 2}{3}.$

Definition 9.10.1 states that each term of the Taylor expansion of a function includes an $n!$. This allows us to say that

 $a_{2}=2=\frac{b_{2}}{2!},\quad a_{3}=\frac{4}{3}=\frac{b_{3}}{3!},\quad\text{% and}\quad a_{4}=\frac{2}{3}=\frac{b_{4}}{4!}$

for some values $b_{2}$, $b_{3}$ and $b_{4}$. Solving for these values, we see that $b_{2}=4$, $b_{3}=8$ and $b_{4}=16$. That is, we are recovering the pattern $b_{n}=2^{n}$, allowing us to write

 $\displaystyle f(x)=\sum_{n=0}^{\infty}a_{n}x^{n}$ $\displaystyle=\sum_{n=0}^{\infty}\frac{b_{n}}{n!}x^{n}$ $\displaystyle=1+2x+\frac{4}{2!}x^{2}+\frac{8}{3!}x^{3}+\frac{16}{4!}x^{4}+\dotsb$

From here it is easier to recognize that the series is describing an exponential function.

This chapter introduced sequences, which are ordered lists of numbers, followed by series, wherein we add up the terms of a sequence. We quickly saw that such sums do not always add up to “infinity,” but rather converge. We studied tests for convergence, then ended the chapter with a formal way of defining functions based on series. Such “series-defined functions” are a valuable tool in solving a number of different problems throughout science and engineering.

Coming in the next chapters are new ways of defining curves in the plane apart from using functions of the form $y=f(x)$. Curves created by these new methods can be beautiful, useful, and important.

## Exercises 9.10

### Terms and Concepts

1. 1.

What is the difference between a Taylor polynomial and a Taylor series?

2. 2.

What theorem must we use to show that a function is equal to its Taylor series?

### Problems

Key Idea 9.10.1 gives the $n^{\text{th}}$ term of the Taylor series of common functions. In Exercises 3–6., verify the formula given in the Key Idea by finding the first few terms of the Taylor series of the given function and identifying a pattern.

1. 3.

$f(x)=e^{x}$; $c=0$

2. 4.

$f(x)=\sin x$; $c=0$

3. 5.

$f(x)=1/(1-x)$; $c=0$

4. 6.

$f(x)=\tan^{-1}x$; $c=0$

In Exercises 7–12., find a formula for the $n^{\text{th}}$ term of the Taylor series of $f(x)$, centered at $c$, by finding the coefficients of the first few powers of $x$ and looking for a pattern. (The formulas for several of these are found in Key Idea 9.10.1; show work verifying these formula.)

1. 7.

$f(x)=\cos x$; $c=\pi/2$

2. 8.

$f(x)=1/x$; $c=1$

3. 9.

$f(x)=e^{-x}$; $c=0$

4. 10.

$f(x)=\ln(1+x)$; $c=0$

5. 11.

$f(x)=x/(x+1)$; $c=1$

6. 12.

$f(x)=\sin x$; $c=\pi/4$

In Exercises 13–16., show that the Taylor series for $f(x)$, as given in Key Idea 9.10.1, is equal to $f(x)$ by applying Theorem 9.10.1; that is, show $\displaystyle\lim_{n\to\infty}R_{n}(x)=0$.

1. 13.

$f(x)=e^{x}$

2. 14.

$f(x)=\sin x$

3. 15.

$f(x)=\ln(x+1)$ (show equality only on $(0,1)$).

4. 16.

$f(x)=1/(1-x)$ (show equality only on $(-1,0)$)

In Exercises 17–20., use the Taylor series given in Key Idea 9.10.1 to verify the given identity.

1. 17.

$\cos(-x)=\cos x$

2. 18.

$\sin(-x)=-\sin x$

3. 19.

$\frac{\operatorname{d}\!}{\operatorname{d}\!x}\big{(}\sin x\big{)}=\cos x$

4. 20.

$\frac{\operatorname{d}\!}{\operatorname{d}\!x}\big{(}\cos x\big{)}=-\sin x$

In Exercises 21–24., write out the first 5 terms of the Binomial series with the given $k$-value.

1. 21.

$k=1/2$

2. 22.

$k=-1/2$

3. 23.

$k=1/3$

4. 24.

$k=4$

In Exercises 25–30., use the Taylor series given in Key Idea 9.10.1 to create the Taylor series of the given functions.

1. 25.

$f(x)=\cos\bigl{(}x^{2}\bigr{)}$

2. 26.

$f(x)=e^{-x}$

3. 27.

$f(x)=\sin\bigl{(}2x+3\bigr{)}$

4. 28.

$f(x)=\tan^{-1}\bigl{(}x/2\bigr{)}$

5. 29.

$f(x)=e^{x}\sin x$ (only find the first non-zero 4 terms)

6. 30.

$f(x)=(1+x)^{1/2}\cos x$ (only find the first non-zero 4 terms)

In Exercises 31–32., approximate the value of the given definite integral by using the first 4 nonzero terms of the integrand’s Taylor series.

1. 31.

$\displaystyle\int_{0}^{\sqrt{\pi}}\sin\bigl{(}x^{2}\bigr{)}\operatorname{d}\!x$

2. 32.

$\displaystyle\int_{0}^{\pi^{2}/4}\cos\bigl{(}\sqrt{x}\bigr{)}\operatorname{d}\!x$