# Active Calculus

## Section8.4Taylor Series

In Activity 8.3.4, we investigated several Taylor polynomials centered at $$0$$ for the function $$f(x) = \frac{1}{1-x}$$ and found that
\begin{equation*} T_n(x) = 1 + x + x^2 + x^3 + \cdots + x^n\text{.} \end{equation*}
Moreover, we saw that it is natural to extend the degree $$n$$ Taylor polynomial to an infinite Taylor series 1 ; for $$f(x) = \frac{1}{1-x}\text{,}$$ the corresponding Taylor series is
\begin{equation*} T(x) = 1 + x + x^2 + x^3 + \cdots x^n + \cdots\text{.} \end{equation*}
Because $$T(x)$$ is an infinite geometric series with $$a = 1$$ and $$r = x\text{,}$$ whenever $$|r| = |x| \lt 1\text{,}$$ the series converges and by Equation (8.3.12) its sum is
$$T(x) = 1 + x + x^2 + x^3 + \cdots x^n + \cdots = \frac{1}{1-x} = f(x)\text{.}\tag{8.4.1}$$
Remarkably, this shows that the original function, $$f(x) = \frac{1}{1-x}\text{,}$$ is equal to its Taylor series for all values of $$x$$ that satisfy $$|x| \lt 1\text{.}$$ So, not only do Taylor polynomials provide increasingly better approximations to a function as the degree $$n$$ increases, but it appears that if we let $$n$$ increase without bound we arrive at a new representation of the original function through its Taylor series 2 .
In Preview Activity 8.4.1, we consider an infinite geometric series and explore the function to which the series is related and that function's Taylor polynomials.

### Preview Activity8.4.1.

Let
\begin{equation*} T(x) = 3 - x + \frac13x^2 - \frac19x^3 + \cdots + 3\left(-\frac13\right)^n x^n + \cdots \text{.} \end{equation*}

#### (a)

Show that $$T(x)$$ is a geometric series by identifying the values of $$a$$ and $$r\text{.}$$
$$a={}$$ and $$r={}$$

#### (b)

Use the formula for the sum of an infinite geometric series to find a single fraction that represents the value of $$T(x)\text{.}$$
For which values of $$x$$ is this representation valid?
Use interval notation.

#### (c)

Consider the function $$f(x) = 9(3 + x)^{-1}$$ and fill out the table below.
 $$f(x) = 9 (3 + x)^{-1}$$ $$f(0) = {}$$ $$f'(x) = {}$$ $$f'(0) = {}$$ $$f''(x) = {}$$ $$f''(0) = {}$$ $$f'''(x) = {}$$ $$f'''(0) = {}$$
Use your answers to calculate the degree $$3$$ Taylor polynomial centered at $$0$$ for $$f(x)\text{.}$$

#### (d)

How is your work in part (c) connected to the original given series $$T(x)\text{?}$$
• It's the same.
• The Taylor polynomials of $$f(x)$$ are partial sums of the original infinite geometric series.
• No relation.

### Subsection8.4.1Taylor series and the Ratio Test

From our work in Activity 8.3.4 and Preview Activity 8.4.1, we have seen two examples where the Taylor polynomials of a given function lead to a corresponding infinite Taylor series that is actually equal to the original function itself. This suggests that Taylor series are important because they give rise to a polynomial-like representation of a non-polynomial function. We are now ready to formally define the Taylor series of a function and then introduce a tool for determining where the Taylor series converges.

#### Definition8.4.1.

