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

Lecture 09 – 12.

9 Taylor’s Formula, Taylor


Series, and Approximations
Several Variable Calculus, 1MA017

Xing Shi Cai


Autumn 2019
Department of Mathematics, Uppsala University, Sweden
Summary

Please watch this video before the lecture: 9


Today we will talk about

• 12.9 Taylor’s Formula, Taylor Series, and Approximations

1
Brook Taylor

Brook Taylor (1685–1731). English mathematician.


2
Computing without a computer

You are asked to compute 𝑓(1.02, 1.97) for 𝑓 = √𝑥2 + 𝑦3 without


a computer. 😟
You can approximate it with the linearisation of 𝑓(𝑥, 𝑦), i.e.,

𝜕𝑓 𝜕𝑓
𝑓(1.02, 1.97) ≈ 𝑓(1, 2) + (1, 2)(1.02 − 1) + (1, 2)(1.97 − 2)
𝜕𝑥 𝜕𝑦
= 2.94667.

3
Computing without a computer

You are asked to compute 𝑓(1.02, 1.97) for 𝑓 = √𝑥2 + 𝑦3 without


a computer. 😟
You can approximate it with the linearisation of 𝑓(𝑥, 𝑦), i.e.,

𝜕𝑓 𝜕𝑓
𝑓(1.02, 1.97) ≈ 𝑓(1, 2) + (1, 2)(1.02 − 1) + (1, 2)(1.97 − 2)
𝜕𝑥 𝜕𝑦
= 2.94667.

Questions: How good is this approximation? If we want to be


more precise, how can we do it?

3
Review: Taylor’s formula for
one-variable
Taylor’s formula for one-variable

The Taylor polynomial of degree 𝑛 for the function 𝑓(𝑥) at 𝑥 = 𝑎 is

𝑓 ′ (𝑎) 𝑓 ″ (𝑎) 𝑓 (𝑛) (𝑎)


𝑝𝑛 (𝑥) = 𝑓(𝑎)+ (𝑥−𝑎)+ (𝑥−𝑎)2 +⋯+ (𝑥−𝑎)𝑛
1! 2! 𝑛!

4
Taylor’s formula for one-variable

The Taylor polynomial of degree 𝑛 for the function 𝑓(𝑥) at 𝑥 = 𝑎 is

𝑓 ′ (𝑎) 𝑓 ″ (𝑎) 𝑓 (𝑛) (𝑎)


𝑝𝑛 (𝑥) = 𝑓(𝑎)+ (𝑥−𝑎)+ (𝑥−𝑎)2 +⋯+ (𝑥−𝑎)𝑛
1! 2! 𝑛!

We have 𝑝𝑛 (𝑥) ≈ 𝑓(𝑥) near 𝑎 because

𝑓 (𝑛+1) (𝑠)
𝑟𝑛 (𝑥) = 𝑓(𝑥) − 𝑝𝑛 (𝑥) = (𝑥 − 𝑎)𝑛+1
(𝑛 + 1)!

for some number 𝑠 between 𝑎 and 𝑥 — Taylor’s Theorem (Thm.


4.12).

4

Example — 𝑥


For 𝑓(𝑥) = 𝑥, at the point 𝑥 = 1,

𝑝1 (1.1) =1.05000000000000
𝑝2 (1.1) =1.04875000000000

𝑝9 (1.1) =1.04880884817101
𝑓(1.1) =1.04880884817015

5

Example — 𝑥


For 𝑓(𝑥) = 𝑥, at the point 𝑥 = 1,

1.5

1.4

x
1
1.3 1+ (-1 + x)
2
1 1
1+ (-1 + x) - (-1 + x)2
2 8
1 1 1
1.2 1+ (-1 + x) - (-1 + x)2 + (-1 + x)3
2 8 16
1 1 1 5
1+ (-1 + x) - (-1 + x)2 + (-1 + x)3 - (-1 + x)4
2 8 16 128

1.1

x
1.2 1.4 1.6 1.8 2.0

5
Taylor’s formula for several variables
A bit notations

Let h = (ℎ1 , … ℎ𝑛 ). For a function 𝑔(𝑥1 , … , 𝑥𝑛 ), we define


