---
title: Taylor and Maclaurin Series
module: Infinite Sequences and Series
moduleNumber: 9
lessonNumber: 5
order: 905
summary: >
  If a function equals a power series, its coefficients are forced: the nth is
  the nth derivative at the center over n factorial. We derive that formula, use
  Taylor's Inequality to prove the standard series for the exponential, sine, and
  cosine, record the binomial series and a reference table, and bound the error
  when a Taylor polynomial replaces a function.
topics: [Infinite Sequences and Series]
sources:
  - book: Stewart
    ref: "Ch. 11; §11.10 Taylor and Maclaurin Series"
  - book: Stewart
    ref: "§11.11 Applications of Taylor Polynomials"
---

Manipulating the geometric series produces a power series for a function without
ever asking the direct question: given $f$, what coefficients make
$f(x) = \sum c_n (x - a)^n$? The coefficients are determined by the
derivatives of $f$ at the center.

## The coefficient formula

Suppose $f$ has a power series representation about $a$,

$$
f(x) = c_0 + c_1(x - a) + c_2(x - a)^2 + c_3(x - a)^3 + \cdots, \qquad |x - a| < R.
$$

Setting $x = a$ gives $f(a) = c_0$. Differentiating term by term (legal inside
$R$) and setting $x = a$ each time isolates one coefficient per step:

$$
f'(x) = c_1 + 2c_2(x-a) + 3c_3(x-a)^2 + \cdots \ \Rightarrow\ f'(a) = c_1,
$$
$$
f''(x) = 2c_2 + 2\cdot 3\, c_3(x-a) + \cdots \ \Rightarrow\ f''(a) = 2 c_2,
$$
$$
f'''(x) = 2\cdot 3\, c_3 + \cdots \ \Rightarrow\ f'''(a) = 3!\, c_3.
$$

The pattern is $f^{(n)}(a) = n!\, c_n$, so $c_n = f^{(n)}(a)/n!$.

> **Theorem (Taylor coefficients).** If $f(x) = \sum_{n=0}^{\infty} c_n (x-a)^n$
> on $|x - a| < R$, then necessarily
> $$
> c_n = \frac{f^{(n)}(a)}{n!}.
> $$

The coefficients are unique: however a power series for $f$ is obtained, its
coefficients must be these. Substituting them back names the series.

> **Definition (Taylor and Maclaurin series).** The **Taylor series** of $f$
> centered at $a$ is
> $$
> \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x - a)^n
> = f(a) + \frac{f'(a)}{1!}(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots.
> $$
> The special case $a = 0$ is the **Maclaurin series**
> $\sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!} x^n$.

## Taylor polynomials and the remainder

Having a Taylor series is not the same as _equalling_ it: the series might
converge to something other than $f$, or not converge at all. To check, look at
its partial sums.

> **Definition (Taylor polynomial).** The $n$th-degree **Taylor polynomial** of
> $f$ at $a$ is the partial sum
> $$
> T_n(x) = \sum_{i=0}^{n} \frac{f^{(i)}(a)}{i!}(x - a)^i.
> $$

$T_1$ is the tangent-line linearization; $T_n$ agrees with $f$ in value and in
the first $n$ derivatives at $a$. The function equals its Taylor series exactly
when $T_n(x) \to f(x)$. Writing the gap as $R_n(x) = f(x) - T_n(x)$, the
**remainder**, the condition is $\lim_{n\to\infty} R_n(x) = 0$.

> **Theorem (Convergence via the remainder).** If $f(x) = T_n(x) + R_n(x)$ and
> $\lim_{n\to\infty} R_n(x) = 0$ for $|x - a| < R$, then $f$ equals its Taylor
> series on that interval.

