Lectures 3-4: Taylor Theorem

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Lectures 3-4

Taylor Theorem

 Motivation
 Taylor Theorem
 Examples

Reading assignment: Chapter 4


35
Motivation
 We can easily compute expressions like:
3 10 2
2( x  4)
But, How do you compute 4.1, sin(0.6) ?

Can we use the definition


b
a
to compute sin(0.6)?
0.6
Is this a practical way?

36
Remark

 In this course, all angles are assumed to


be in radian unless you are told otherwise.

37
Taylor Series
The Taylor series expansion of f ( x ) about a :
f ( 2) (a ) f ( 3) ( a )
f (a )  f (a ) ( x  a ) 
'
( x  a) 
2
( x  a ) 3  ...
2! 3!
or

1 (k )
Taylor Series   k!
f (a ) ( x  a )k
k 0
If the series converge, we can write :

1 (k )
f ( x)  ∑ k!
f (a ) ( x  a )k
k 0

38
Maclaurin Series
 Maclaurin series is a special case of Taylor
series with the center of expansion a = 0.
The Maclauri n series expansion of f ( x ) :
( 2) ( 3)
f ( 0 ) f ( 0) 3
f ( 0)  f ( 0) x 
'
x 
2
x  ...
2! 3!
If the series converge, we can write :

1 (k )
f ( x)  ∑ k!
f ( 0) x k
k 0
39
Maclaurin Series – Example 1
Obtain Maclaurin series expansion of f ( x )  e x
f ( x)  e x f ( 0)  1
f ' ( x)  e x f ' ( 0)  1
f ( 2) ( x )  e x f ( 2 ) ( 0)  1
f (k ) ( x)  e x f ( k ) (0)  1 for k  1
∞ ∞
1 (k ) xk x2 x3
ex  ∑ k!
f ( 0) x  ∑
k
k!
 1 x 
2!

3!
 ...
k 0 k 0
The series converges for x  ∞.
40
Taylor Series
3

Example 1
2.5
exp(x)
1+x+0.5x 2
2

1+x

1.5

1
1

0.5

0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

41
Maclaurin Series – Example 2
Obtain Maclauri n series expansion of f ( x )  sin( x ) :
f ( x )  sin( x ) f ( 0)  0
f ' ( x )  cos( x ) f ' ( 0)  1
f ( 2 ) ( x )   sin( x ) f ( 2 ) ( 0)  0
f ( 3) ( x )   cos( x ) f ( 3) (0)  1

f ( k ) ( 0) k x3 x5 x7
sin( x )  ∑ x  x     ....
k 0
k! 3! 5! 7!
The series converges for x  ∞.
42
4

3
x

1 x-x 3/3!+x 5/5!

0 sin(x)

-1
x-x 3/3!

-2

-3

-4
-4 -3 -2 -1 0 1 2 3 4

43
Maclaurin Series – Example 3
Obtain Maclaurin series expansion of : f ( x)  cos( x)
f ( x )  cos( x ) f ( 0)  1
f ' ( x )   sin( x ) f ' ( 0)  0
f ( 2 ) ( x )   cos( x ) f ( 2 ) ( 0 )  1
f ( 3) ( x )  sin( x ) f ( 3) (0)  0

f ( k ) ( 0) x 2
x 4
x 6
cos( x )  ∑ ( x ) k  1     ....
k 0
k! 2! 4! 6!
The series converges for x  ∞.
44
Maclaurin Series – Example 4
1
Obtain Maclauri n series expansion of f(x) 
1 x
1
f ( x)  f ( 0)  1
1 x
1
f ' ( x)  f ' ( 0)  1
1  x 2
2
f ( 2) ( x )  f ( 2 ) ( 0)  2
1  x 3
6
f ( 3) ( x )  f ( 3) (0)  6
1  x 4
1
Maclaurin Series Expansion of :  1  x  x 2  x 3  ...
1 x
Series converges for | x |  1
45
Example 4 - Remarks

 Can we apply the series for x≥1??

 How many terms are needed to get a good


approximation???

These questions will be answered using


Taylor’s Theorem.

46
Taylor Series – Example 5
1
Obtain Taylor series expansion of f(x)  at a  1
x
1
f ( x)  f (1)  1
x
1
f ' ( x)  2 f ' (1)  1
x
2
f ( 2) ( x )  3 f ( 2 ) (1)  2
x
6
f ( 3) ( x )  4 f ( 3) (1)  6
x
Taylor Series Expansion ( a  1) : 1  ( x  1)  ( x  1) 2  ( x  1) 3  ...
47
Taylor Series – Example 6
Obtain Taylor series expansion of f(x)  ln( x ) at ( a  1)

1 1 2
f ( x )  ln( x ) , f ' ( x )  , f ( x )  2 , f ( x )  3
( 2) ( 3)
x x x
f (1)  0, f ' (1)  1, f ( 2 ) (1)  1 f ( 3) (1)  2

