Taylor Series
Taylor Series
Taylor Series
f ( x ) ≈ f (a ) + f (a )( x − a )
f(x)
✻
✲
x
For example, we can approximate the value of sin ( x ) for values of x near zero, using the fact that we
know sin 0 = 0, the derivative of dx
d
sin ( x ) = cos ( x ) and cos (0 ) = 1
16
Chapter 4: Taylor Series 17
same derivative at that point a and also the same second derivative there. We do both at once and define the
second degree Taylor Polynomial for f ( x ) near the point x = a.
f (a )
f ( x ) ≈ P2 ( x ) = f (a ) + f (a )( x − a ) +( x − a )2
2
Check that P2 ( x ) has the same first and second derivative that f ( x ) does at the point x = a.
f (a ) f (a ) f ( 4 ) (a ) f (n ) (a )( x − a )n
f (a ) + f (a )( x − a ) + ( x − a )2 + ( x − a )3 + ( x − a )4 + · · · +
2 3∗2 4∗3∗2 n (n − 1 )(n − 2 ) · · · 3 ∗ 2
The terms in the denominators may be a bit surprising at first. In class we will calculate the first through
nth derivatives of f ( x ) and its Taylor Polynomial Pn ( x ) to see that they (the derivatives) are the same.
Returning to our example, the second degree Taylor Polynomial for sin x near 0 is
sin 0
P2 ( x ) = sin 0 + cos 0 ( x − 0 ) − ( x − 0 )2 = 0 + 1 ( x ) + 0
2
It is rather disappointing that this turns out to be no different from P1 for sin x. The third degree Taylor
Polynomial for sin x near 0 is
sin 0 cos x 0 1 3
P3 ( x ) = sin 0 + cos 0 ( x − 0 ) − ( x − 0 )2 − ( x − 0 )3 = 0 + 1 ( x ) − x 2 − x
2 3∗2 2 3∗2
Check the value of P3 (.02 ) compared to what your calculator gives you for sin .02.
4.4 Notation
It is helpful to introduce some notation at this point. We have already introduced a new notation for higher
order derivatives. That is, we are using the symbol f (i ) (a ) to mean the ith derivative of the f ( x ) evaluated
at the point a. The factorial notation
n! = n (n − 1 )(n − 2 ) · · · 3 ∗ 2 ∗ 1
is useful for the denominators of each term in the Taylor Polynomial. The summation notation, shown
below, lets us write the Taylor Polynomial more succinctly.
5
g (i ) = g ( 1 ) + g ( 2 ) + g ( 3 ) + g ( 4 ) + g ( 5 )
i =1
Using these notations we write the nth degree Taylor Polynomial for f ( x ) near 0 as:
n
f (i ) ( 0 )
f ( x ) ≈ Pn ( x ) = ( x − 0 )i
i =0
i!
Chapter 4: Taylor Series 18
x2 x3 x8
e x ≈ P8 = 1 + x + + + ··· +
2! 3! 8!
The nth Taylor Polynomial for sin x for x near a = 0. First calculate the derivatives of sin x! You should
find a pattern that makes this easy.
derivative at x = 0
f (x ) = sin x is 0
f (x ) = cos x is 1
f ( x ) =
f (3 ) ( x ) =
f (4 ) ( x ) =
f (5 ) ( x ) =
f (6 ) ( x ) =
Now put it together:
0 −1 0 1
sin x ≈ Pn ( x ) = 0 + x + ∗ x2 + ∗ x3 + ∗ x4 + ∗ x5 + · · ·
2 3! 4! 5!
The nth Taylor Polynomial for cos x for x near a = 0: First calculate the derivatives, again, you should find
a pattern that makes this easy.
derivative at x = 0
f (x ) = cos x is 1
f (x ) = − sin x is 0
f ( x ) =
f (3 ) ( x ) =
f (4 ) ( x ) =
f (5 ) ( x ) =
f (6 ) ( x ) =
Now put it together:
cos x ≈ Pn ( x ) =
x2 x3 xn ∞
xi
1+x+ + + ··· + ··· =
2! 3! n! i =0
i!
As another example we calculate the Taylor Series of x1 . Most of the examples we have seen so far have
been Taylor Series centered at x = 0. This is not always a good value of a to pick. In this example, it is not
even a possibility! (Why???)
We instead find the Taylor Series of f ( x ) = x1 centered at x = 1. As always, we first calculate the deriva-
tives.
f ( x ) = (−1 ) x −2
f ( x ) = (+2 ) x −3
f ( x ) = (−3 ∗ 2 ) x −4
The Taylor Series is then:
2 −3 ∗ 2
P ( x ) = 1 − 1 ( x − 1 ) + ( x − 1 )2 + ( x − 1 )3 + · · ·
2 3∗2
= 1 − ( x − 1 ) + ( x − 1 )2 − ( x − 1 )3 + ( x − 1 )4 − · · ·
Be sure you understand what the next several terms would like for this example and for others we have
seen.
E = f ( x ) − Pn ( x )
If E > 0 that means that our approximation is bigger than the true value. If E < 0 then our approximation
is too large. Often we are only interested (or can only find) the magnitude of the error |E |.
It turns out that there is a simple formula which gives us a bound on the size of the error E. Again, this
is only a bound on the size of the error and does not tell us the exact error (why??). This bound is called the
remainder formula and is: (n +1 )
f ( c )
| R n | = ( x − a )
n + 1
(n + 1 )!
where c is between a and x.
This formula looks pretty similar to the next term of the Taylor Polynomial itself. The only difference is
the c sitting in it. This stands for some value between a and x AND WE DON’T KNOW WHICH!
You are probably worrying how on earth we can use this formula to get actual numbers if we don’t know
what c is. Good question. What we need to do is look at all the values of f (n +1 ) (c ) (for all a < c < x) and
use the largest of them. Or, pick something that we know is surely larger than all of them.
Example 1: Give a bound on the error for when e .5 is approximated by the fourth degree Taylor Polynomial
of e x centered at 0.
Chapter 4: Taylor Series 20
The fifth derivative of e x is again e x . We don’t know what that is, but we do know that that e x is an
increasing function between 0 ≤ x ≤ .5. So,
√ √
| f (5 ) ( x )| ≤ |e .5 | = e < 3 < 2
Thus the error can be bounded:
(5 )
f (c ) 2
| f (.5 ) − Pn (.5 )| ≤ | R 4 | = 5
(x − 0 ) = x 5
( 5 )! 5!
So if we approximate e .5 by P4 (.5 ) = 1 + (.5 ) + (.5 )2 /2 + (.5 )3 /3! + (.5 )4 /4! our approximation will
2
be within 120 (.5 )5 < .0006 of the true value.
Example 2: If we take the 5th Taylor Polynomial of cos ( x ) centered at a = π, how big can the error be? The
sixth derivative of cos ( x ) is − sin ( x ). We don’t know exactly what that is, since it will depend on x, but we
know that no matter what, it will be that −1 ≤ − sin ( x ) ≤ 1.
Thus the error can be bounded:
(6 )
f (c ) 1
| f ( x ) − Pn ( x )| ≤ | R 5 | = 6
( x − π) = ( x − π)6
( 6 )! 6!
So if we approximate cos (3 ) by the 5th Taylor Polynomial centered at π then we will have an error of at
1
most 720 (π − 3 )5 < .000000001119.
If we approximate cos (1 ) by the 5th Taylor Polynomial centered at π then we will have an error of at
1
most 720 (π − 1 )5 < .003. Note that this is much worse!
Exercise 4.7. In this problem, we estimate the value of sin (3 ) using different Taylor Polynomials. All angles
are given in Radians!!
(a) Calculate the value of sin (3 ) using the a seventh degree Taylor Polynomial centered at x = 0.
(b) Calculate the value of sin (3 ) using a seventh degree Taylor Polynomial centered at x = π.
(c) Compare your answers with the answer your calculator gives you.
(d) Use the error formula, R n , given in this handout to find a bound on the accuracy of your answers in
(a) and (b).
Exercise 4.8. Suppose we want to use the Taylor polynomial of sin ( x ) centered at a = 0 to approximate
sin (2 ). If we want our answer to have error at most .0000001 how many terms of the Taylor Polynomial
should we use?
Exercise 4.10. The Hyperbolic Trigonometric Functions sinh ( x ) and cosh ( x ) (pronounced to rhyme with
“pinch” and “posh”), are defined by the following formulas.
e x − e −x e x + e −x
sinh ( x ) = cosh ( x ) =
2 2
(a) Use the Taylor series for e x , centered at x = 0, to find Taylor series for each of these functions.
(b) How are the series you got in (a) similar to and different from the series for sin ( x ) and cos ( x )?
(c) Recall that trigonometric functions are sometimes called circular, because for any t, the point ( x , y ) =
( cos (t ), sin (t )) satisfies the equation x 2 + y 2 = 1. Show that the point ( cosh (t ), sinh (t )) lies on the hyper-
bola x 2 − y 2 = 1.