𝜕𝑔 𝜕𝑔 𝜕𝑔
(h ⋅ ∇)𝑔 = h ⋅ ∇𝑔 = (ℎ1 , … , ℎ𝑛 ) ⋅ ( , ,… )
𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛
𝜕𝑔 𝜕𝑔 𝜕𝑔
= ℎ1 + ℎ2 + ⋯ + ℎ𝑛
𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛

6
A bit notations

Let h = (ℎ1 , … ℎ𝑛 ). For a function 𝑔(𝑥1 , … , 𝑥𝑛 ), we define


𝜕𝑔 𝜕𝑔 𝜕𝑔
(h ⋅ ∇)𝑔 = h ⋅ ∇𝑔 = (ℎ1 , … , ℎ𝑛 ) ⋅ ( , ,… )
𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛
𝜕𝑔 𝜕𝑔 𝜕𝑔
= ℎ1 + ℎ2 + ⋯ + ℎ𝑛
𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛

For example, if 𝑔(𝑥, 𝑦) = 𝑥𝑦 and h = (2, 1), then


(h ⋅ ∇)𝑔 = h ⋅ ∇𝑔 = (2, 1) ⋅ (𝑦, 𝑥) = 2𝑦 + 𝑥.

6
A bit notations

Let h = (ℎ1 , … ℎ𝑛 ). For a function 𝑔(𝑥1 , … , 𝑥𝑛 ), we define


𝜕𝑔 𝜕𝑔 𝜕𝑔
(h ⋅ ∇)𝑔 = h ⋅ ∇𝑔 = (ℎ1 , … , ℎ𝑛 ) ⋅ ( , ,… )
𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛
𝜕𝑔 𝜕𝑔 𝜕𝑔
= ℎ1 + ℎ2 + ⋯ + ℎ𝑛
𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛

For example, if 𝑔(𝑥, 𝑦) = 𝑥𝑦 and h = (2, 1), then


(h ⋅ ∇)𝑔 = h ⋅ ∇𝑔 = (2, 1) ⋅ (𝑦, 𝑥) = 2𝑦 + 𝑥.

Since (h ⋅ ∇)𝑔 is again a function of 𝑛 variables, we can do this


repeatedly
(ℎ ⋅ ∇)2 𝑔 = (ℎ ⋅ ∇)(ℎ ⋅ ∇)𝑔
(ℎ ⋅ ∇)3 𝑔 = (ℎ ⋅ ∇)(ℎ ⋅ ∇)(ℎ ⋅ ∇)𝑔

6
Taylor’s formula for 𝑛 variables

Given 𝑓 ∶ ℝ𝑛 ↦ ℝ and a = (𝑎1 , … , 𝑎𝑛 ), x = (𝑥1 , … , 𝑥𝑛 ), let


h = (ℎ1 , … , ℎ𝑛 ) = x − a and
𝐹 (𝑡) = 𝑓(y(𝑡)) = 𝑓(a + 𝑡h).
where
y(𝑡) = a+𝑡h = (𝑎1 , … , 𝑎𝑛 )+𝑡(ℎ1 , … , ℎ𝑛 ) = (𝑎1 +𝑡ℎ1 , … , 𝑎𝑛 +𝑡ℎ𝑛 )

7
Taylor’s formula for 𝑛 variables

Given 𝑓 ∶ ℝ𝑛 ↦ ℝ and a = (𝑎1 , … , 𝑎𝑛 ), x = (𝑥1 , … , 𝑥𝑛 ), let


h = (ℎ1 , … , ℎ𝑛 ) = x − a and
𝐹 (𝑡) = 𝑓(y(𝑡)) = 𝑓(a + 𝑡h).
where
y(𝑡) = a+𝑡h = (𝑎1 , … , 𝑎𝑛 )+𝑡(ℎ1 , … , ℎ𝑛 ) = (𝑎1 +𝑡ℎ1 , … , 𝑎𝑛 +𝑡ℎ𝑛 )
Then by the chain rule