1 2 1
Taylor Series Expansion : ( x  1)  ( x  1)  ( x  1) 3  ...
2 3

48
Convergence of Taylor Series

 The Taylor series converges fast (few terms


are needed) when x is near the point of
expansion. If |x-a| is large then more terms
are needed to get a good approximation.

49
Taylor’s Theorem
If a function f ( x ) possesses derivative s of orders 1, 2, ..., ( n  1)
on an interval containing a and x then the value of f ( x ) is given by :

(n+1) terms Truncated


Taylor Series
n
f ( k ) (a )
f ( x)  ∑ k!
( x  a)k  Rn
k 0
Remainder
where :
f ( n 1) ( )
Rn  ( x  a ) n 1 and  is between a and x.
( n  1)!
50
Taylor’s Theorem
We can apply Taylor' s theorem for :
1
f(x)  with the point of expansion a  0 if | x |  1.
1 x

If x  1, then the function and its


derivative s are not defined.
 Taylor Theorem is not applicable .

51
Error Term

To get an idea about the approximation error,


we can derive an upper bound on :
( n 1)
f ( )
Rn  ( x  a ) n 1
( n  1)!
for all values of  between a and x.

52
Error Term - Example
How large is the error if we replaced f ( x )  e by x

the first 4 terms ( n  3) of its Taylor series expansion


at a  0 when x  0.2 ?
f (n) ( x)  e x f ( n ) ( ) ≤ e 0.2 for n ≥ 1
f ( n 1) ( )
Rn  ( x  a ) n 1
( n  1)!
e 0.2 n 1
Rn  0.2   R3  8.14268E  05
( n  1)!
53
Alternative form of Taylor’s Theorem
Let f ( x ) have derivative s of orders 1, 2, ..., ( n  1)
on an interval containing x and x  h then :
n (k )
f ( x) k
f ( x  h)   k!
h  Rn ( h  step size)
k 0

f ( n 1) ( ) n 1
Rn  h where  is between x and x  h
( n  1)!

54
Taylor’s Theorem – Alternative forms
( n 1)
n
f ( k ) (a ) f ( )
f ( x)   ( x  a) 
k
( x  a ) n 1
k 0 k! ( n  1)!
where  is between a and x.

a  x, x  x  h

n
f ( k ) ( x ) k f ( n 1) ( ) n 1
f ( x  h)   h  h
k 0 k! ( n  1)!
where  is between x and x  h.
55
Mean Value Theorem
If f ( x ) is a continuous function on a closed interval [a, b]
and its derivative is defined on the open interval ( a , b)
then there exists ξ  ( a , b)
f(b)  f(a)
f ' (ξ ) 
ba
Proof : Use Taylor' s Theorem for n  0, x  a , x  h  b
f(b)  f(a)  f ' (ξ ) (b  a )

56
Alternating Series Theorem
Consider the alternating series :
S  a1  a2  a3  a4  
 a  a  a  a  The series converges
 1 2 3 4

If  and then  and
 lim a  0  S  S n  an 1
 n n 

S n : Partial sum (sum of the first n terms)


an 1 : First omitted term
57
Alternating Series – Example
1 1 1
sin(1) can be computed using : sin(1)  1     
3! 5! 7!
This is a convergent alternating series since :
a1  a2  a3  a4   and lim an  0
n 

Then :
 1 1
sin(1)  1   
 3!  5!
 1 1 1
sin(1)  1    
 3! 5!  7!
58
Example 7

Obtain the Taylor series expansion


2 x 1
of f ( x )  e at a  0.5 (the center of expansion)
How large can the error be when ( n  1) terms are used
to approximate e 2 x 1 with x  1 ?

59
Example 7 – Taylor Series
Obtain Taylor series expansion of f ( x )  e 2 x 1 , a  0.5
f ( x)  e 2 x 1 f (0.5)  e 2
f ' ( x)  2e 2 x 1 f ' (0.5)  2e 2
f ( 2) ( x)  4e 2 x 1 f ( 2) (0.5)  4e 2
f ( k ) ( x)  2 k e 2 x 1 f ( k ) (0.5)  2 k e 2

f ( k ) (0.5)
e 2 x 1
 ∑ k!
( x  0.5) k
k 0

( x  0.5) 2 k 2 ( x  0.5)
k
 e  2e ( x  0.5)  4e
2 2 2
 ...  2 e  ...
2! k!
60
Example 7 – Error Term
f ( k ) ( x)  2 k e 2 x 1
f ( n 1) ( )
Error  ( x  0.5) n 1
(n  1)!
n 1 2 1 (1  0.5) n 1
Error  2 e
(n  1)!
n 1
( 0 . 5)
Error  2 n 1 max e 2 1
(n  1)!  [ 0.5,1]
e3
Error 
(n  1)!
61

You might also like