Taylor Series

The sum formula for a geometric series is an example of a representation of a non-polynomial function as an infinite polynomial, within a particular range of inputs.

$\begin{align*} \frac{x}{1−x} = x + x^2 + x^3 + \cdots \hspace{.5cm} (\mbox{provided } |x|<1) \end{align*}$


Many other non-polynomial functions can be represented by infinite polynomials, called Taylor series. The general formula for the Taylor series of a function $f(x)$, centered about a point $x=c$, is

$\begin{align*} f(x) = \sum\limits_{n=0}^\infty \frac{f^{(n)}(c)}{n!}(x−c)^n. \end{align*}$


Just like for the geometric series sum formula, the Taylor series can only be used when it converges. The ratio test is particularly useful for finding the x-values for which the series converges.

For the sake of example, we will compute the Taylor series of several familiar functions: $e^x$, $\sin x$, and $\ln x$. To introduce some variety, we will center each series at a different x-value.

For $f(x)=e^x$, we have $f’(x)=e^x$, $f’^\prime(x)=e^x$, and in general $f^{(n)}(x)=e^x$ for all values of $n$. The Taylor series of $f(x)=e^x$ centered at $x=0$ is then given by

$\begin{align*} f(x) &= \sum\limits_{n=0}^\infty \frac{f^{(n)}(0)}{n!}(x−0)^n \\ &= \sum\limits_{n=0}^\infty \frac{e^0}{n!}x^n \\ &= \sum\limits_{n=0}^\infty \frac{x^n}{n!} \, . \end{align*}$


Applying the ratio test, we see that the series converges when

$\begin{align*} \lim\limits_{n\to\infty} \left|\frac{ \frac{x^{n+1}}{(n+1)!} }{ \frac{x^n}{n!} } \right| &< 1 \\ \lim\limits_{n\to\infty} \left|\frac{x}{n+1} \right| &< 1 \\ 0 < 1\, . \end{align*}$


Thus, the series converges for all values of $x$.

For $f(x)=\sin x$, we have $f’(x)=\cos x$, $f’^\prime(x)=-\sin x$, $f’’^\prime(x)=-\cos x$, $f^{(4)}(x)=\sin x$, and in general $f^{(2n)}(x)=(-1)^n \sin x$ and $f^{(2n+1)}(x)=(-1)^n \cos x$. The Taylor series of $f(x)=\sin x$ centered at $x=\pi$ is then given by

$\begin{align*} f(x) &= \sum\limits_{n=0}^\infty \frac{f^{(n)}(\pi)}{n!}(x−\pi)^n \\ &= \sum\limits_{n=0}^\infty \frac{f^{(2n)}(\pi)}{(2n)!}(x−\pi)^{2n}+\frac{f^{(2n+1)}(\pi)}{(2n+1)!}(x−\pi)^{2n+1} \\ &= \sum\limits_{n=0}^\infty \frac{(−1)^n \sin (\pi)}{(2n)!}(x−\pi)^{2n}+\frac{(−1)^n \cos (\pi)}{(2n+1)!}(x−\pi)^{2n+1} \\ &= \sum\limits_{n=0}^\infty \frac{(−1)^n (0)}{(2n)!}(x−\pi)^{2n}+\frac{(−1)^n (−1)}{(2n+1)!}(x−\pi)^{2n+1} \\ &= \sum\limits_{n=0}^\infty \frac{(−1)^{n+1}}{(2n+1)!}(x−\pi)^{2n+1} \, . \end{align*}$


Applying the ratio test, we see that the series converges when

$\begin{align*} \lim\limits_{n\to\infty} \left|\frac{ \frac{ (−1)^{(n+1)+1} }{ (2(n+1)+1)! }(x−\pi)^{2(n+1)+1} }{ \frac{(−1)^{n+1}}{(2n+1)!}(x−\pi)^{2n+1} } \right| &< 1 \\ \lim\limits_{n\to\infty} \left|\frac{ \frac{(x−\pi)^{2n+3} }{ (2n+3)! } }{ \frac{ (x−\pi)^{2n+1} }{(2n+1)!} } \right| &< 1 \\ \lim\limits_{n\to\infty} \left| \frac{(x−\pi)^2}{(2n+2)(2n+3)} \right| &< 1 \\ 0 &< 1. \end{align*}$