Let $$f$$ be a function such that $$f^{(n)}(a)$$ exists for every natural number $$n\text{.}$$ The Taylor series for $$f$$ centered at $$x=a$$ is the series $$T_f(x)$$ defined by
\begin{align*} T_f(x) =\mathstrut \amp \sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k!}(x-a)^k\\ =\mathstrut \amp f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots + \frac{f^{(n)}(a)}{n!}(x-a)^n + \cdots\text{.} \end{align*}
In the special case where $$a=0$$ in Definition 8.4.1, the Taylor series is also sometimes called the Maclaurin series for $$f\text{.}$$
From Activity 8.3.4 we know the $$n$$th order Taylor polynomial centered at $$0$$ for the function $$f(x) = \frac{1}{1-x}$$ is
\begin{equation*} T_n(x) = 1 + x + x^2 + \cdots + x^n\text{,} \end{equation*}
and thus the Maclaurin series for $$f(x) = \frac{1}{1-x}$$ is
\begin{equation*} T_f(x) = \sum_{k=0}^{\infty} x^k\text{.} \end{equation*}
As we noted earlier in Equation (8.4.1), because this particular series is geometric (with common ratio $$r = x$$), we are able to easily find a shortcut formula for its value and understand the values of $$x$$ for which the infinite sum makes sense. In particular, for $$|x| \lt 1\text{,}$$
\begin{equation*} T_f(x) = \sum_{k=0}^{\infty} x^k = \frac{1}{1-x} \text{,} \end{equation*}
which shows that the Taylor series is equal to the original function $$f(x)$$ for this set of $$x$$ values.
It turns out that while most Taylor series are not geometric series, we can compare any Taylor series to a geometric series in order to determine an interval of $$x$$-values for which the Taylor series converges. To see how we approach this issue, we consider a particular function for which we know its Taylor polynomials and determine the $$x$$-values for which its Taylor series should converge.
We let $$f(x) = \ln(1+x)$$ and work to determine whether or not the Taylor series is geometric in order to investigate the $$x$$-values for which the series appears to converge. In Example 8.2.6, we found that the general degree $$n$$ Taylor polynomial centered at $$a = 0$$ for $$f(x) = \ln(1+x)$$ is
\begin{equation*} T_n(x) = x - \frac{1}{2}x^2 + \frac{1}{3}x^3 - \cdots + (-1)^{n-1}\frac{1}{n}x^n\text{.} \end{equation*}
This pattern thus allows us to see that the Taylor series for $$f(x)\text{,}$$ centered at $$a = 0\text{,}$$ is
\begin{align*} T_f(x) =\mathstrut \amp \sum_{k=1}^{\infty} (-1)^{k-1}\frac{1}{k}x^k\\ =\mathstrut \amp x - \frac{1}{2}x^2 + \frac{1}{3}x^3 - \cdots + (-1)^{n-1}\frac{1}{n}x^n + \cdots\text{.} \end{align*}
Unlike the Taylor series for the function $$\frac{1}{1-x}\text{,}$$ the Taylor series for $$f(x) = \ln(1+x)$$ turns out to not be geometric, so we introduce some new ideas to think about the $$x$$-values for which we expect the series to converge.
For a series to be geometric, it must have a constant ratio between the terms. In $$T_f(x)\text{,}$$ the general $$n$$th term is
\begin{equation*} a_n(x) = (-1)^{n-1}\frac{1}{n}x^n \end{equation*}
so the $$(n+1)$$st term is
\begin{equation*} a_{n+1}(x) = (-1)^{n}\frac{1}{n+1}x^{n+1} \text{.} \end{equation*}
If we consider the ratio of these consecutive terms and call that quantity $$r_n(x)\text{,}$$ we find that
\begin{equation*} r_n(x) = \frac{a_{n+1}(x)}{a_n(x)} = \frac{(-1)^{n}\frac{1}{n+1}x^{n+1}}{(-1)^{n-1}\frac{1}{n}x^n}\text{.} \end{equation*}
We can rewrite this fraction algebraically and simplify it considerably. Grouping the similar terms between the numerator and denominator, we see
\begin{equation*} r_n(x) = \frac{(-1)^{n}}{(-1)^{n-1}} \cdot \frac{n}{n+1} \cdot \frac{x^{n+1}}{x^n}\text{,} \end{equation*}
which allows us to simplify and conclude that
\begin{equation*} r_n(x) = (-1) \cdot \frac{n}{n+1} \cdot x\text{.} \end{equation*}
This tells us the series $$T_f(x)$$ is not geometric since the ratio of consecutive terms depends on $$n\text{.}$$ For example, if we take $$n = 2\text{,}$$ we have
\begin{equation*} r_2(x) = -\frac{2}{3}x\text{,} \end{equation*}
which is the ratio between the third and second terms of $$T_f(x)\text{,}$$ while
\begin{equation*} r_3(x) = -\frac{3}{4}x \end{equation*}
is the ratio between the fourth and third terms. Since the ratio $$r_n(x)$$ depends on $$n\text{,}$$ the series lacks a common ratio between terms.
However, as $$n$$ gets large, the series $$T_f(x)$$ is almost geometric. This is because the quantity $$\frac{n}{n+1}$$ approaches $$1$$ as $$n$$ increases without bound, and therefore for large $$n\text{,}$$
\begin{equation*} r_n(x) \approx -x\text{.} \end{equation*}
This suggests that the series $$T_f(x)$$ converges for $$|r_n(x)| \approx |-x| = |x| \lt 1\text{,}$$ since the series is very close to being geometric with a common ratio $$-x\text{.}$$ Graphical evidence supports the conclusion that for $$|x| \lt 1\text{,}$$ the series $$T_f(x)$$ converges in the same way that a geometric one would, and also that the interval of convervence is $$-1 \lt x \lt 1\text{.}$$ In Figure 8.4.2, we plot $$f(x) = \ln(1+x)\text{,}$$ $$T_{10}(x) = x - \frac{1}{2}x^2 + \cdots - \frac{1}{10}x^{10}\text{,}$$ and $$T_{20}(x) = x - \frac{1}{2}x^2 + \cdots - \frac{1}{20}x^{20}\text{.}$$
In Figure 8.4.2 we see that on the interval $$-0.8 \lt x \lt 0.8\text{,}$$ $$f(x)\text{,}$$ $$T_{10}(x)\text{,}$$ and $$T_{20}(x)$$ are nearly indistinguishable. Furthermore, we see that if we widen the interval to $$-0.9 \lt x \lt 0.9\text{,}$$ $$T_{20}(x)$$ remains a very good approximation of $$f(x)\text{.}$$ For example, we can do some computations and find that
\begin{equation*} f(-0.8) - T_{10}(-0.8) \approx -0.030563, f(-0.8) - T_{20}(-0.8) \approx -0.001091\text{,} \end{equation*}
and
\begin{equation*} f(-0.9) - T_{10}(-0.9) \approx -0.183837, f(-0.9) - T_{20}(-0.9) \approx -0.032564 \text{.} \end{equation*}
Increasing the degree of the approximation further allows us to do a bit better, but since $$f(x) = \ln(1+x)$$ is undefined with a vertical asymptote at $$x = -1\text{,}$$ no polynomial function can agree with $$f(x)$$ at $$x = -1\text{.}$$ Thus, it appears to be the case that $$T_f(x)$$ converges for $$x$$-values that satisfy $$-1 \lt x \lt 1\text{,}$$ and on that interval the Taylor series converges to $$f(x) = \ln(1+x)\text{.}$$
From our most recent work, we see a striking result: it appears that for $$x$$-values where the Taylor series $$T_f(x)$$ of $$f(x) = \ln(1+x)$$ converges to a finite value, the Taylor series actually equals the function $$f\text{.}$$ Said differently, it appears that
\begin{equation*} \ln(1+x) = x - \frac{1}{2}x^2 + \frac{1}{3}x^3 - \cdots + (-1)^{n-1}\frac{1}{n}x^n + \cdots \end{equation*}
for $$x$$-values that satisfy $$-1 \lt x \lt 1\text{.}$$ This result is analogous to Equation (8.4.1), but is different in the sense that the Taylor series for $$\ln(1+x)$$ is not geometric. We next introduce a more formal way to test “how geometric” a Taylor series is in an effort to understand where the Taylor series is guaranteed to converge.

