# Taylor series

*971*pages on

this wiki

**Taylor series** are a type of power series that are often employed by computers and calculators to approximate transcendental functions. They are used to convert these functions into infinite sums that are easier to analyze. The partial sums of the Taylor series are called Taylor polynomials, and they are classified by degree (the greatest power of X appearing in them). Functions that are equal to its own Taylor series must be analytic or holomorphic.

## Definition

The Taylor series of a function is defined as

where a is some arbitrary constant. This definition holds for holomorphic functions and holomorphic functions only. The proof of it is as follows:

**Proof. **Let's assume that a function has a power series expansion and it is written as

for some coefficient C that depends on k and some arbitrary constant a. Then, assuming that the function is holomorphic over its domain (infinitely differentiable), we obtain

Then, it easily follows that the coefficient C is

Setting x=a gives

which completes the proof.

a is the constant that the Taylor polynomial approximations will be centered about. When a=0, the Taylor series are also called Maclaurin series.

## Examples

### Taylor series for the exponential function

Since we know exp'(x) = exp(x), we take a as 0 and easily obtain that

This can be used to find a numerical approximation for *e*.

### Taylor series for sine and cosine

We know that , so each four differentiations, we return to the beginning. The first four derivatives evaluated at a=0 of sine is 0,1,0,-1 respectively. Only odd derivatives are of significance, so we drop out the even terms and obtain the Taylor series

We also know that , and the cycle is the same as above. The first four derivatives at a=0 are 1,0,-1,0. Only even derivatives are of significance, so we drop out the odd terms and obtain the Taylor series

### Taylor series for the inverse tangent

This result is already derived here, so it is not necessary to repeat the process.

## Partial sums

Partial sums of Taylor series, the Taylor polynomials, are often very good approximations for functions with even a small number of terms summed. We can often see this applying the d'Alembert test for convergence, which only works if the series converge asymptotically as the geometric series. Of course, there are some cases where the series aren't such good approximations; such as the inverse tangent.

As an example, we will try to find the sine of 45 degrees, so pi over 4 radians. We know this value is 1/√2, which is approximately 0,7071. If we evaluate a Taylor polynomial of degree 7 for sine, we will get 0,7071. You can try this with a computer program. Simply, the sum you will want to evaluate is

This is no different than typing sin(pi/4) with a calculator because this is how calculators find the value of sine (with better degrees for polynomials of course.)

An upper bound for the error of our approximation can be given by , which is indeed a very small value.

## A sample computer algorithm

This computer algorithm uses the Taylor polynomials to approximate the exponential function and is written in C++.

```
int factorial(int i) {
if (i <= 1)
return i;
return (i * factorial(i - 1));
}
float exp(float num, int degree)
{
int i = 0;
float s = 0;
while (i<=degree) {
s = s + (pow(num,i)/factorial(i));
i++;
}
return s;
}
```

An upper bound for the error in this approximation can be found with some calculations:

where k is the degree of the Taylor polynomial and x is the unknown of the function.

## An upper bound for the error

In general, for any Taylor polynomial of degree k, the error is at most

where b is some real constant between a and x. This statement is Taylor's theorem.