# Taylor series

*1,010*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 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 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 that depends on k and some arbitrary constant . Then, assuming that the function is holomorphic over its domain (infinitely differentiable), we obtain

Then, it easily follows that the coefficient is

Setting gives

which completes the proof.

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

## Examples

### Taylor series for the exponential function

Since we know , we take a as 0 and easily obtain that

This can be used to find a numerical approximation for .

### 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 , 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 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 is the degree of the Taylor polynomial and is the unknown of the function.

## An upper bound for the error

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

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