$$
% caption: For $f(x) = \sin x$, the Taylor polynomials $T_1, T_3, T_5$ match the
% curve over ever-wider intervals about the origin; the remainder $R_n(x)$ is the
% vertical gap between $\sin x$ and the polynomial.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\definecolor{red}{HTML}{C0392B}
\draw[black, ->] (-4.2,0) -- (4.4,0) node[anchor=north east] {$x$};
\draw[black, ->] (0,-2.4) -- (0,2.4) node[anchor=north east] {$y$};
% sin x (x in radians; tikz uses degrees so multiply by 57.2958)
\draw[black!75, very thick] plot[domain=-4:4, samples=100] (\x, {sin(\x r)});
\node[black!75, anchor=south west, font=\scriptsize] at (3.1,0.5) {$\sin x$};
% T1 = x
\draw[acc!55, thick] plot[domain=-1.9:1.9, samples=2] (\x, {\x});
\node[acc!70, anchor=west, font=\scriptsize] at (1.55,1.9) {$T_1$};
% T3 = x - x^3/6
\draw[acc, thick] plot[domain=-3.0:3.0, samples=80] (\x, {\x - (\x*\x*\x)/6});
\node[acc, anchor=north west, font=\scriptsize] at (2.55,-2.0) {$T_3$};
% T5 = x - x^3/6 + x^5/120
\draw[red, thick] plot[domain=-3.6:3.6, samples=90] (\x, {\x - (\x*\x*\x)/6 + (\x*\x*\x*\x*\x)/120});
\node[red, anchor=south, font=\scriptsize] at (3.5,1.7) {$T_5$};
\end{tikzpicture}
$$

To show $R_n \to 0$, bound the remainder by the size of the next
derivative.