#### The Ratio Test.

Consider an infinite series of the form $$T(x) = \sum_{k=0}^{\infty} c_k (x-a)^k\text{,}$$ where $$a$$ is any real number. Let $$r_n(x) = \frac{c_{n+1} (x-a)^{n+1}}{c_n (x-a)^n}$$ and
\begin{equation*} r(x) = \lim_{n \to \infty} r_n(x) = \lim_{n \to \infty} \frac{c_{n+1} (x-a)^{n+1}}{c_n (x-a)^n}\text{.} \end{equation*}
Then,
• for any real number $$x$$ such that $$|r(x)| \lt 1\text{,}$$ the series $$T(x)$$ converges;
• for any real number $$x$$ such that $$|r(x)| \gt 1\text{,}$$ the series $$T(x)$$ does not converge;
• and for any $$x$$ such that $$|r(x)| = 1\text{,}$$ the series $$T(x)$$ may or may not converge.
In essence, the Ratio Test is a way to find $$x$$ values for which $$T(x)$$ behaves like a geometric series with ratio $$r(x)$$ such that $$|r(x)| \lt 1\text{;}$$ for those $$x$$-values, the infinite series converges to a finite value 3 .
In light of the formal statement of the Ratio Test, we now see that in our initial investigation of the Taylor series for $$f(x) = \ln(1+x)\text{,}$$ we applied the Ratio Test to find an interval of $$x$$-values for which its Taylor series converges. In particular, for
\begin{equation*} T_f(x) = \sum_{k=1}^{\infty} (-1)^{k-1}\frac{1}{k}x^k \end{equation*}
we found that
\begin{equation*} r_n(x) = \frac{(-1)^{n}\frac{1}{n+1}x^{n+1}}{(-1)^{n-1}\frac{1}{n}x^n} = (-1) \cdot \frac{n}{n+1} \cdot x \end{equation*}
and therefore
\begin{equation*} r(x) = \lim_{n \to \infty} r_n(x) = \lim_{n \to \infty} (-1) \cdot \frac{n}{n+1} \cdot x = -x\text{.} \end{equation*}
By the Ratio Test, it follows that if $$|r(x)| = |-x| = x \lt 1\text{,}$$ then the series converges, and if $$|r(x)| = x \gt 1\text{,}$$ the series does not converge. When $$x = \pm 1\text{,}$$ we don't know if the series converges or diverges, but we will normally not be concerned with this “endpoint behavior”.

