Taylor Series Revisited: Major: All Engineering Majors Authors
Taylor Series Revisited: Major: All Engineering Majors Authors
28/09/2022 1
What is a Taylor series?
Some examples of Taylor series which you must have
seen
x2 x4 x6
cos( x) = 1 − + − +
2! 4! 6!
x3 x5 x7
sin( x) = x − + − +
3! 5! 7!
x2 x3
e = 1+ x +
x
+ +
2! 3!
3
General Taylor Series
The general form of the Taylor series is given by
f ′′( x ) 2 f ′′′( x ) 3
f (x + h ) = f (x ) + f ′(x )h + h + h +
2! 3!
provided that all derivatives of f(x) are continuous and
exist in the interval [x,x+h]
4
Example—Taylor Series
Find the value of f (6) given that f (4) = 125, f ′(4) = 74,
f ′′(4 ) = 30, f ′′′(4 ) = 6 and all other higher order derivatives
of f (x ) at x = 4 are zero.
Solution:
h2 h3
f (x + h ) = f (x ) + f ′(x )h + f ′′(x ) + f ′′′(x ) +
2! 3!
x=4
h = 6−4 = 2
5
Example (cont.)
Solution: (cont.)
Since the higher order derivatives are zero,
22 23
f (4 + 2 ) = f (4 ) + f ′(4 )2 + f ′′(4 ) + f ′′′(4 )
2! 3!
2 2 23
f (6 ) = 125 + 74(2 ) + 30 + 6
2! 3!
= 125 + 148 + 60 + 8
= 341
Note that to find f (6) exactly, we only need the value
of the function and all its derivatives at some other
point, in this case x = 4
6
Derivation for Maclaurin Series for ex
Derive the Maclaurin series
x2 x3
e = 1+ x +
x
+ +
2! 3!
The Maclaurin series is simply the Taylor series about
the point x=0
h2 h3 h4 h5
f (x + h ) = f (x ) + f ′(x )h + f ′′(x ) + f ′′′(x ) + f ′′′′(x ) + f ′′′′′(x ) +
2! 3! 4 5
h2 h3 h4 h5
f (0 + h ) = f (0 ) + f ′(0 )h + f ′′(0) + f ′′′(0 ) + f ′′′′(0 ) + f ′′′′′(0 ) +
2! 3! 4 5
7
Derivation (cont.)
Since f ( x) = e x , f ′( x) = e x , f ′′( x) = e x , ... , f n ( x) = e x and
f n (0) = e 0 = 1
8
Error in Taylor Series
The Taylor polynomial of order n of a function f(x)
with (n+1) continuous derivatives in the domain
[x,x+h] is given by
h2 hn
f ( x + h ) = f ( x ) + f ′( x )h + f ' ' ( x ) + + f ( x ) + Rn ( x )
(n )
2! n!
where the remainder is given by
( )
Rn x =
( x − h)
n +1
( n +1)
f () c
(n + 1)!
where
x < c < x+h
that is, c is some point in the domain [x,x+h]
9
Example—error in Taylor series
The Taylor series for e at point x = 0 is given by
x
x 2 x3 x 4 x5
e =1+ x +
x
+ + + +
2! 3! 4! 5!
It can be seen that as the number of terms used
increases, the error bound decreases and hence a
better estimate of the function can be found.
10
Example—(cont.)
Solution:
Using (n + 1) terms of Taylor series gives error bound of
Rn ( x ) =
( x − h)
n +1
f (n +1) (c ) x = 0, h = 1, f ( x) = e x
(n + 1)!
Rn (0 ) =
(0 − 1)
n +1
f (n +1) (c )
(n + 1)!
=
(− 1)
n +1
ec
(n + 1)!
Since
x < c < x+h
0 < c < 0 +1 1
< Rn (0 ) <
e
0 < c <1 (n + 1)! (n + 1)!
11
Example—(cont.)
Solution: (cont.)
So if we want to find out how many terms it would
require to get an approximation of e within a
1
(n + 1)!> 10 6 e
(n + 1)!> 10 6 × 3
n≥9
So 9 terms or more are needed to get a true error
less than 10 −6
12
THE END