Thus, the series converges for all values of $x$.

For $f(x)=\ln x$, we have $f’(x)=\frac{1}{x}$, $f’^\prime(x)=-\frac{1}{x^2}$, $f’’^\prime(x)=\frac{2}{x^3}$, and in general $f^{(n)}(x)=(-1)^{n-1} \frac{(n-1)!}{x^n}$ for $n>1$. The Taylor series of $f(x)=\ln x$ centered at $x=1$ is then given by

$\begin{align*} f(x) &= \sum\limits_{n=0}^\infty \frac{f^{(n)}(1)}{n!}(x−1)^n \\ &= f(1) + \sum\limits_{n=1}^\infty \frac{f^{(n)}(1)}{n!}(x−1)^n \\ &= \ln 1 + \sum\limits_{n=1}^\infty \frac{ (−1)^{n−1}\frac{(n−1)!}{1^n} }{n!}(x−1)^n \\ &= \sum\limits_{n=1}^\infty \frac{ (−1)^{n−1} }{n}(x−1)^n \, . \end{align*}$


Applying the ratio test, we see that the series converges when

$\begin{align*} \lim\limits_{n\to\infty} \left|\frac{ \frac{(−1)^{(n+1)−1}}{n+1}(x−1)^{n+1} }{ \frac{(−1)^{n−1}}{n}(x−1)^n } \right| &< 1 \\ \lim\limits_{n\to\infty} \left|\frac{n}{n+1}(x−1) \right| &< 1 \\ |x−1| \lim\limits_{n\to\infty} \left|\frac{n}{n+1} \right| &< 1 \\ |x−1| &< 1 . \end{align*}$


Thus, the series converges for $0<x<2$.

To see where the formula for the Taylor series comes from, we start by performing repeated integration on the function $f^{(n+1)}(x)$.

$\begin{align*} &\underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n+1 integrals} } f^{(n+1)}(x) \, (dx)^{n+1} \\ &= \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n integrals} } f^{(n)}(x)−f^{(n)}(c) \, (dx)^{n} \\ &= \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n−1 integrals} } f^{(n−1)}(x)−f^{(n−1)}(c) − f^{(n)}(c)(x−c) \, (dx)^{n−1} \\ &= \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n−2 integrals} } f^{(n−2)}(x)−f^{(n−2)}(c) − f^{(n−1)}(c)(x−c) − \frac{f^{(n)}(c)}{2}(x−c)^2 \, (dx)^{n−2} \\ &= \hspace{.5cm} \cdots \\ &= f(x)−f(c)−f'(c)(x−c) − \frac{f''(c)}{2}(x−c)^2 − \cdots − \frac{f^{(n)}(c)}{n!}(x−c)^n \end{align*}$


Solving for $f(x)$, we find

$\begin{align*} f(x) = f(c) &+ f'(c)(x−c) + \frac{f''(c)}{2}(x−c)^2 + \cdots + \frac{f^{(n)}(c)}{n!} (x−c)^n \\ &+ \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n+1 integrals} } f^{(n+1)}(x) \, (dx)^{n+1} \, . \end{align*}$


Taking the limit as $n \to \infty$, we can express $f$ as the sum of its Taylor series and some remainder term.

$\begin{align*} f(x) = \sum\limits_{n=0}^\infty \frac{f^{(n)}(c)}{n!}(x−c)^n + \lim\limits_{n\to\infty} \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n+1 integrals} } f^{(n+1)}(x) \, (dx)^{n+1} \end{align*}$


For many familiar functions, with $x$ sufficiently close to $c$, it is often the case that the remainder decays to zero:

$\begin{align*} \lim\limits_{n\to\infty} \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n+1 integrals} } f^{(n+1)}(x) \, (dx)^{n+1} = 0 \end{align*}$


