# 11.10: Taylor Series

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

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

We have seen that some functions can be represented as series, which may give valuable information about the function. So far, we have seen only those examples that result from manipulation of our one fundamental example, the geometric series. We would like to start with a given function and produce a series to represent it, if possible.

Suppose that \(f(x)=\sum_{n=0}^\infty a_nx^n\) on some interval of convergence. Then we know that we can compute derivatives of \(f\) by taking derivatives of the terms of the series. Let's look at the first few in general: $$\eqalign{ f'(x)&=\sum_{n=1}^\infty n a_n x^{n-1}=a_1 + 2a_2x+3a_3x^2+4a_4x^3+\cdots\cr f''(x)&=\sum_{n=2}^\infty n(n-1) a_n x^{n-2}=2a_2+3\cdot2a_3x +4\cdot3a_4x^2+\cdots\cr f'''(x)&=\sum_{n=3}^\infty n(n-1)(n-2) a_n x^{n-3}=3\cdot2a_3 +4\cdot3\cdot2a_4x+\cdots\cr }$$ By examining these it's not hard to discern the general pattern. The \(k\)th derivative must be $$\eqalign{ f^{(k)}(x)&=\sum_{n=k}^\infty n(n-1)(n-2)\cdots(n-k+1)a_nx^{n-k}\cr &=k(k-1)(k-2)\cdots(2)(1)a_k+(k+1)(k)\cdots(2)a_{k+1}x+{}\cr &\qquad {}+(k+2)(k+1)\cdots(3)a_{k+2}x^2+\cdots\cr }$$ We can shrink this quite a bit by using factorial notation: $$ f^{(k)}(x)=\sum_{n=k}^\infty {n!\over (n-k)!}a_nx^{n-k}= k!a_k+(k+1)!a_{k+1}x+{(k+2)!\over 2!}a_{k+2}x^2+\cdots $$ Now substitute \(x=0\): $$f^{(k)}(0)=k!a_k+\sum_{n=k+1}^\infty {n!\over (n-k)!}a_n0^{n-k}=k!a_k,$$ and solve for \( a_k\): $$a_k={f^{(k)}(0)\over k!}.$$ Note the special case, obtained from the series for \(f\) itself, that gives \( f(0)=a_0\).

So if a function \(f\) can be represented by a series, we know just what series it is. Given a function \(f\), the series $$\sum_{n=0}^\infty {f^{(n)}(0)\over n!}x^n$$ is called the **Maclaurin series** for \(f\).

Example 11.10.1: Maclaurin series

Find the Maclaurin series for \(f(x)=1/(1-x)\).

**Solution**

We need to compute the derivatives of \(f\) (and hope to spot a pattern).

$$\eqalign{ f(x)&=(1-x)^{-1}\cr f'(x)&=(1-x)^{-2}\cr f''(x)&=2(1-x)^{-3}\cr f'''(x)&=6(1-x)^{-4}\cr f^{(4)}(x)&=4!(1-x)^{-5}\cr &\vdots\cr f^{(n)}(x)&=n!(1-x)^{-n-1}\cr }$$

So

$${f^{(n)}(0)\over n!}={n!(1-0)^{-n-1}\over n!}=1$$

and the Maclaurin series is

$$\sum_{n=0}^\infty 1\cdot x^n=\sum_{n=0}^\infty x^n,$$

the geometric series.

A warning is in order here. Given a function \(f\) we may be able to compute the Maclaurin series, but that does not mean we have found a series representation for \(f\). We still need to know where the series converges, and if, where it converges, it converges to \(f(x)\). While for most commonly encountered functions the Maclaurin series does indeed converge to \(f\) on some interval, this is not true of all functions, so care is required.

As a practical matter, if we are interested in using a series to approximate a function, we will need some finite number of terms of the series. Even for functions with messy derivatives we can compute these using computer software like Sage. If we want to know the whole series, that is, a typical term in the series, we need a function whose derivatives fall into a pattern that we can discern. A few of the most important functions are fortunately very easy.

Example 11.10.2: Maclaurin series

Find the Maclaurin series for \(\sin x\).

**Solution**

The derivatives are quite easy: \(f'(x)=\cos x\), \(f''(x)=-\sin x\), \(f'''(x)=-\cos x\), \( f^{(4)}(x)=\sin x\), and then the pattern repeats. We want to know the derivatives at zero: 1, 0, \(-1\), 0, 1, 0, \(-1\), 0,…, and so the Maclaurin series is

$$ x-{x^3\over 3!}+{x^5\over 5!}-\cdots= \sum_{n=0}^\infty (-1)^n{x^{2n+1}\over (2n+1)!}. $$

We should always determine the radius of convergence:

$$ \lim_{n\to\infty} {|x|^{2n+3}\over (2n+3)!}{(2n+1)!\over |x|^{2n+1}} =\lim_{n\to\infty} {|x|^2\over (2n+3)(2n+2)}=0, $$

so the series converges for every \(x\). Since it turns out that this series does indeed converge to \(\sin x\) everywhere, we have a series representation for \(\sin x\) for every \(x\).

Sometimes the formula for the \(n\)th derivative of a function \(f\) is difficult to discover, but a combination of a known Maclaurin series and some algebraic manipulation leads easily to the Maclaurin series for \(f\).

Example 11.10.3: Maclaurin series

Find the Maclaurin series for \(x\sin(-x)\).

**Solution**

To get from \(\sin x\) to \(x\sin(-x)\) we substitute \(-x\) for \(x\) and then multiply by \(x\). We can do the same thing to the series for \(\sin x\):

$$ x\sum_{n=0}^\infty (-1)^n{(-x)^{2n+1}\over (2n+1)!} =x\sum_{n=0}^\infty (-1)^{n}(-1)^{2n+1}{x^{2n+1}\over (2n+1)!} =\sum_{n=0}^\infty (-1)^{n+1}{x^{2n+2}\over (2n+1)!}. $$

As we have seen, a general power series can be centered at a point other than zero, and the method that produces the Maclaurin series can also produce such series.

Example 11.10.4: **Taylor series**

Find a series centered at \(-2\) for \(1/(1-x)\).

**Solution**

If the series is

$$\sum_{n=0}^\infty a_n(x+2)^n$$

then looking at the \(k\)th derivative:

$$k!(1-x)^{-k-1}=\sum_{n=k}^\infty {n!\over (n-k)!}a_n(x+2)^{n-k}$$

and substituting \(x=-2\) we get

$$ k!3^{-k-1}=k!a_k$$

and

$$ a_k=3^{-k-1}=1/3^{k+1},$$

so the series is

$$\sum_{n=0}^\infty {(x+2)^n\over 3^{n+1}}.$$

We've already seen this, in Section 11.8. Such a series is called the **Taylor series** for the function, and the general term has the form

$${f^{(n)}(a)\over n!}(x-a)^n.$$

A Maclaurin series is simply a Taylor series with \(a=0\).