⎡ ℎ1 ⎤
d ⎢ ⎥
𝐹 (𝑡) = 𝑓(y(𝑡)) = 𝑓 ′ (y(𝑡))y′ (𝑡) = [𝑓1 (y(𝑡)) …

𝑓𝑛 (y(𝑡))] ⎢ ⋮ ⎥
d𝑡 ⎢ ⎥

⎣ 𝑛⎦
= h ⋅ ∇𝑓(y(𝑡)) = (h ⋅ ∇)𝑓(y(𝑡)).
𝜕𝑓
Note 𝑓𝑖 = 𝜕𝑥𝑖 , the partial derivative of 𝑓 with respect to 𝑥𝑖 .
7
Taylor’s formula for 𝑛 variables

Let 𝑔(x) = (h ⋅ ∇)𝑓(x). Taking derivative one more time, we get


d d
𝐹 ″ (𝑡) = (h ⋅ ∇)𝑓(y(𝑡)) = 𝑔(y(𝑡))
d𝑡 d𝑡
2
= (h ⋅ ∇) 𝑔(y(𝑡)) = (h ⋅ ∇) 𝑓(y(𝑡))

8
Taylor’s formula for 𝑛 variables

Let 𝑔(x) = (h ⋅ ∇)𝑓(x). Taking derivative one more time, we get


d d
𝐹 ″ (𝑡) = (h ⋅ ∇)𝑓(y(𝑡)) = 𝑔(y(𝑡))
d𝑡 d𝑡
2
= (h ⋅ ∇) 𝑔(y(𝑡)) = (h ⋅ ∇) 𝑓(y(𝑡))

Taking derivative 3 times, we get



𝐹 (𝑡) =(h ⋅ ∇)3 𝑓(y(𝑡))

8
Taylor’s formula for 𝑛 variables

Let 𝑔(x) = (h ⋅ ∇)𝑓(x). Taking derivative one more time, we get


d d
𝐹 ″ (𝑡) = (h ⋅ ∇)𝑓(y(𝑡)) = 𝑔(y(𝑡))
d𝑡 d𝑡
2
= (h ⋅ ∇) 𝑔(y(𝑡)) = (h ⋅ ∇) 𝑓(y(𝑡))

Taking derivative 3 times, we get



𝐹 (𝑡) =(h ⋅ ∇)3 𝑓(y(𝑡))

Taking derivative 𝑚 times, we get

𝐹 (𝑚) (𝑡) =(h ⋅ ∇)𝑚 𝑓(y(𝑡)) = (h ⋅ ∇)𝑚 𝑓(a + 𝑡h)

In particular

𝐹 (𝑚) (0) = (h ⋅ ∇)𝑚 𝑓(a)

8
Taylor’s formula for 𝑛 variables

Applying Taylor’s Theorem for one variable functions to


𝑓(x) = 𝑓(a + h) = 𝑓(y(1)) = 𝐹 (1),
we get, for some 𝜃 ∈ [0, 1],

9
Taylor’s formula for 𝑛 variables

Applying Taylor’s Theorem for one variable functions to


𝑓(x) = 𝑓(a + h) = 𝑓(y(1)) = 𝐹 (1),
we get, for some 𝜃 ∈ [0, 1],
𝑓(x) = 𝐹 (1)
𝐹 ′ (0) 𝐹 (𝑚) (0) 𝐹 (𝑚+1) (𝜃)
= 𝐹 (0) + (1 − 0) + ⋯ + (1 − 0)𝑚 +
1! 𝑚! (𝑚 + 1)!
𝑚
(h ⋅ ∇)𝑓(a) (h ⋅ ∇) 𝑓(a)
= 𝑓(a) + +⋯+
1! 𝑚!
(h ⋅ ∇)𝑚+1 𝑓(a + 𝜃h)
+
(𝑚 + 1)!
= 𝑝𝑚 (x) + 𝑟𝑚 (x, 𝜃).

9
Taylor’s formula for 𝑛 variables

Applying Taylor’s Theorem for one variable functions to