For example, the remainder decays to zero if $f$ is any polynomial, because differentiating an $\text{n}^\text{th}$ degree polynomial $n+1$ times always yields a result of $0$, and the integral of $0$ is always $0$. (But this is rather trivial, since the Taylor series of a polynomial is the polynomial itself.)

More generally, we can place an upper bound on the size of the $\text{n}^\text{th}$ remainder:

$\begin{align*} \left| \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n+1 integrals} } f^{(n+1)}(x) \, (dx)^{n+1} \right| \leq \left( \max\limits_{[c,x]} \left| f^{(n+1)} \right| \right) \left| \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n+1 integrals} } 1 \, (dx)^{n+1} \right| \end{align*}$


Then, since

$\begin{align*} \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n+1 integrals} } 1 \, (dx)^{n+1} &= \frac{(x−c)^{n+1}}{(n+1)!} \end{align*}$


we must have that

$\begin{align*} \left| \lim\limits_{n\to\infty} \underbrace{\int\limits_c^x \cdots \int\limits_c^x}_{\text{n+1 integrals} } f^{(n+1)}(x) \, (dx)^{n+1} \right| \leq \lim\limits_{n\to\infty} \left( \max\limits_{[c,x]} \left| f^{(n+1)} \right| \right) \frac{\left| x−c \right|^{n+1}}{(n+1)!} \, . \end{align*}$


Provided that the $(n+1)^\text{st}$ derivative doesn’t grow large enough to overpower the $(n+1)!$ term in the denominator as $n \to \infty$, the remainder will decay to zero. Then the function will be equal to its Taylor series, provided that the series converges.

$\begin{align*} f(x) = \sum\limits_{n=0}^\infty \frac{f^{(n)}(c)}{n!}(x−c)^n \end{align*}$



Practice Problems


Compute the Taylor series for the following functions, centered at the given points. Also compute the interval of convergence. (You can view the solution by clicking on the problem.)

$\begin{align*} 1) \hspace{.5cm} &f(x)= \ln (1+x) \\ &\mbox{at } x=0 \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=1}^\infty \frac{(−1)^{n+1} }{n}x^n \\ & −1 < x \leq 1 \end{align*}$


$\begin{align*} 2) \hspace{.5cm} &f(x)=\frac{1}{(1+x)^2} \\ &\mbox{at } x=0 \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty (−1)^n(1+n) x^n \\ & −1 < x < 1 \end{align*}$


$\begin{align*} 3) \hspace{.5cm} &f(x)=\cos x \\ &\mbox{at } x=0 \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty \frac{(−1)^n}{(2n)!} x^{2n} \\ & −\infty < x < \infty \end{align*}$


$\begin{align*} 4) \hspace{.5cm} &f(x)= \cos x \\ &\mbox{at } x=\pi \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty \frac{(−1)^{n+1} }{(2n)! } (x−\pi)^{2n} \\ & −\infty < x < \infty \end{align*}$


$\begin{align*} 5) \hspace{.5cm} &f(x)= \arctan x \\ &\mbox{at } x=0 \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty \frac{(−1)^n}{2n+1} x^{2n+1} \\ & −1 \leq x \leq 1 \end{align*}$


$\begin{align*} 6) \hspace{.5cm} &f(x)= 2^x \\ &\mbox{at } x=−1 \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty \frac{(\ln 2)^n}{(2n)!} (x+1)^n \\ & −\infty < x < \infty \end{align*}$


$\begin{align*} 7) \hspace{.5cm} &f(x)= \frac{1}{x} \\ &\mbox{at } x=2 \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty \frac{(−1)^n}{2^{n+1} } (x−2)^n \\ & 0 < x < 4 \end{align*}$


$\begin{align*} 8) \hspace{.5cm} &f(x)= \frac{1}{x} \\ &\mbox{at } x=−10 \end{align*}$
Solution:
$\begin{align*} &\sum\limits_{n=0}^\infty − \frac{1}{10^{n+1} }(x+10)^n \\ & −20 < x < 0 \end{align*}$


Leave a Comment