# Taylor series

914pages 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.

## DefinitionEdit

The Taylor series of a function is defined as

$f(x)=\sum_{k=0}^{\infty}\frac{f^{(k)}(a)}{k!}(x-a)^{k}$

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

$f(x)=\sum_{k=0}^{\infty}C_{k}(x-a)^{k}$

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

$\displaystyle f^{(k)}(x)=C_{k}k!$

Then, it easily follows that the coefficient C is

$C_{k}=\frac{f^{(k)}(x)}{k!}$

Setting x=a gives

$C_{k}=\frac{f^{(k)}(a)}{k!}$

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.

## ExamplesEdit

### Taylor series for the exponential functionEdit

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

$\exp(x)=e^{x}=\sum_{k=0}^{\infty}\frac{x^{k}}{k!}$

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

$e = e^{1}=\sum_{k=0}^{\infty}\frac{1}{k!} = 1 + 1 + \frac{1}{2} + \frac{1}{6} + \frac{1}{24}...$

### Taylor series for sine and cosineEdit

We know that $\textstyle \sin''(x) = -\sin(x)$, 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

$\sin(x)=\sum_{k=0}^{\infty}(-1)^{k}\frac{x^{2k+1}}{(2k+1)!}$

We also know that $\textstyle \cos''(x) = -\cos(x)$, 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

$\cos(x)=\sum_{k=0}^{\infty}(-1)^{k}\frac{x^{2k}}{(2k)!}$

### Taylor series for the inverse tangentEdit

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

## Partial sumsEdit

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

$\frac{\pi}{4}-\frac{\pi^{3}}{4^{3}.3!}+\frac{\pi^{5}}{4^{5}.5!}-\frac{\pi^{7}}{4^{7}.7!}$

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 $\textstyle\frac{\pi^{9}}{4^{9}.9!}$, which is indeed a very small value.

## A sample computer algorithmEdit

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:

$\frac{x^{k+1}}{(k+1)!}3^{x}$

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

## An upper bound for the errorEdit

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

$\frac{f^{(k+1)}(b)}{(k+1)!}(x-a)^{k+1}$

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