𝑓(x) = 𝑓(a + h) = 𝑓(y(1)) = 𝐹 (1),
we get, for some 𝜃 ∈ [0, 1],
𝑓(x) = 𝐹 (1)
𝐹 ′ (0) 𝐹 (𝑚) (0) 𝐹 (𝑚+1) (𝜃)
= 𝐹 (0) + (1 − 0) + ⋯ + (1 − 0)𝑚 +
1! 𝑚! (𝑚 + 1)!
𝑚
(h ⋅ ∇)𝑓(a) (h ⋅ ∇) 𝑓(a)
= 𝑓(a) + +⋯+
1! 𝑚!
(h ⋅ ∇)𝑚+1 𝑓(a + 𝜃h)
+
(𝑚 + 1)!
= 𝑝𝑚 (x) + 𝑟𝑚 (x, 𝜃).
The polynomial 𝑝𝑚 (x) is called the 𝑚-th degree Taylor polynomial
of 𝑓(x) at a.
9
Taylor’s formula for 𝑛 variables – Summary

Let h = x − a. Let (h ⋅ ∇)𝑓 = h ⋅ ∇𝑓.


Then,

(h ⋅ ∇)𝑓(a) (h ⋅ ∇)2 𝑓(a) (h ⋅ ∇)𝑚 𝑓(a)


𝑓(x) = 𝑓(a) + + +⋯+
1! 2! 𝑚!
(h ⋅ ∇)𝑚+1 𝑓(a + 𝜃h)
+
(𝑚 + 1)!
= 𝑝𝑚 (x) + 𝑟𝑚 (x, 𝜃),

for some 𝜃 ∈ [0, 1]. The polynomial 𝑝𝑚 (x) is called the 𝑚-th
degree Taylor polynomial of 𝑓(x) at a.

10
Why do we need Taylor’s polynomials?

𝑟𝑚 (x, 𝜃) is usually much smaller than 𝑝𝑚 (x) for large 𝑚, i.e.,


𝑓(x) ≈ 𝑝𝑚 (x).
This useful for approximating function that is hard to compute.
As shown in the picture, 𝑝2 (𝑥1 , 𝑥2 ) is a pretty good approximation for
𝑓(𝑥1 , 𝑥2 ) = √𝑥21 + 𝑥32 at (1, 2). We will compute it shortly.

x 32 + x 21
p1 (x 1 , x 2 )
p2 (x 1 , x 2 )

11
What are (h ⋅ ∇)𝑚 𝑓?

By definition,
(h ⋅ ∇)𝑓 = h ⋅ (∇𝑓) = (ℎ1 , … , ℎ𝑛 ) ⋅ (𝑓1 , 𝑓2 , … , 𝑓𝑛 )
𝑛
= ℎ1 𝑓1 + ⋯ + ℎ𝑛 𝑓𝑛 = ∑ ℎ𝑖 𝑓𝑖 .
𝑖=1

12
What are (h ⋅ ∇)𝑚 𝑓?

By definition,
(h ⋅ ∇)𝑓 = h ⋅ (∇𝑓) = (ℎ1 , … , ℎ𝑛 ) ⋅ (𝑓1 , 𝑓2 , … , 𝑓𝑛 )
𝑛
= ℎ1 𝑓1 + ⋯ + ℎ𝑛 𝑓𝑛 = ∑ ℎ𝑖 𝑓𝑖 .
𝑖=1

Then
𝑛 𝑛
(h ⋅ ∇)2 𝑓 = (h ⋅ ∇) ∑ ℎ𝑖 𝑓𝑖 = ∑ ℎ𝑖 (h ⋅ ∇)𝑓𝑖
𝑖=1 𝑖=1
𝑛 𝑛 𝑛 𝑛
= ∑ ℎ𝑖 ∑ ℎ𝑗 𝑓𝑖𝑗 = ∑ ∑ ℎ𝑖 ℎ𝑗 𝑓𝑖𝑗
𝑖=1 𝑗=1 𝑖=1 𝑗=1

12
What are (h ⋅ ∇)𝑚 𝑓?

By definition,
(h ⋅ ∇)𝑓 = h ⋅ (∇𝑓) = (ℎ1 , … , ℎ𝑛 ) ⋅ (𝑓1 , 𝑓2 , … , 𝑓𝑛 )
𝑛
= ℎ1 𝑓1 + ⋯ + ℎ𝑛 𝑓𝑛 = ∑ ℎ𝑖 𝑓𝑖 .
𝑖=1

