# 1. Taylor Series

By M. Bourne

Our aim is to find a polynomial that gives us a good approximation to some function. (See why we want to do this in the Introduction.)

We find the desired polynomial approximation using the **Taylor Series**.

If we want a good approximation to the function in the region near `x = a`, we need to find the first, second, third (and so on) derivatives of the function and substitute the value of* a.* Then we need to multiply those values by corresponding powers of `(x − a)`, giving us the **Taylor Series expansion** of the function `f(x)` about `x = a`:

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

### Getting Lost?

See some background to why this sum converges to a polynomial in Infinite Geometric Series from an earlier chapter.

We can write this more conveniently using summation notation as:

`f(x)~~sum_(n=0)^oo(f^((n))(a))/(n!)(x-a)^n`

### Conditions

In order to find such a series, some conditions have to be in place:

- The function `f(x)` has to be
**infinitely differentiable**(that is, we can find each of the first derivative, second derivative, third derivative, and so on forever). - The function `f(x)` has to be defined in a region near the value `x = a`.

Let's see what a Taylor Series is all about with an example.

### Example - Expansion of ln *x*

Find the Taylor Expansion of `f(x) = ln x` near `x = 10`.

Answer

Recall the natural logarithm, `ln x`. Recall also the graph of *y* = ln *x*:

Graph of `f(x)=ln(x)`.

Our aim is to find a good polynomal approximation to the curve in the region near *x* = 10.

We need to use the Taylor Series with *a* = 10.

The first term in the Taylor Series is *f*(*a*). In this example,

`f(a)` ` = f(10) = ln 10 = 2. 302\ 585\ 093.`

Now for the derivatives.

Recall the derivative of ln *x*, which is `1/x`. So

`f'(x)=1/x`

We need `f'(10)`, which is `1/10 = 0.1`.

Now for the second derivative:

`f''(x)=-1/x^2`

At `x = 10`, this has value `-0.01`.

`f'''(x)=2/x^3`

The third derivative at `x = 10` has value `0.002`.

`f^("iv")(x)=-6/x^4`

At `x = 10`, this has value `-0.0006`.

You can see that we could continue forever. This function is infinitely differentiable.

Now to substitute these values into the Taylor Series:

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

We have:

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

`~~2.302585093+0.1(x-10)` `+(-0.01)/(2!)(x-10)^2` `+(2xx0.001)/(3!)(x-10)^3` `+(-6xx0.0001)/(4!)(x-10)^4+...`

Expanding this all out and collecting like terms, we obtain the polynomial which approximates `ln x`:

`ln x ~~ 0.21925 ` `+ 0.4x` ` − 0.03x^2 ` `+ 0.00133x^3` ` − 0.000025x^4+ ...`

This is the approximating polynomial that we were looking for.

We see from the graph that our polynomial (in grey) is a good approximation for the graph of the natural logarithm function (in green) in the region near `x = 10`.

Graph of the approximating polynomial, and `f(x)=ln(x)`.

Notice that the graph is not so good as we get further away from `x = 10`. The regions near `x = 0` and `x = 20` are showing some divergence.

Let's zoom out some more and observe what happens with the approximation:

Graph of the approximating polynomial, and `f(x)=ln(x)`, zoomed further out.

Clearly, it is no longer a good approximation for values of *x* less than 3 or greater than 20. How do we get a better approximation? We would need to take more terms of the polynomial.

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

Next, we move on to the Maclaurin Series, which is a special case of the Taylor Series (and easier :-).