#### Activity8.4.2.

Consider the infinite Taylor series given by
\begin{align*} T(x) =\mathstrut \amp \sum_{k = 1}^{\infty} \frac{1}{k \cdot 2^k}(x-1)^k\\ =\mathstrut \amp \frac{1}{1 \cdot 2}(x-1) + \frac{1}{2 \cdot 4}(x-1)^2 + \frac{1}{3 \cdot 8}(x-1)^3 + \cdots + \frac{1}{n \cdot 2^n}(x-1)^n + \cdots\text{.} \end{align*}
1. As described in the statement of the Ratio Test, let $$r_n(x)$$ be the ratio of the $$(n+1)$$st term of $$T(x)$$ to the $$n$$th term of $$T(x)\text{.}$$ Find the simplest formula that you can for $$r_n(x)\text{.}$$
2. Let $$r(x) = \lim_{n \to \infty} r_n(x)\text{.}$$ Evaluate this limit to find the simplest formula you can for $$r(x)\text{.}$$
3. For what values of $$x$$ is $$|r(x)| \lt 1\text{?}$$ What does this tell us about $$T(x)$$ for these $$x$$-values?
4. Let $$T_{10}(x)$$ be the sum of the first $$10$$ terms of $$T(x)\text{,}$$ and let $$f(x) = \ln(2) - \ln(3-x)\text{.}$$ Plot $$f(x)$$ and $$T_{10}(x)$$ on the same coordinate axes. What do you notice? What does this suggest about the series $$T(x)\text{?}$$

### Subsection8.4.2Taylor series of several important functions

So far, we have established that the Taylor series of two important functions, $$\frac{1}{1-x}$$ and $$\ln(1+x)\text{,}$$ converge on an interval of $$x$$-values and on that interval converge to the respective functions. In particular,
• If $$|x| \lt 1\text{,}$$ then $$\frac{1}{1-x} = \sum_{k=0}^{\infty} x^k = 1 + x + x^2 + x^3 + \cdots\text{;}$$
• If $$|x| \lt 1\text{,}$$ then 4  $$\ln(1+x) = \sum_{k=1}^{\infty} (-1)^{n-1} \cdot \frac{1}{n} \cdot x^n = x - \frac{1}{2}x^2 + \frac{1}{3}x^3 - \cdots\text{.}$$
Three other important functions that we have studied — $$\sin(x)\text{,}$$ $$\cos(x)\text{,}$$ and $$e^x$$ — have similar representations, and so we build on our work with their respective Taylor polynomials in Section 8.1 and Section 8.2 in order to investigate and understand their Taylor series.
Following Activity 8.2.2, we noted some of the higher degree Taylor polynomials centered at $$a = 0$$ for $$\sin(x)\text{,}$$ $$\cos(x)\text{,}$$ and $$e^x\text{.}$$ For the sine function, we observed that
\begin{equation*} \sin(x) \approx P_7(x) = x - \frac{1}{3!}x^3 + \frac{1}{5!} x^5 - \frac{1}{7!}x^7\text{.} \end{equation*}
In the next example, we determine the Taylor series of $$f(x) = \sin(x)$$ and investigate the $$x$$-values for which the series converges.

#### Example8.4.3.

