# 2. Maclaurin Series

By M. Bourne

In the last section, we learned about Taylor Series, where we found an approximating polynomial for a particular function in the region near some value x = a.

We now take a particular case of Taylor Series, in the region near `x = 0`. Such a polynomial is called the **Maclaurin Series**.

The infinite series expansion for `f(x)` about `x = 0` becomes:

`f(x)~~f(0)+f’(0)x` `+(f’’(0))/(2!)x^2` `+(f’’’(0))/(3!)x^3` `+(f^("iv")(0))/(4!)x^4` `+...`

`f’(0)` is the first derivative evaluated at `x = 0`, `f’’(0)` is the second derivative evaluated at `x = 0`, and so on.

[**Note: **Some textbooks call the series on this page "Taylor Series" (which they are, too), or "series expansion" or "power series".]

### Example 1: Expanding sin *x*

Find the Maclaurin Series expansion for `f(x) = sin x`.

Answer

We need to find the first, second, third, etc derivatives and evaluate them at *x* = 0. Starting with:

f(x) = sinx

f(0) = 0

First dervative:

f'(x) = cosx

f'(0) = cos 0 = 1

Second dervative:

f''(x) = −sinx

f''(0) = −sin 0 = 0

Third dervative:

f'''(x) = −cosx

f'''(0) = −cos 0 = −1

Fourth dervative:

f^{ iv}(x) = sinx

f^{ iv}(0) = sin 0 = 0

We observe that this pattern will continue forever.

Now to substitute the values of these derivatives into the Maclaurin Series:

`f(x)` `~~f(0)+f’(0)x` `+(f’’(0))/(2!)x^2` `+(f’’’(0))/(3!)x^3` `+(f^("iv")(0))/(4!)x^4+...`

We have:

`sin\ x=0+(1)(x)` `+0` `+(-1)/(3!)x^3` `+0` `+1/(5!)x^5` `+0` `+(-1)/(7!)x^7+...`

This gives us:

`sin\ x=x-1/6x^3+1/120x^5` `-1/5040x^7+...`

We plot our answer

`f(x)=x-1/6x^3` `+1/120x^5` `-1/5040x^7+...`

to see if the polynomial is a good approximation to `f(x) = sin x`.

Graph of the approximating Maclaurin Series polynomial, and the original `f(x)=sin(x)`.

We observe that our polynomial (in grey) is a good approximation to `f(x) = sin x` (in green) near `x = 0`. In fact, it is quite good between -π ≤ *x* ≤ π.

Don't miss the Taylor and Maclaurin Series interactive applet where you can explore this concept and the other examples on this page further.

### Example 2: Expanding `e^x`

Find the Maclaurin Series expansion of `f(x) = e^x`.

Answer

Recall that the derivative of the exponential function is `f^'(x) = e^x`. In fact, all the derivatives are `e^x`.

*f* '(0) = *e*^{0} = 1

*f* ''(0) = *e*^{0} = 1

*f* '''(0) = *e*^{0} = 1

We see that all the derivatives, when evaluated at *x* = 0, give us the value 1.

Also, `f(0) = 1`, so we can conclude the Maclaurin Series expansion will be simply:

`e^x~~1+x+1/2x^2` `+1/6x^3` `+1/24x^4` `+1/120x^5+...`

Here's a graph of the answer we just obtained, and the original `f(x) = e^x` graph:

Graph of the approximating Maclaurin Series polynomial, and the original `f(x)=e^x`.

We can see the approximation is very close to the original `f(x)=e^x` in the region `-2 < x < 2.5`.

## Exercise

Find the Maclaurin Series expansion of `cos x`.

Answer

f(x) = cosx

f(0) = 1

First dervative:

f'(x) = −sinx

f'(0) = −sin 0 = 0

Second dervative:

f''(x) = −cosx

f''(0) = −cos 0 =-1

Third dervative:

f'''(x) = sinx

f'''(0) = sin 0 = 0

Fourth dervative:

f^{ iv}(x) = cosx

f^{ iv}(0) = cos 0 = 1

When substituting these values into the expansion formula, we obtain:

`cos x=1-1/2x^2` `+1/24x^4` `-1/720x^6` `+1/40320x^8-...`

Here's a graph showing the answer we just obtained, and the original `f(x) = cos(x)` graph:

Graph of the approximating Maclaurin Series polynomial, and the original `f(x)=cos(x)`.

Once again, we observe that our polynomial (in grey) is a good approximation to `f(x) = cos x` (in green) between -π ≤ *x* ≤ π.

## Finding Pi Using Infinite Series

### Example 3

In the 17th century, Leibniz used the series expansion of arctan *x* to find an approximation of π.

We start with the first derivative:

`d/(dx)arctan\ x=1/(1+x^2)`

The value of this derivative when `x = 0` is `1`. That is, `f’(0)=1`.

Similarly for the subsequent derivatives:

`d^2/(dx^2)arctan\ x=-(2x)/((1+x^2)^2`

`f’’(0)=0`

`d^3/(dx^3)arctan\ x=2(3x^2-1)/((1+x^2)^3`

`f’’’(0)=-2`

`d^4/(dx^4)arctan\ x=-24x(x^2-1)/((1+x^2)^4`

`f^("iv")(0)=0`

`d^5/(dx^5)arctan\ x=24(5x^4-10x^2+1)/((1+x^2)^5`

`f^("v")(0)=24`

Now we can substitute into the Maclaurin Series formula:

`arctan\ x ~~0+(1)x+0/2x^2-2/(3!)x^3` `+0/(4!)x^4+24/(5!)x^5+...`

`=x-x^3/3+x^5/5-x^7/7+...`

Considering that (see the 45-45 triangle)

`arctan 1=pi/4`

we can substitute `x = 1` into the above expression and get the following expansion for π

`pi=4(1-1/3+1/5-1/7+...)`

All very well, but it was not a good way to find the value of π because this expansion converges very slowly.

Even after adding 1000 terms, we don't have 3 decimal place accuracy.

`4sum_(n=0)^1000((-1)^n)/(2n+1)=3.142\ 591\ 654...`

(We noe know that π = 3.141 592 653 5..., and we know many other more efficient ways to find `pi`.)

Here's the graph of *y* = arctan *x* (in green) compared to the polynomial we just found (in grey).

Graph of the approximating Maclaurin Series polynomial, and the original `f(x)=arctan(x)`.

### Example 4

Let's now find the value of `pi` using the same expansion, but this time we substitute `x=1/sqrt(3)`. We'll use the fact `tan (pi/6) = 1/sqrt(3)`.

Now `arctan\ x ~~x-x^3/3+x^5/5-x^7/7+...`

` ~~1/sqrt(3)-(1/sqrt(3))^3/3+(1/sqrt(3))^5/5-(1/sqrt(3))^7/7` `+...`

The value of `pi` will be `6` times the above value.

Using this expansion, we only need to use 18 steps to get 10 decimal place accuracy for `pi`. That is:

`6sum_(n=0)^18((-1)^n)(1//sqrt(3))^(2n+1)/(2n+1)` `=6 xx 0.523\ 598\ 775\ 61` `=3.141\ 592\ 653\ 6...`

#### Why is it so much more accurate here?

The approximating curve in this case has what's called a **radius of convergence** (limited domain) where it "works" (that is, converges). Outside that domain, the approximation diverges.

We'll see another example of this situation in the Taylor and Maclaurin Series interactive applet.