Then
𝑛 𝑛
(h ⋅ ∇)2 𝑓 = (h ⋅ ∇) ∑ ℎ𝑖 𝑓𝑖 = ∑ ℎ𝑖 (h ⋅ ∇)𝑓𝑖
𝑖=1 𝑖=1
𝑛 𝑛 𝑛 𝑛
= ∑ ℎ𝑖 ∑ ℎ𝑗 𝑓𝑖𝑗 = ∑ ∑ ℎ𝑖 ℎ𝑗 𝑓𝑖𝑗
𝑖=1 𝑗=1 𝑖=1 𝑗=1

and similarly
𝑛 𝑛 𝑛
(h ⋅ ∇)3 𝑓 = ∑ ∑ ∑ ℎ𝑖 ℎ𝑗 ℎ𝑘 𝑓𝑖𝑗𝑘
𝑖=1 𝑗=1 𝑘=1

𝜕2 𝑓 𝜕3 𝑓
Note Here 𝑓𝑖𝑗 = 𝜕𝑥𝑖 𝜕𝑥𝑗 and 𝑓𝑖𝑗𝑘 = 𝜕𝑥𝑖 𝜕𝑥𝑗 𝜕𝑥𝑘
12
Taylor polynomials for two variables

Let x = (𝑥1 , 𝑥2 ), a = (𝑎1 , 𝑎2 ) and h = (ℎ1 , ℎ2 ) = x − a. Then for


𝑓(𝑥1 , 𝑥2 ), we have
2
(h ⋅ ∇)𝑓 = ∑ ℎ𝑖 𝑓𝑖 = 𝑓1 ℎ1 + 𝑓2 ℎ2 ,
𝑖=1

13
Taylor polynomials for two variables

Let x = (𝑥1 , 𝑥2 ), a = (𝑎1 , 𝑎2 ) and h = (ℎ1 , ℎ2 ) = x − a. Then for


𝑓(𝑥1 , 𝑥2 ), we have
2
(h ⋅ ∇)𝑓 = ∑ ℎ𝑖 𝑓𝑖 = 𝑓1 ℎ1 + 𝑓2 ℎ2 ,
𝑖=1

and
2 2
(h ⋅ ∇)2 𝑓 = ∑ ∑ ℎ𝑖 ℎ𝑗 𝑓𝑖𝑗
𝑖=1 𝑗=1

= 𝑓11 ℎ1 ℎ1 + 𝑓21 ℎ2 ℎ1 + 𝑓12 ℎ1 ℎ2 + 𝑓22 ℎ2 ℎ2


= 𝑓11 ℎ21 + 2𝑓12 ℎ1 ℎ2 + 𝑓22 ℎ22 ,

assuming that 𝑓21 and 𝑓12 are continuous.

13
Taylor polynomials for two variables 😲😲😲😲

Therefore, for two variable functions 𝑓(𝑥1 , 𝑥2 ),

𝑝1 (x) = 𝑓(a) + (h ⋅ ∇)𝑓(a) = 𝑓(a) + 𝑓1 (a)ℎ1 + 𝑓2 (a)ℎ2

which is just the tangent plane of 𝑓(x) at a.

14
Taylor polynomials for two variables 😲😲😲😲

Therefore, for two variable functions 𝑓(𝑥1 , 𝑥2 ),

𝑝1 (x) = 𝑓(a) + (h ⋅ ∇)𝑓(a) = 𝑓(a) + 𝑓1 (a)ℎ1 + 𝑓2 (a)ℎ2

which is just the tangent plane of 𝑓(x) at a. And

1
𝑝2 (x) = 𝑓(a) + (h ⋅ ∇)𝑓(a) + (h ⋅ ∇)2 𝑓(a)
2!
= 𝑓(a) + 𝑓1 (a)ℎ1 + 𝑓2 (a)ℎ2
1
+ (𝑓11 (a)ℎ21 + 2𝑓12 (a)ℎ1 ℎ2 + 𝑓22 (a)ℎ22 ) .
2!
where ℎ1 = 𝑥1 − 𝑎1 and ℎ2 = 𝑥2 − 𝑎2 .