Explain why the Taylor series centered at $$a = 0$$ for $$f(x) = \sin(x)$$ is
\begin{equation*} T_f(x) = \sum_{k=0}^{\infty} (-1)^{k} \frac{1}{(2k+1)!}x^{2k+1} \end{equation*}
and find the interval of $$x$$-values for which this Taylor series converges. Investigate whether or not the Taylor series converges to $$f(x) = \sin(x)\text{.}$$
Solution.
We observed in Section 8.2 that the derivatives of the sine function cycle and repeat every $$4$$ derivatives, since
\begin{equation*} f(x) = \sin(x), f'(x) = \cos(x), f''(x) = -\sin(x), f'''(x) = -\cos(x), \end{equation*}
and so
\begin{equation*} f^{(4)}(x) = \sin(x), f^{(5)}(x) = \cos(x), f^{(6)}(x) = -\sin(x), f^{(7)}(x) = -\cos(x)\text{.} \end{equation*}
We observe that $$f^{(4k)}(x) = \sin(x)$$ and $$f^{(4k+2)}(x) = -\sin(x)$$ for every natural number $$k\text{.}$$ This shows that $$f^{(4k)}(0) = \sin(0) = 0$$ and $$f^{(4k+2)}(0) = -\sin(0) = 0\text{,}$$ from which it follows that every even power of $$x$$ in the Taylor series of the sine function has a coefficient of $$0\text{.}$$
If we instead consider the odd powers, we can see that since $$f'(x) = \cos(x)\text{,}$$ we also have $$f^{(5)}(x) = \cos(x)\text{,}$$ $$f^{(9)}(x) = \cos(x)\text{,}$$ and so on. From this, $$f'(0) = \cos(0) = 1\text{,}$$ and similarly, $$f^{(5)}(0) = 1\text{,}$$ $$f^{(9)}(x) = 1\text{,}$$ and indeed $$f^{(4k+1)}(0) = 1$$ for every nonnegative whole number $$k\text{.}$$ Finally, since $$f'''(x) = -\cos(x)\text{,}$$ we have $$f'''(0) = -\cos(0) = -1\text{,}$$ and so $$f'''(0) = -1\text{,}$$ $$f^{(7)}(0) = -1\text{,}$$ and thus $$f^{(4k+3)}(0) = -1$$ for every nonnegative whole number $$k\text{.}$$
Putting these observations together about the various derivatives of $$f(x) = \sin(x)$$ evaluated at $$a = 0$$ and using the fact that the Taylor series of $$f(x)$$ centered at $$0$$ has form
\begin{equation*} T_f(x) = \sum_{k=0}^{\infty} \frac{f^{(k)}(0)}{k!}x^k \end{equation*}
we see that
\begin{align} T_f(x) =\mathstrut \amp x - \frac{1}{3!}x^3 + \frac{1}{5!}x^5 - \frac{1}{7!}x^7 + \cdots + (-1)^{n} \frac{1}{(2n+1)!} x^{2n+1} + \cdots\notag\\ =\mathstrut \amp \sum_{k=0}^{\infty} (-1)^{k} \frac{1}{(2k+1)!}x^{2k+1}\tag{8.4.2} \end{align}
Next, we use the Ratio Test to investigate the values of $$x$$ where $$T_f(x)$$ converges. We therefore consider $$r_n(x)\text{,}$$ which is the ratio of consecutive nonzero terms, and have
\begin{equation*} r_n(x) = \frac{(-1)^{n+1} \frac{1}{(2(n+1)+1)!}x^{2(n+1)+1}}{(-1)^{n} \frac{1}{(2n+1)!}x^{2n+1}}\text{.} \end{equation*}
Expanding the expression $$2(n+1)\text{,}$$ combining like terms, and slightly rearranging how we write the fraction, we see that
\begin{align} r_n(x) =\mathstrut \amp \frac{(-1)^{n+1}}{(-1)^{n}} \cdot \frac{\frac{1}{(2n+3)!}}{\frac{1}{(2n+1)!}} \cdot \frac{x^{2n+3}}{x^{2n+1}}\notag\\ =\mathstrut \amp \frac{(-1)^{n+1}}{(-1)^{n}} \cdot \frac{(2n+1)!}{(2n+3)!} \cdot \frac{x^{2n+3}}{x^{2n+1}}\tag{8.4.3} \end{align}
We now consider the three fractions in Equation (8.4.3) one at a time and simplify each. First, we observe that
\begin{equation*} \frac{(-1)^{n+1}}{(-1)^{n}} = -1 \end{equation*}
since the numerator and denominator are each always either $$1$$ or $$-1$$ and always of opposite signs. Next, we expand the factorials and see that
\begin{equation*} (2n+1)! = (2n+1) (2n) (2n-1) \cdots (2) (1) \end{equation*}
and
\begin{equation*} (2n+3)! = (2n+3) (2n+2) (2n+1) (2n) (2n-1) \cdots (2) (1) \end{equation*}
so
\begin{equation*} \frac{(2n+1)!}{(2n+3)!} = \frac{1}{(2n+3)(2n+2)}\text{.} \end{equation*}
Finally, we observe that
\begin{equation*} \frac{x^{2n+3}}{x^{2n+1}} = x^{(2n+3) - (2n+1)} = x^2\text{.} \end{equation*}
Putting all of this work together, we can update Equation (8.4.3) to the simpler form
\begin{equation*} r_n(x) = (-1) \cdot \frac{1}{(2n+3)(2n+2)} \cdot x^2\text{.} \end{equation*}
From here, we compute $$r(x)\text{,}$$ the limit of $$r_n(x)$$ as $$n$$ increases without bound. Since $$\frac{1}{(2n+3)(2n+2)} \to 0$$ as $$n \to \infty\text{,}$$ it follows that for any fixed value of $$x\text{,}$$
\begin{equation*} r(x) = \lim_{n \to \infty} r_n(x) = \lim_{n \to \infty} (-1) \cdot \frac{1}{(2n+3)(2n+2)} \cdot x^2 = -1 \cdot 0 \cdot x^2 = 0\text{.} \end{equation*}
The Ratio Test tells us that for any $$x$$ for which $$|r(x)| \lt 1\text{,}$$ the series $$T_f(x)$$ converges. Here, since $$r(x) = 0$$ for every value of $$x\text{,}$$ this means that $$T_f(x)$$ converges for every real number $$x\text{.}$$
Finally, we investigate whether the Taylor series appears to converge to $$f(x) = \sin(x)$$ or not. In Figure 8.4.4, we see the Taylor polynomials of degree $$1\text{,}$$ $$5\text{,}$$ and $$9\text{,}$$ and the significant improvement of the approximation as the degree increases.
In particular, for the degree $$9$$ approximation, we see that $$T_9(x)$$ and $$f(x) = \sin(x)$$ are almost indistinguishable on $$-4 \lt x \lt 4\text{,}$$ which is much wider than the interval $$-2 \lt x \lt 2$$ on which the $$T_5(x)$$ approximation is accurate. Increasing the degree of the approximation appears to widen the interval on which the approximation is accurate and seems to do so without bound, which suggests that the Taylor series of $$f(x) = \sin(x)$$ in fact converges to $$f(x) = \sin(x)\text{.}$$
In Example 8.4.3, we found that the Taylor series for the sine function appears to converge to the sine function, and to do so for every real number $$x\text{.}$$ This result can be proven formally using a famous theorem called the Lagrange Error Bound 5 , a result that quantifies how accurate a Taylor polynomial approximation is on an interval. To summarize, we now know the remarkable result that the sine function is equal to its Taylor series for every value of $$x\text{,}$$ so
$$\sin(x) = \sum_{k=0}^{\infty} (-1)^{k} \frac{1}{(2k+1)!}x^{2k+1} = x - \frac{1}{3!}x^3 + \frac{1}{5!}x^5 - \cdots\tag{8.4.4}$$
Nearly identical reasoning shows a similar result for the cosine function: that its Taylor series centered at $$a = 0$$ converges for every real number $$x$$ and converges to the cosine function itself. Thus, for any real number $$x\text{,}$$
$$\cos(x) = \sum_{k=0}^{\infty} (-1)^{k} \frac{1}{(2k)!}x^{2k} = 1 - \frac{1}{2!}x^2 + \frac{1}{4!}x^4 - \cdots\tag{8.4.5}$$
In the next activity, we conduct a similar investigation for $$f(x) = e^x\text{.}$$

#### Activity8.4.3.

Let $$f(x) = e^x\text{.}$$ Our goal is to understand why the Taylor series for $$f(x)$$ converges for every real number $$x$$ and see that the Taylor series converges to $$e^x\text{.}$$
1. For $$f(x) = e^x\text{,}$$ explain why $$f^{(k)}(0) = 1$$ for every natural number $$k\text{.}$$
2. State the Taylor series, $$T_f(x)$$ centered at $$a = 0$$ for $$f(x) = e^x\text{.}$$ Write $$T_f(x)$$ in both sigma notation and as an expanded sum.
3. Let $$r_n(x)$$ be the ratio of the $$(n+1)$$st term to the $$n$$th term of $$T_f(x)\text{.}$$ Find the simplest expression you can for $$r_n(x)\text{.}$$
4. Let $$r(x) = \lim_{n \to \infty} r_n(x)\text{.}$$ Evaluate this limit, and then apply the Ratio Test to say what you can conclude about the $$x$$-values for which $$T_f(x)$$ converges.
5. Use a computational device to graph $$f(x) = e^x\text{,}$$ $$T_{10}(x)\text{,}$$ and $$T_{20}(x)$$ on the same axes. What do you observe?
While there is considerable technical detail involved in finding Taylor series and deciding where they converge, it's important not to miss the big picture. For certain “nice” functions that are infinitely differentiable, such as $$f(x) = \ln(1+x)$$ and $$f(x) = \sin(x)\text{,}$$ not only can we find the Taylor series for each and determine the $$x$$-values at which the Taylor series converges, but the Taylor series converges to the function itself. This means that for certain $$x$$-values (and sometimes all $$x$$-values), we can represent a non-polynomial function as being equal to an infinite polynomial.
A function such as $$f(x) = \sin(x)$$ that is infinitely differentiable and has a convergent power series that converges on some interval to the function itself is said to be analytic. Analytic functions are amazing and among the nicest functions in all of mathematics: they are completely determined by what happens at a single point. Almost all functions are not analytic. For example, if a function measures your location as a function of time on a highway, that function cannot be analytic, since what happens at 12:01 is independent of what happens at 12:00 due to other circumstances such as traffic or construction. At the same time, the mathematical universe is better to us than we deserve in that many of the most interesting functions are analytic, including those we've mentioned ($$\frac{1}{1-x}\text{,}$$ $$\ln(1+x)\text{,}$$ $$\sin(x)\text{,}$$ $$\cos(x)\text{,}$$ and $$e^x$$) and most of those represented by buttons on a calculator.
For the function $$f(x) = e^x$$ in particular, we now understand that we may write
\begin{equation*} e^x = \sum_{k=0}^\infty \frac{1}{k!}x^k = 1 + x + \frac{1}{2!}x^2 + \frac{1}{3!}x^3 + \cdots + \frac{1}{n!}x^n + \cdots\text{,} \end{equation*}
and this equation is true for every possible value of $$x\text{.}$$ This equation is completely determined by the values of $$f(x) = e^x$$ and its derivatives only at the value $$a = 0\text{!}$$ When we use a computational device like Desmos or a calculator and enter $$e^2\text{,}$$ this is how the device finds the decimal representation of the number. Since
\begin{equation*} e^2 = 1 + 2 + \frac{1}{2!}2^2 + \frac{1}{3!}2^3 + \cdots + \frac{1}{n!}2^n + \cdots \end{equation*}
if we take enough terms in the sum, we get a highly accurate approximation of $$e^2\text{.}$$ For instance,
\begin{equation*} e^2 \approx 1 + 2 + \frac{1}{2!}2^2 + \frac{1}{3!}2^3 + \cdots + \frac{1}{12!}2^{12} = \frac{691}{93555} = 7.3890545668 \ldots, \end{equation*}
which an accurate representation of $$e^2$$ to 5 decimal places, and more terms in the sum can be used in order to generate any desired level of accuracy.
The five Taylor series that we've found in our work to date are extremely important and will be used extensively in Section 8.5, so we summarize them in

### Subsection8.4.3Summary

• Provided that $$f$$ is a function for which every derivative of $$f$$ exists at $$x = a\text{,}$$ the Taylor series centered at $$a$$ of $$f$$ is the series $$T_f(x)$$ defined by
\begin{align*} T_f(x) =\mathstrut \amp \sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k!}(x-a)^k\\ =\mathstrut \amp f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots + \frac{f^{(n)}(a)}{n!}(x-a)^n + \cdots\text{.} \end{align*}
• We know that an infinite geometric series converges whenever its common ratio, $$r\text{,}$$ satisfies $$|r| \lt 1\text{.}$$ The Ratio Test enables us to consider a Taylor series and determine an interval of $$x$$-values on which the series converges, essentially by comparing the Taylor series to a geometric series. By letting $$r_n(x)$$ be the ratio of consecutive terms in the series and taking the limit
\begin{equation*} r(x) = \lim_{n \to \infty} r_n(x)\text{,} \end{equation*}
we can say that for all $$x$$ for which $$|r(x)| \lt 1\text{,}$$ the Taylor series converges to a finite value.
• We have found the Taylor series for five important functions, determined an interval of $$x$$-values on which each converges, and seen the striking result that where each Taylor series converges, it converges to original function $$f(x)$$ that we used to generate the Taylor series. These results are summarized in Table 8.4.5.

### Exercises8.4.4Exercises

#### 1.

Write out the first four terms of the Maclaurin series of $$f(x)$$ if
\begin{equation*} f(0) = -2, \qquad f'(0) = -3, \qquad f''(0) = 15, \qquad f'''(0) = -6 \end{equation*}
$$f(x)$$ = $$+ \cdots$$