> **Theorem (Taylor's Inequality).** If $|f^{(n+1)}(x)| \le M$ for
> $|x - a| \le d$, then
> $$
> |R_n(x)| \le \frac{M}{(n+1)!}\,|x - a|^{n+1} \qquad \text{for } |x - a| \le d.
> $$

Paired with the fact that $x^n/n! \to 0$ for every real $x$, this drives the
remainder to zero whenever the derivatives stay uniformly bounded.

## The exponential, sine, and cosine

**Exponential.** For $f(x) = e^x$, every derivative is $e^x$, so $f^{(n)}(0) = 1$
and the Maclaurin series is $\sum x^n/n!$. On any interval $|x| \le d$ the
derivatives satisfy $|f^{(n+1)}(x)| = e^x \le e^d$, so Taylor's Inequality with
$M = e^d$ gives $|R_n(x)| \le e^d |x|^{n+1}/(n+1)! \to 0$. Hence

$$
e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots \qquad \text{for all } x.
$$

Setting $x = 1$ recovers $e = \sum 1/n!$.

$$
% caption: The Taylor polynomials of $e^x$ at the origin. Each added term lifts
% the polynomial closer to $e^x$ over a wider interval; $T_3$ already tracks the
% curve well past the center.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\definecolor{red}{HTML}{C0392B}
\draw[black, ->] (-2.6,0) -- (2.4,0) node[anchor=north east] {$x$};
\draw[black, ->] (0,-0.4) -- (0,4.3) node[anchor=north east] {$y$};
% e^x
\draw[black!75, very thick] plot[domain=-2.5:1.4, samples=80] (\x, {exp(\x)});
\node[black!75, anchor=south east] at (1.35,3.95) {$e^x$};
% T1 = 1 + x
\draw[acc!55, thick] plot[domain=-2.5:1.9, samples=2] (\x, {1+\x});
\node[acc!70, anchor=west, font=\scriptsize] at (1.95,2.95) {$T_1$};
% T2 = 1 + x + x^2/2
\draw[acc, thick] plot[domain=-2.5:1.5, samples=70] (\x, {1+\x+\x*\x/2});
\node[acc, anchor=east, font=\scriptsize] at (-2.1,2.0) {$T_2$};
% T3 = 1 + x + x^2/2 + x^3/6
\draw[red, thick] plot[domain=-2.5:1.4, samples=80] (\x, {1+\x+\x*\x/2+\x*\x*\x/6});
\node[red, anchor=east, font=\scriptsize] at (1.35,3.3) {$T_3$};
\end{tikzpicture}
$$

**Sine.** For $f(x) = \sin x$ the derivatives cycle through $\cos x, -\sin x,
-\cos x, \sin x$, giving $f(0), f'(0), \ldots = 0, 1, 0, -1, 0, 1, \ldots$. Every
derivative is $\pm\sin x$ or $\pm\cos x$, so $|f^{(n+1)}(x)| \le 1$ and $M = 1$
works for all $x$. Thus

$$
\sin x = \sum_{n=0}^{\infty} (-1)^n \frac{x^{2n+1}}{(2n+1)!}
= x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots \qquad \text{for all } x.
$$

**Cosine.** Rather than repeat the computation, differentiate the sine series
term by term (legal inside the interval of convergence, here all of
$\mathbb{R}$):

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

Existing series combine without any new differentiation. Multiplying the cosine
series by $x$ gives the series for $x\cos x$; substituting into the exponential
series gives series for $e^{-x^2}$ and the like.

## The binomial series

The last standard series generalizes the Binomial Theorem to any real exponent.
For $f(x) = (1 + x)^k$ with $k$ real, $f^{(n)}(0) = k(k-1)\cdots(k - n + 1)$, so
the Maclaurin coefficients are the **binomial coefficients**

$$
\binom{k}{n} = \frac{k(k-1)(k-2)\cdots(k - n + 1)}{n!}.
$$

The Ratio Test gives radius of convergence $1$ for non-integer $k$.

> **Theorem (Binomial series).** For any real $k$ and $|x| < 1$,
> $$
> (1 + x)^k = \sum_{n=0}^{\infty} \binom{k}{n} x^n
> = 1 + kx + \frac{k(k-1)}{2!}x^2 + \frac{k(k-1)(k-2)}{3!}x^3 + \cdots.
> $$

If $k$ is a nonnegative integer the coefficients eventually vanish and the series
terminates, reducing to the ordinary Binomial Theorem. Otherwise it is infinite.

**Example.** To expand $1/\sqrt{4 - x}$, factor: $1/\sqrt{4 - x} =
\tfrac{1}{2}(1 - x/4)^{-1/2}$, then apply the binomial series with
$k = -\tfrac{1}{2}$ and $x$ replaced by $-x/4$. The result converges for
$|x| < 4$.

## A reference table

The standard Maclaurin series, collected in one place, recur constantly.

| Function | Maclaurin series | Radius |
| --- | --- | --- |
| $\dfrac{1}{1-x}$ | $\displaystyle\sum_{n=0}^{\infty} x^n$ | $1$ |
| $e^x$ | $\displaystyle\sum_{n=0}^{\infty} \dfrac{x^n}{n!}$ | $\infty$ |
| $\sin x$ | $\displaystyle\sum_{n=0}^{\infty} (-1)^n \dfrac{x^{2n+1}}{(2n+1)!}$ | $\infty$ |
| $\cos x$ | $\displaystyle\sum_{n=0}^{\infty} (-1)^n \dfrac{x^{2n}}{(2n)!}$ | $\infty$ |
| $\tan^{-1} x$ | $\displaystyle\sum_{n=0}^{\infty} (-1)^n \dfrac{x^{2n+1}}{2n+1}$ | $1$ |
| $\ln(1+x)$ | $\displaystyle\sum_{n=1}^{\infty} (-1)^{n-1} \dfrac{x^n}{n}$ | $1$ |
| $(1+x)^k$ | $\displaystyle\sum_{n=0}^{\infty} \binom{k}{n} x^n$ | $1$ |

## Approximating with a controlled error

In practice, a low-degree Taylor polynomial approximates $f$ near
$a$, and Taylor's Inequality (or, for alternating series, the first omitted term)
certifies the accuracy over an interval.

$$
% caption: Over $|x - a| \le d$ the graph of $T_n$ stays inside an error band of
% half-width $M\,d^{\,n+1}/(n+1)!$ around $f$; the band widens as $x$ leaves the
% center.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-3.6,0) -- (3.8,0) node[anchor=north east] {$x$};
\draw[black, ->] (0,-0.5) -- (0,3.2) node[anchor=north east] {$y$};
% f (a curve)
\draw[black!75, very thick] plot[domain=-3.3:3.3, samples=80] (\x, {1.4 + 0.32*\x + 0.12*\x*\x});
\node[black!75, anchor=west, font=\scriptsize] at (2.3,3.0) {$f$};
% error band around f
\draw[acc!55, thick] plot[domain=-3.3:3.3, samples=80] (\x, {1.4 + 0.32*\x + 0.12*\x*\x + 0.05*\x*\x + 0.1});
\draw[acc!55, thick] plot[domain=-3.3:3.3, samples=80] (\x, {1.4 + 0.32*\x + 0.12*\x*\x - 0.05*\x*\x - 0.1});
\fill[acc!12] plot[domain=-3.3:3.3, samples=80] (\x, {1.4 + 0.32*\x + 0.12*\x*\x + 0.05*\x*\x + 0.1})
  -- plot[domain=3.3:-3.3, samples=80] (\x, {1.4 + 0.32*\x + 0.12*\x*\x - 0.05*\x*\x - 0.1}) -- cycle;