14
Example

Qustions: Find 𝑝2 (𝑥1 , 𝑥2 ) for the function 𝑓(𝑥1 , 𝑥2 ) = √𝑥21 + 𝑥32


at (1, 2).

15
Example

Qustions: Find 𝑝2 (𝑥1 , 𝑥2 ) for the function 𝑓(𝑥1 , 𝑥2 ) = √𝑥21 + 𝑥32


at (1, 2).
For this question,

a = (1, 2), h = x − a = (ℎ1 , ℎ2 ) = (𝑥1 − 1, 𝑥2 − 2).

15
Example

Qustions: Find 𝑝2 (𝑥1 , 𝑥2 ) for the function 𝑓(𝑥1 , 𝑥2 ) = √𝑥21 + 𝑥32


at (1, 2).
For this question,

a = (1, 2), h = x − a = (ℎ1 , ℎ2 ) = (𝑥1 − 1, 𝑥2 − 2).

So 𝑓(a) = 3 and the partial derivatives are

1
𝑓1 (a) = , 𝑓2 (a) = 2
3
and
8 2 2
𝑓11 (a) = , 𝑓12 (a) = 𝑓21 (a) = − , 𝑓22 (a) = .
27 9 3

15
Example – Solution

Putting these numbers into the formula, we get


𝑝2 (𝑥1 , 𝑥2 ) = 𝑓(a) + 𝑓1 (a)ℎ1 + 𝑓2 (a)ℎ2
1
+ (𝑓11 (a)ℎ21 + 2𝑓12 (a)ℎ1 ℎ2 + 𝑓22 (a)ℎ22 )
2!
1
= 3 + (𝑥1 − 1) + 2(𝑥2 − 2)
3
1 8 4 2
+ ( (𝑥1 − 1)2 − (𝑥1 − 1)(𝑥2 − 2) + (𝑥2 − 2)2 )
2 27 9 3

This is a much better approximation for 𝑓(𝑥1 , 𝑥2 ) than 𝑝1 (𝑥1 , 𝑥2 )


(the tangent plane) around (1, 2). For example
𝑝1 (1.02, 1.97) = 2.94666666666667
𝑝2 (1.02, 1.97) = 2.94715925925926
𝑓(1.02, 1.97) = 2.94716355162044
16
Quiz

Which of the following is 𝑝2 (𝑥, 𝑦) for 𝑓(𝑥, 𝑦) = 𝑒𝑥+2𝑦 at (0, 0)?

1. 1 + 𝑥 + 2𝑦 + (𝑥2 + 4𝑥𝑦 + 4𝑦2 )


1
2. 1 + 𝑥 + 2𝑦 + 2 (𝑥2 + 4𝑥𝑦 + 4𝑦2 )
1
3. 1 + 𝑥 + 2𝑦 + 2 (𝑥2 + 2𝑥𝑦 + 4𝑦2 )
1
4. 1 + 𝑥 + 2𝑦 + 2 (𝑥2 + 4𝑥𝑦 + 2𝑦2 )

17
Quiz

Which of the following is 𝑝2 (𝑥, 𝑦) for 𝑓(𝑥, 𝑦) = 𝑒𝑥+2𝑦 at (0, 0)?

1. 1 + 𝑥 + 2𝑦 + (𝑥2 + 4𝑥𝑦 + 4𝑦2 )


1
2. 1 + 𝑥 + 2𝑦 + 2 (𝑥2 + 4𝑥𝑦 + 4𝑦2 )
1
3. 1 + 𝑥 + 2𝑦 + 2 (𝑥2 + 2𝑥𝑦 + 4𝑦2 )
1
4. 1 + 𝑥 + 2𝑦 + 2 (𝑥2 + 4𝑥𝑦 + 2𝑦2 )

Answer
1 2
𝑝2 (𝑥, 𝑦) = 1 + 𝑥 + 2𝑦 + (𝑥 + 4𝑥𝑦 + 4𝑦2 )
2

17

You might also like