#### 2.

Write the Taylor series for $$f(x) = e^{x}$$ about $$x=1$$ as $$\displaystyle \sum_{n=0}^\infty c_n(x-1)^n.$$
Find the first five coefficients.
 $$c_0$$ $$=$$ $$c_1$$ $$=$$ $$c_2$$ $$=$$ $$c_3$$ $$=$$ $$c_4$$ $$=$$

#### 3.

Find the first four terms of the Taylor series for the function $$\displaystyle \frac{4}{x}$$ about the point $$a = 3\text{.}$$ (Your answers should include the variable x when appropriate.)
$$\displaystyle \frac{4}{x} =$$ + + + + ...

#### 4.

Find the first five terms of the Taylor series for the function $$f(x) = \ln\!\left(x\right)$$ about the point $$a = 9\text{.}$$ (Your answers should include the variable x when appropriate.)
$$\ln\!\left(x\right) =$$ + + + + + ...

#### 5.

Find the first four terms of the Taylor series for the function $$5 \sin(x)$$ about the point $$a = -\pi/4\text{.}$$ (Your answers should include the variable x when appropriate.)
$$5 \sin(x) =$$ + + + + ...

#### 6.

For each of the following, solve exactly for the variable $$x\text{.}$$
(a) $$x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots = 0.3$$
$$x =$$
(b) $$1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots = 0.1$$
$$x =$$

