# Taylor Series

A Taylor Series is an expansion of some function into an infinite sum of terms. It was discovered by James Gregory, a Scottish mathematician, and was formally introduced by Brook Taylor, an English mathematician, way back in 1715. This series is used in various fields such as chemistry, physics, high-level mathematics, calculus, and computer science.

### Taylor Series Expansion

The Taylor Series expansion works on the idea that every smooth function can be re-written into an infinite number of polynomial terms.

Write down a general nth-degree polynomial. Here it is:

f(x) = a0 + a1 (x - c) + a2 (x - c)2 + a3 (x - c)3 +...

Where a0, a1, … are coefficients on each polynomial term, c is a constant that represents where on the x-axis to start the approximation.

This series can be written in closed-form as:

f (x) =  $\sum_{j=0}^{\infty} a_{j} (x-c)^{j}$

Find the first few derivatives of the polynomial above,

f' (x) = a1 + 2a2 (x - c) + 3a3 (x - c)2  + 4a4 (x - c)3 +...

f" (x) = 2a2 + 6a3 (x - c) + 12a4 (x - c)2+ 20a5 (x - c)3

f"' (x) = 6a3 + 24a4 (x - c)+ 60a5 (x - c)2 + 120a6 (x - c)3

We see a pattern above, which we’ll use later. Now that we have n derivatives of f, we will evaluate them for some number that will cause most of their terms to drop away.

This is the key step.

f(c) = a0 = a00!

f'(c) = a1 = a1 1!

f"(c) = 2a2 = a2 2!

f"'(c) = 3.2a3 = a3 3!

f""(c) = 4.3.2a4 = a44!

Divide both sides with (n!). This results in:

a0 = $\frac{f(c)}{0!}$

a1 = $\frac{f'(c)}{1!}$

a2 = $\frac{{f}''(c)}{2!}$

a3 = $\frac{{f}'''(c)}{3!}$

a4 = $\frac{{f}''''(c)}{4!}$

Now use this information and complete the expression in the beginning

f (x) = a0 + a1 (x - c) + a2 (x - c)2 + a3 (x - c)3 +...

f (x) = $\frac{f(c)}{0!}$ + $\frac{f'(c)}{1!}$(x - c) + $\frac{{f}''(c)}{2!}$$(x-c)^{2}$ + $\frac{{f}'''(c)}{3!}$$(x-c)^{3}$ + …

The above equation gives a polynomial expansion for smooth function f. First, calculate the n derivatives of f, evaluate them at c, divide each derivative by n! and find the sum of the terms. The result will be an approximation to the original function. More terms added would only help to get a more accurate approximation.

Taylor Series Formula

The result to the above expansion would be:

f(x) = $\sum_{j=0}^{\infty} \frac{f^{j}(c)}{j!} (x-c)^{j}$.

The Taylor Series formula is a powerful tool for approximating functions that can be difficult to compute and help in evaluating infinite sums and integrals using the series.

### Proof of Taylor’s Series Theorem

Suppose f : (a, b) → R is a function on (a, b), where a, b ∈ R with a < b. Assume the same for a positive integer n, f is n-times differentiable on the open interval (a, b), and that f, f’ , f’’, . . . , f(n−1) extend continuously to the closed interval [a, b] (the extended functions will still be called f, f0 , f00, . . . , f(n−1) respectively). Then there exists c ∈ (a, b) such that

f(b) = nX−1 k=0 f (k) (a) k! (b − a) k + f (n) (c) n! (b − a) n .

An important observation is that, when n = 1, this reduces to the ordinary mean-value theorem. This suggests that we may modify the proof of the mean value theorem, to give a proof of Taylor’s theorem.

The proof of the mean-value theorem is in two parts: first, by subtracting a linear (i.e., degree 1) polynomial, we reduce to the case where f(a) = f(b) = 0.

### Taylor Series Solved Examples

The examples below will help us in gaining a better understanding of the Taylor Series:

Example 1: Ex2

f(x) = ex                            f(0) = 1

f(n) (x) = ex                         f(n) (0) = 1

It follows that, for |x| < 1, we have

ex =1+ x + x2/2 + x3/3! + ··· + xn /n! + ···

Example 2:  log(1 + x)

f(x) = log(1 + x)                    f(0) = 0

f’ (x) = 1 /1 + x                      f’ (0) = 1

f’’(x) = −1 /(1 + x)²               f’’(0) = −1

f’’’(x) = 2 /(1 + x)³                f’’’(0) = 2

f’’’’(x) = −2.3/ (1 + x)⁴           f’’’’(0) = −6

It follows that, for |x| < 1—which is the necessary and sufficient condition for the convergence of the series—we have

log(1 + x) = x − x2/2 + x3/3   − x4 /4  + ··· .

Example 3: cos x

f(x) = cos x                           f(0) = 1

f’ (x) = − sin x                       f’ (0) = 0

f’’(x) = − cos x                      f’’(0) = −1

f’’’(x) = sin x                         f’’’(0) = 0

f(4)(x) = cos x                       f(4)(0) = 1

It follows that, for |x| < 1, we have

cos x = 1 − x2/2!  + x4/4! − x6/6! + ···

Question 1: What are the First Four Terms of the Taylor Series for ex When a=0?

Answer: ex = 1 + x + 1/2x² + 1/6x³ +…..

f(x) = ex

f’(x) = ex

f’’(x) = ex

f’’’(x) = ex

Substitute a=0 into:

F(x) = f(a) + (f'(a))/1!  (x-a) + (f''(a))/2!  (x-a)2 + (f'''(a))/3!  (x-a)3 + ….

→ ex = e0 + e0/1!  (x-0)  + e0/2!  (x-0)2 + e0/3!  (x-0)3 + …

→ ex = 1 + 1(x-0) + 1/2  (x-0)2 + 1/6(x-0)3 + ….

→ ex = 1 + x + 1/2x² + 1/3 x³ + ….

Question 2: How is Taylor Series Related to Maclaurin Series

Answer: If a function f(x) has continuous derivatives up to (n+1)th order, then this function can be expanded in the following way:

f(x)=∞∑n=0 f(n)(a) (x−a)n/n! = f(a) + f′(a)(x−a)+f′′(a)(x−a)2 /2!+…+f(n)(a)(x−a)n /n!+Rn

where Rn, called the remainder after n+1 term, is given by

Rn=f(n+1) (ξ)(x−a)n+1/(n+1)! a<ξ<x.

When this expansion converges over a certain range of x, that is, limn→∞R n=0, then the expansion is called Taylor Series of f(x) expanded about a.

If a=0, the series is called Maclaurin Series:

f(x)=∞∑n=0 f(n) (0) xn/n! = f(0) +f′(0) x + f′′(0)x2/2!+…+f(n)(0)xn /n!+Rn.