\node[acc, anchor=south, font=\scriptsize] at (0,2.05) {error band};
\draw[black, |-|] (-2,-0.35) -- (2,-0.35);
\node[black, anchor=north, font=\scriptsize] at (0,-0.35) {$\lvert x - a \rvert \le d$};
\fill[black] (0,1.4) circle (2pt);
\node[black, anchor=north east, font=\scriptsize] at (0,1.4) {$a$};
\end{tikzpicture}
$$

> **Worked example.** Approximate $\sqrt[3]{x}$ near $a = 8$ by $T_2$ and bound
> the error on $7 \le x \le 9$.
>
> From $f(8) = 2$, $f'(8) = \tfrac{1}{12}$, and $f''(8) = -\tfrac{1}{144}$,
>
> $$
> \sqrt[3]{x} \approx T_2(x) = 2 + \tfrac{1}{12}(x - 8) - \tfrac{1}{288}(x - 8)^2.
> $$
>
> For the bound, apply Taylor's Inequality with $n = 2$ and
> $f'''(x) = \tfrac{10}{27}x^{-8/3}$. On $x \ge 7$ this derivative is largest at
> $x = 7$, so $|f'''(x)| \le \tfrac{10}{27}\cdot 7^{-8/3} < 0.0021$; with
> $|x - 8| \le 1$,
>
> $$
> |R_2(x)| \le \frac{0.0021}{3!}\,(1)^3 < 0.0004.
> $$
>
> The approximation is accurate to within $0.0004$ across the whole interval.

> **Worked example.** Estimate $\sin 12^\circ$ using the first three terms of the
> sine series, and bound the error.
>
> The Maclaurin series for $\sin x$ is alternating, so the
> [Alternating Series Estimation](/calculus/sequences-and-series/the-convergence-tests)
> caps the error of $\sin x \approx x - x^3/3! + x^5/5!$ at the next term
> $|x|^7/7!$. Convert to radians, $x = \pi/15$:
>
> $$
> \sin\frac{\pi}{15} \approx \frac{\pi}{15}
> - \frac{1}{3!}\Big(\frac{\pi}{15}\Big)^3
> + \frac{1}{5!}\Big(\frac{\pi}{15}\Big)^5 \approx 0.207912.
> $$
>
> The error is below $(\pi/15)^7/5040 \approx 4 \times 10^{-8}$, so every
> displayed digit is correct.

## Integrals and limits from series

A Maclaurin series turns two otherwise hard computations into arithmetic on a
convergent series: integrating a function with no elementary antiderivative, and
evaluating an indeterminate limit without repeated l'Hospital differentiation.

$$
% caption: The area $\int_0^1 e^{-x^2}\,\mathbf{d}x$ (shaded) has no elementary
% antiderivative; expanding $e^{-x^2}$ as a series and integrating term by term
% evaluates it to $0.7475$ with error below $0.001$.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-0.3,0) -- (3.6,0) node[anchor=north east] {$x$};
\draw[black, ->] (0,-0.3) -- (0,2.7) node[anchor=north east] {$y$};
\fill[acc!14] (0,0) -- plot[domain=0:2.4, samples=60] (\x, {2.4*exp(-(\x/2.4)*(\x/2.4))}) -- (2.4,0) -- cycle;
\draw[black!75, very thick] plot[domain=0:3.2, samples=80] (\x, {2.4*exp(-(\x/2.4)*(\x/2.4))});
\node[black!75, anchor=west] at (1.7,1.55) {Gaussian};
\draw[black] (2.4,0.12) -- (2.4,-0.12);
\node[anchor=north] at (2.4,-0.1) {$1$};
\node[acc, anchor=south, font=\scriptsize] at (1.05,0.2) {area};
\end{tikzpicture}
$$

