Home > Algebra, Calculus > Taylor Series with example cos(x)

Taylor Series with example cos(x)

October 13th, 2009

The Taylor series is the general case of the Maclaurin Series for calculating the value of a function. It enables you calculate the value of a function at any point if you can find the value of the function and and all its derivatives at any point. This is done as a power series. The series is as follows:

f(x) = \sum^{\infty}_{n=0}  \frac{f^{(n)}(x-a)^n}{n!} = f(a) + \frac{f^{(1)}(a)(x-a)}{1} + \frac{f^{(2)}(a)(x-a)^2}{2!} + \frac{f^{(3)}(a)(x-a)^3}{3!} +

The series is said to be taken about a meaning we calculate the derivatives of the function at the point a and then from these we find the value of the function. Because the series is infinite we can never find the value of the function exactly but we can give it to any required degree of accuracy by taking the first i terms of the series. The Maclaurin Series is just the Taylor series about 0.

Example cos(x)

An example of the Taylor series is to find a power series for cos(x). We can choose to do this about any value of a so in this example we will use a = \frac{\pi}{2} . In this example we will look at the first 2 no zero terms.

The first we need to find the value of the derivatives and the function at pi/2.
The first one is:
cos(\frac{\pi}{2}) = 0

We now need to differentiate the function to get:
\frac{d}{dx} cos(x) = -sin(x)
and then take its value at \frac{\pi}{2} which is:
-sin({\pi}{2}) = -1

Similarly for the second term we differentiate again to find the second derivative is:
\frac{d}{dx} (-sin(x)) = -cos(x)
so at pi/2 this is
-cos(\frac{\pi}{2}) = 0

Since the last term was zero we need to find the next one which is:
\frac{d}{dx} (-cos(x)) = sin(x)
so sin(\frac{\pi}{2}) = 1

Now we have found all the values of the function and its derivative we need for the level of accuracy required we can simply put these values into the series to get

cos(x) = 0 + (-1)(x-\frac{\pi}{2}) + \frac{0(x-\frac{\pi}{2})^2}{2!} + \frac{1(x-\frac{\pi}{2})^3}{3!} +
cos(x) = -(x-\frac{\pi}{2})  + \frac{(x-\frac{\pi}{2})^3}{3!} -

To test this we can try x = \frac{\pi}{3}
cos(\frac{\pi}{3}) = -(\frac{\pi}{3}-\frac{\pi}{2})  + \frac{(\frac{\pi}{3}-\frac{\pi}{2})^3}{3!} -
cos(\frac{\pi}{3}) = 0.49967
which is close to the 1/2 it really is.

Comments Left

  1. Taylor series
    October 28th, 2009 at 12:48 | #1

    Equation: for cos x