#### 7.

By recognizing each series below as a Taylor series evaluated at a particular value of $$x\text{,}$$ find the sum of each convergent series.
A. $$4 - {4^3\over 3!} + {4^5\over 5!} - {4^7\over 7!} + \cdots + {(-1)^{n} 4^{2n+1}\over (2n+1)!} + \cdots =$$
B. $$1 + 2 + {2^2\over 2!} + {2^3\over 3!} + {2^4\over 4!} + \cdots + {2^n\over n!} + \cdots =$$

#### 8.

The examples we have considered so far in this section have all been for Taylor polynomials and series centered at 0, but Taylor polynomials and series can be centered at any value of $$a\text{.}$$
1. Let $$f(x) = \cos(x)\text{.}$$ Find the Taylor polynomials up through order four of $$f$$ centered at $$x = \frac{\pi}{2}\text{.}$$ Then find the Taylor series for $$f(x)$$ centered at $$x = \frac{\pi}{2}\text{.}$$ Why is the result not surprising?
2. Let $$f(x) = \frac{1}{1+x} = (1+x)^{-1}\text{.}$$ Find the Taylor polynomials up through order four of $$f$$ centered at $$x = 1\text{.}$$ Then find the Taylor series for $$f(x)$$ centered at $$x = 1\text{.}$$