> **Worked example.** Evaluate $\displaystyle\int_0^1 e^{-x^2}\,\d x$ as a series
> and approximate it to three decimals.
>
> Substitute $-x^2$ into the exponential series: $e^{-x^2} = \sum (-1)^n
> x^{2n}/n!$. This converges for all $x$, so it integrates term by term:
>
> $$
> \int e^{-x^2}\,\d x = C + \sum_{n=0}^{\infty} \frac{(-1)^n\,x^{2n+1}}{(2n+1)\,n!}
> = C + x - \frac{x^3}{3} + \frac{x^5}{10} - \frac{x^7}{42} + \cdots.
> $$
>
> Taking $C = 0$ and evaluating from $0$ to $1$ leaves an alternating numerical
> series:
>
> $$
> \int_0^1 e^{-x^2}\,\d x = 1 - \frac{1}{3} + \frac{1}{10} - \frac{1}{42}
> + \frac{1}{216} - \cdots \approx 0.7475.
> $$
>
> The first omitted term $1/(11\cdot 5!) = 1/1320 < 0.001$ bounds the error, so
> the estimate is good to three decimals.

> **Worked example.** Evaluate $\displaystyle\lim_{x\to 0} \frac{e^x - 1 - x}{x^2}$.
>
> Expand the numerator with the exponential series and cancel the two leading
> terms:
>
> $$
> e^x - 1 - x = \Big(1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots\Big) - 1 - x
> = \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots.
> $$
>
> Dividing by $x^2$ leaves $\tfrac{1}{2!} + \tfrac{x}{3!} + \tfrac{x^2}{4!} +
> \cdots$, and every term past the first carries a factor of $x$. As $x \to 0$
> the limit is the constant term:
>
> $$
> \lim_{x\to 0} \frac{e^x - 1 - x}{x^2} = \frac{1}{2!} = \frac{1}{2}.
> $$

## The Newtonian limit of relativistic energy

Taylor polynomials formalize the physicist's habit of keeping only the leading
correction. In special relativity the kinetic energy of a mass $m$ moving at
speed $v$ is

$$
K = mc^2\left(\frac{1}{\sqrt{1 - v^2/c^2}} - 1\right).
$$

Expanding $(1 - v^2/c^2)^{-1/2}$ by the binomial series and keeping terms through
$(v/c)^2$,

$$
K = mc^2\Big(\tfrac{1}{2}\frac{v^2}{c^2} + \tfrac{3}{8}\frac{v^4}{c^4} + \cdots\Big)
= \tfrac{1}{2}mv^2 + \tfrac{3}{8}\frac{mv^4}{c^2} + \cdots.
$$

At speeds small compared with $c$ the higher terms are negligible and the
relativistic energy reduces to the Newtonian $\tfrac{1}{2}mv^2$. The Taylor
series makes precise the sense in which one theory contains another as a
low-order approximation, and quantifies the correction the next term supplies.

$$
% caption: Relativistic kinetic energy (dark) against the Newtonian
% $\tfrac12 mv^2$ (light) as functions of speed. The two agree closely at low
% speed, where the leading Taylor term dominates, and separate as $v$ approaches
% the speed of light, where the energy grows without bound.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (0,0) -- (5.7,0) node[anchor=north] {$v$};
\draw[black, ->] (0,0) -- (0,3.5) node[anchor=east] {$K$};
\draw[black, dashed] (5,0) -- (5,3.3);
\node[black, anchor=south, font=\scriptsize] at (5,3.3) {$v = c$};
% relativistic K/(mc^2) scaled: v in units where c -> x=5, so beta = x/5
\draw[acc, very thick] plot[domain=0:4.55, samples=90] (\x, {2.2*(1/sqrt(1 - (\x/5)*(\x/5)) - 1)});
\node[acc, anchor=east] at (4.35,3.05) {relativistic};
% Newtonian 1/2 m v^2 scaled
\draw[black, thick] plot[domain=0:5, samples=60] (\x, {2.2*0.5*(\x/5)*(\x/5)});
\node[black, anchor=west] at (5.1,1.1) {Newtonian};
\end{tikzpicture}
$$