#### 9.

As we will in more detail in the next section, we can use known Taylor series to obtain other Taylor series, and we preview that idea in this exercise.
1. Calculate the first four derivatives of $$\sin(x^2)$$ and hence find the fourth order Taylor polynomial for $$\sin(x^2)$$ centered at $$a=0\text{.}$$
2. Part (a) demonstrates the direct approach to finding Taylor polynomials and series. Next we utilize a known Taylor series to make the process simpler. Recall that the Taylor series centered at 0 for $$f(x) = \sin(x)$$ is
$$T(x) = \sum_{k=0}^{\infty} (-1)^{k} \frac{x^{2k+1}}{(2k+1)!}\text{.}\tag{8.4.6}$$
1. Substitute $$x^2$$ for $$x$$ in the Taylor series $$T(x)$$ in Equation (8.4.6). Write out the first several terms and compare to your work in part (a). Explain why the substitution in this problem should result in the Taylor series for $$\sin(x^2)$$ centered at 0.
2. For what interval of $$x$$-values should we expect the Taylor series for $$\sin(x^2)$$ to converge?
We will formally define the Taylor series of a function $$f$$ in Definition 8.4.1.
This new representation may only be valid for a limited set of $$x$$-values, such as $$|x| \lt 1$$ in the case of $$f(x) = \frac{1}{1-x}\text{.}$$
It is possible that the series $$T(x)$$ also converges when $$|r(x)| = 1\text{,}$$ but in what remains in Chapter 8, we will not concern ourselves with this minor issue.
It turns out that this representation is also valid when $$x = 1$$ because the series $$1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \cdots$$ converges, and does so to the exact value $$\ln(2)\text{.}$$
The Lagrange Error Bound states: 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| \le M$$ on the interval $$[a, c]\text{.}$$ If $$P_n(x)$$ is the $$n$$th order Taylor polynomial for $$f(x)$$ centered at $$x=a\text{,}$$ then $$\left|P_n(c) - f(c)\right| \leq M\frac{|c-a|^{n+1}}{(n+1)!} \text{.}$$