You are on page 1of 101

MATH1.

3 CALCULUS II - AY2020/21
Chapter 2: Extremums of Functions of Several Variables

MATH1.3 CALCULUS II - AY2020/21 1 / 101


Outline

1 Directional Derivatives

2 Maximum & Minimum Rate of Change

3 Optimization Problems

4 Double Integrals

MATH1.3 CALCULUS II - AY2020/21 2 / 101


Outline

1 Directional Derivatives

2 Maximum & Minimum Rate of Change

3 Optimization Problems

4 Double Integrals

MATH1.3 CALCULUS II - AY2020/21 3 / 101


1. Directional Derivatives

Recall. For the function f (x, y ), the partial derivatives fx and fy at a


point (a, b) are defined as

f (a + h, b) − f (a, b)
fx (a, b) = lim ,
h→0 h
and
f (a, b + h) − f (a, b)
fy (a, b) = lim .
h→0 h

They represent respectively the rate of change of f in the x- and


y -directions, i.e., the directions of the unit vectors i and j.

These lead us to the following general notion.

MATH1.3 CALCULUS II - AY2020/21 4 / 101


• Directional derivatives for 2-variable functions

Suppose that we want to find the rate of change of f in the direction


corresponds to unit vector u = (u1 , u2 ).

We follow the idea for functions of one variable.

First note that the point changes from (a, b) to


(a, b) + h(u1 , u2 ) = (a + hu1 , b + hu2 ), and hence the
corresponding change in f is

f (a + hu1 , b + hu2 ) − f (a, b).

Then the rate of change along the direction u is thus the limit of
the ratio
f (a + hu1 , b + hu2 ) − f (a, b)
as h → 0.
h

MATH1.3 CALCULUS II - AY2020/21 5 / 101


We define this limit, if exists, as the directional derivative of f along u.

Definition (1.)
The directional derivative of f at (a, b) in the direction of the unit vector
u = (u1 , u2 ) is

f (a + hu1 , b + hu2 ) − f (a, b)


Du f (a, b) = lim ,
h→0 h
if this limit exists.

MATH1.3 CALCULUS II - AY2020/21 6 / 101


• Computation of Du f

The following result gives a formula for computing Du f .

Theorem (2.)
If f (x, y ) is a differentiable function of two variables x and y , then f has
a directional derivative in the direction of any unit vector u = (u1 , u2 )
and
Du f (x, y ) = ∇f · u = fx (x, y )u1 + fy (x, y )u2 .

To evaluate Du f (x, y ) at P(a, b) using the formula above, we compute

Du f (a, b) = ∇f (a, b) · u = fx (a, b)u1 + fy (a, b)u2 .

So we have to identify the point P and the (direction) unit vector u.

MATH1.3 CALCULUS II - AY2020/21 7 / 101


Example (3.)
Let f (x, y ) = x 3 − 3xy + 4y 2 .
(a) Find the directional derivative Du f (x, y ), where u is the unit vector
π
given by angle θ = .
6
(b) What is Du f (1, 2)?
√ 
3 1
Solution. We have u = cos π6 i + sin π6 j = 2 ,2 , P = (1, 2), and
∇f = (3x 2 − 3y , −3x + 8y ).
 √3 1 
2
(a) Du f (x, y ) = ∇f (x, y ) · u = 3x − 3y , −3x + 8y ) · , =
√ √ 2 2
3 3 2 3 3 3
x − x + 4y − y.
2 2 2
√ √ √
3 3 3 3 3 13 3 3
(b) Du f (1, 2) = − +4·2− ·2= − .
2 2 2 2 2

MATH1.3 CALCULUS II - AY2020/21 8 / 101


Example (4.)
Find the directional derivative of the function f (x, y ) = x 2 y 3 − 4y at the
point (2, −1), in the direction of the vector v = 2i + 5j.

Solution. First we should find the unit vector u along v.



Since kvk = 29, the unit vector in the direction of v is

v 1
u= = √ (2, 5).
kvk 29

Also for f (x, y ) = x 2 y 3 − 4y , we have

∇f (x, y ) = (2xy 3 , 3x 2 y 2 − 4).

Finally, P = (2, −1).

MATH1.3 CALCULUS II - AY2020/21 9 / 101


Example 4 (cont.)

Now we have
(2, 5)
Du f (x, y ) = ∇f (x, y ) · u = (2xy 3 , 3x 2 y 2 − 4) · √ ,
29

and hence at the point (2, −1), we obtain

(2, 5) −4 · 2 + 8 · 5 32
Du f (2, −1) = (−4, 8) · √ = √ =√ .
29 29 29

MATH1.3 CALCULUS II - AY2020/21 10 / 101


• Directional derivatives for 3-variable functions

For functions of three variables, directional derivatives are defined in


the same manner.
Definition (5.)
The directional derivative of f at (a, b, c) in the direction of a unit vector
u = (u1 , u2 , u3 ) is

f (a + hu1 , b + hu2 , c + hu3 ) − f (a, b, c)


Du f (a, b, c) = lim ,
h→0 h
if the limit exists.

We also have a formula

Du f (x, y , z) = ∇f (x, y , z) · u.

MATH1.3 CALCULUS II - AY2020/21 11 / 101


• Directional derivatives for n-variable functions
Similarly, for a function of n variables f (x1 , x2 , . . . , xn ), we have the
following definition.

Definition (6.)
The directional derivatives of f at x0 along the unit vector u is

f (x + hu) − f (x0 )
Du f (x0 ) = lim .
h→0 h

The formula for computing a directional derivative is

Du f (x) = ∇f (x) · u,

i.e.,
Du f (x1 , x2 , . . . , xn ) = ∇f (x1 , x2 , . . . , xn ) · u.

MATH1.3 CALCULUS II - AY2020/21 12 / 101


Outline

1 Directional Derivatives

2 Maximum & Minimum Rate of Change

3 Optimization Problems

4 Double Integrals

MATH1.3 CALCULUS II - AY2020/21 13 / 101


2. Maximum & Minimum Rate of Change

We know that the value Du f gives the rate of change in f along the
direction u.

Concerning this, there are two questions we seek answers to:


1 Does there exists a direction where the rate of change in f is the
maximum or a minimum?
2 How to determine this maximum and minimum?

MATH1.3 CALCULUS II - AY2020/21 14 / 101


To give the answers, we look at the formula

Du f = ∇f · u = k∇f k · kuk cos θ = k∇f k cos θ,

where θ is the angle between ∇f and u.

Since −1 ≤ cos θ ≤ 1 (cos 0 = 1 and cos π = −1), we have

−k∇f (P0 )k ≤ kuk cos θ ≤ k∇f (P0 )k.

Equalities occur when cos θ = −1 ⇐⇒ θ = π for the left inequality and


cos θ = 1 ⇐⇒ θ = 0 for the right inequality.

Note that θ = 0 means u has the same direction as the gradient vector
∇f and θ = π means u has the opposite direction of the gradient vector
∇f .

MATH1.3 CALCULUS II - AY2020/21 15 / 101


• Maximum & Minimum Rate of Change

So we obtain the following result.

Theorem (1.)
Suppose f is a differentiable function (of two or three variables).
(a) The maximum rate of change in f at P0 is k∇f (P0 )k and it occurs
∇f (P0 )
in the direction u = , which is the same direction as the
k∇f (P0 )k
gradient vector ∇f (P0 ).

(b) The minimum rate of change in f at P0 is −k∇f (P0 )k and it occurs


−∇f (P0 )
in the direction u = , which is the opposite direction of
k∇f (P0 )k
the gradient vector ∇f (P0 ).

MATH1.3 CALCULUS II - AY2020/21 16 / 101


Example (2.)
(a) For f (x, y ) = xey , find the rate of change of f at the point P(2, 0) in
1 
the direction from P to Q , 2 .
2
(b) What is the maximum rate of change? In what direction does f
have the maximum rate of change?

Solution.
(a) The rate of change of f at point P along a direction of the unit
vector u is given by Du f (P) = ∇f (P) · u.

- First, ∇f (x, y ) = (ey , xey ) =⇒ ∇f (2, 0) = (e0 , 2e0 ) = (1, 2).


−→ −−→ −→  3 
- Next, PQ = OQ − OP = − , 2 , and hence the unit vector in
2 
−→ −→
PQ − 23 ,2 3 4
the direction PQ is u = −→ = r = − , .
kPQk  2
− 3 +22
5 5
2

MATH1.3 CALCULUS II - AY2020/21 17 / 101


Then the rate of change of f in the direction from P to Q is

Du f (2, 0) = ∇f (2, 0) · u
3 4 3 4
= (1, 2) · − , = − + 2 · = 1.
5 5 5 5

(b) We have computed ∇f (2, 0) = (1, 2). Then the maximum rate of
change in f at P is
p √
k∇f (2, 0)k = k(1, 2)k = 12 + 22 = 5.

At P, the function f increases fastest in the direction of the


gradient vector ∇f (2, 0) = (1, 2). The corresponding unit vector u
is
∇f (2, 0) 1
u= = √ (1, 2).
k∇f (2, 0)k 5

MATH1.3 CALCULUS II - AY2020/21 18 / 101


• Important Conclusion

1 The gradient vector ∇f is orthogonal to the level curve f (x, y ) = k


and it is the direction where f increases most rapidly (largest rate).

2 The gradient vector ∇F is orthogonal to the level surface


F (x, y , z) = k and it is the direction where F increases most
rapidly (largest rate).

Remark. The direction −∇f (P) (respectively −∇F (P) is used in the
steepest descent algorithm in seeking the global minimum value of f
(respectively of F ).

MATH1.3 CALCULUS II - AY2020/21 19 / 101


• Singular, stationary, and critical points

Definition (3.)
(a) Points at which fx or fy do not exist are called singular points.

(b) If (a, b) is not a singular point, and ∇f (a, b) = (0, 0), i.e. both
fx (a, b) = fy (a, b) = 0, then we call the point (a, b) a stationary
point.

(c) A point (a, b) is called a critical point of f if (a, b) is a stationary


point or a singular point, that is
[
{critical points} = {singular points} {stationary points} .

MATH1.3 CALCULUS II - AY2020/21 20 / 101


Example (4.)
Find all critical points for f (x, y ) = y 2 − y 4 − x 2 .

Solution. First we note that

∇f (x, y ) = (−2x, 2y − 4y 3 ) = − 2x, 2y (1 − 2y 2 ) ,




is defined at every (x, y ), and hence there is no singular point.

Next, to find stationary points, we solve the equation


 
−2x = 0 x = 0

∇f (x, y ) = (0, 0) ⇐⇒ ⇐⇒ 1
2y (1 − 2y 2 ) = 0 y = 0, ± √ .

2
1 −1
Thus stationary points are (0, 0), (0, √ ), and (0, √ ) (which are all
2 2
critical points of f ).
MATH1.3 CALCULUS II - AY2020/21 21 / 101
Example (5.)

Find all critical points of f (x, y ) = ex
3 y −x 2 .

Solution. We have
√ √ x 
3 y −x 2
∇f (x, y ) = ex 3
y − 2x, p , if y 6= 0.
3 3 y2

- First, ∇f (x, y ) is not defined when y = 0, and hence singular points


are (x, 0) : x ∈ R.

- Next, for stationary points, we solve ∇f (x, y ) = 0, with y 6= 0.

MATH1.3 CALCULUS II - AY2020/21 22 / 101


Example 5 (cont.)

We have


 3 y − 2x = 0

∇f (x, y ) = 0 ⇐⇒ x

 p 3
= 0.
3 y2

x
From p 3
= 0, we get x = 0.
3 y2

Substituting x = 0 into 3 y − 2x = 0, we obtain y = 0.

But y 6= 0. So there is no stationary point.

Conclusion: Critical points of f are (x, 0) : x ∈ R.

MATH1.3 CALCULUS II - AY2020/21 23 / 101


• Local maximum and local minimum values

In Mathematics 1 we have discussed that one of the main applications


of derivatives is to classify local extrema of single variable functions via
first-order or second-order derivatives.

Now we see how to use partial derivatives to find and classify the local
extrema of functions of two variables.

MATH1.3 CALCULUS II - AY2020/21 24 / 101


Definition (6.)
A function f of two variables has a local maximum at (a, b) if

f (x, y ) ≤ f (a, b),

for all points (x, y ) in some disk centered at (a, b).

The number f (a, b) is called a local maximum value.

If the inequality above is changed to

f (x, y ) ≥ f (a, b),

then f has a local minimum at (a, b), and f (a, b) is called a local
minimum value.

MATH1.3 CALCULUS II - AY2020/21 25 / 101


• Local Extreme Values

MATH1.3 CALCULUS II - AY2020/21 26 / 101


• Necessary condition for local extreme values

The following result tells us possible points for local extrema are
stationary points if both fx and fy exist.

Theorem (7.)
If f has a local extremum at (a, b), where (a, b) is an interior point, and
the first-order partial derivatives exist there, then (a, b) is a stationary
point, i.e.
∇f (a, b) = (0, 0).

MATH1.3 CALCULUS II - AY2020/21 27 / 101


• Saddle point

However, note that at a stationary point (a, b), the value f (a, b) may or
may not be a local maximum or a local minimum.

So we have the following definition.

Definition (8.)
A point (a, b) is called a saddle point of f if it is a stationary point but
neither local maximum nor local minimum.

In other words, fx (a, b) = fy (a, b) = 0, but f (a, b) is neither a local


maximum nor local minimum.

MATH1.3 CALCULUS II - AY2020/21 28 / 101


Example (9. Back to Example 4)
Let f (x, y ) = y 2 − y 4 − x 2 .
1
(a) Explain why f has a local maximum at stationary points (0, ± √ ).
2
(b) Is f (x, y ) a local extremum at the stationary point (0, 0)?

Solution. We have found above that stationary points of f are (0, 0),
(0, √1 ), and (0, − √1 ).
2 2

(a) We rewrite f (x, y ) in completing squares as follows

1 2
 
1 2 1
f (x, y ) = − y − − x 2 ≤ , for all (x, y ).
4 2 4
 1  1
Also we have f 0, ± √ = .
 2  4
Thus both points 0, ± √1 give local maximum values. (In fact,
2
they are global maximum.)
MATH1.3 CALCULUS II - AY2020/21 29 / 101
(b) The origin (0, 0) is a stationary point, and f (0, 0) = 0.

Note that
- along x = 0, f (x, y ) = y 2 − y 4 = y 2 (1 − y 2 )≥ 0 = f (0, 0), if
−1 ≤ y ≤ 1.

- along y = 0, f (x, y ) = −x 2 ≤ 0 = f (0, 0), for all x.

Thus every disk centered at (0, 0) contains points where f takes


positive values as well as points where f is negative.

These show that value f (0, 0) is neither a local maximum nor a


local minimum.

So the function f (x, y ) = y 2 − y 4 − x 2 has a saddle point at (0, 0).

MATH1.3 CALCULUS II - AY2020/21 30 / 101


• Diagram: Saddle point of f = y 2 − y 4 − x 2

MATH1.3 CALCULUS II - AY2020/21 31 / 101


• Second-order derivative test for local extrema

Theorem (10. Second-order Derivative Test)


Suppose the second-order partial derivatives of f are continuous in a
disk centered at (a, b), and ∇f (a, b) = 0, i.e., fx (a, b) = fy (a, b) = 0.
Let
D = D(a, b) = fxx (a, b)fyy (a, b) − [fxy (a, b)]2 .

Then we have
(a) If D > 0 and fxx (a, b) > 0, then f (a, b) is a local minimum.
(b) If D > 0 and fxx (a, b) < 0, then f (a, b) is a local maximum.
(c) If D < 0, then f (a, b) is not a local extremum (a saddle point.)

MATH1.3 CALCULUS II - AY2020/21 32 / 101


Remarks.
1 To remember the formula for the discriminant
" # D, it is convenient to
fxx fxy
write it as a determinant D = det .
fyx fyy

2 In case (c), D < 0, (a, b) is a saddle point of f .

3 If D = 0, the test gives no information: f could be a local


maximum, a local minimum at (a, b), or (a, b) could be a saddle
point of f .

MATH1.3 CALCULUS II - AY2020/21 33 / 101


Example (11. Back to Example 9)
Classify all stationary points for f (x, y ) = y 2 − y 4 − x 2 .

Solution. We have found above that stationary points of f are (0, 0),
(0, √1 ), and (0, − √1 ).
2 2

We use the Second-order Derivative Test to classify them. Since

fxx = −2, fxy = 0, fyx = 0, fyy = 2−12y 2 =⇒ D(x, y ) = −2(2−12y 2 ).

At (0, 0) we have D(0, 0) = −4 < 0, and hence (0, 0) is a saddle


point.
At (0, ± √1 ) we have D(0, ± √1 ) = −2(2 − 6) = 4 > 0, and
2 2
1
fxx = −2 < 0. Then f (0, ± √ ) are local maximum.
2

MATH1.3 CALCULUS II - AY2020/21 34 / 101


Example (12.)
Find the local extrema of f (x, y ) = x 4 + y 4 − 4xy + 1.

Solution. Note that ∇f (x, y ) = (4x 3 − 4y , 4y 3 − 4x). Then


 
x 3 − y = 0 y = x 3
∇f (x, y ) = 0 ⇐⇒ ⇐⇒
y 3 − x = 0 x = y 3 .

So we have x = x 9 and hence

0 = x 9 − x = x(x 8 − 1) = x(x 4 − 1)(x 4 + 1)


= x(x − 1)(x + 1)(x 2 + 1)(x 4 + 1),

which gives x = 0, x = 1 or x = −1.

Thus there are three critical points: (0, 0),(1, 1), and (−1, −1).
MATH1.3 CALCULUS II - AY2020/21 35 / 101
Example 12 (cont.)

The discriminant of second-order derivatives is

D(x, y ) = fxx fyy − [fxy ]2 = (12x 2 ) · (12y 2 ) − (−4)2 = 144x 2 y 2 − 16.

Since D(0, 0) = −16 < 0, it follows that (0, 0) is a saddle point.

Since D(1, 1) = 128 > 0 and fxx (1, 1) > 0, it follows that
f (1, 1) = −1 is a local minimum.

Since D(−1, −1) = 128 > 0 and fxx (−1, −1) > 0, it follows that
f (−1, −1) = −1 is also a local minimum.

MATH1.3 CALCULUS II - AY2020/21 36 / 101


• Global Maximum and Minimum Values

Definition (13.)
(a) A function f of two variables has a global (absolute) maximum on
its domain D at a point (a, b) if

f (x, y ) ≤ f (a, b), for all points (x, y ) ∈ D.

The number f (a, b) is called a global (absolute) maximum value.

(b) If the inequality above is replaced by

f (x, y ) ≥ f (a, b), for all points (x, y ) ∈ D,

then f has a global (absolute) minimum on D at a point (a, b), and


f (a, b) is called a global (absolute) minimum value.

MATH1.3 CALCULUS II - AY2020/21 37 / 101


Example (14.)
Find the global minimum of f (x, y ) = x 2 + y 2 − 2x − 6y + 14 on R2 .

Solution. Completing the squares for f , we have

f (x, y ) = 4 + (x − 1)2 + (y − 3)2 ≥ 4, for all x and y .

Equality occurs when (x − 1)2 = (y − 3)2 = 0 ⇐⇒ x = 1, y = 3.

Then the value f (1, 3) = 4 is the global minimum of f .

Note that f (x, y ) does not have a global maximum.

MATH1.3 CALCULUS II - AY2020/21 38 / 101


• Existence of global Max/Min values

In general, the global maximum or minimum of a function may not exist.

However, when f is continuous and the domain satisfies some nice


conditions, the existence of global extrema is guaranteed.

Theorem (15.)
Suppose f (x, y ) is continuous in its domain D, where D is closed and
bounded. Then f has global maximum and global minimum.

MATH1.3 CALCULUS II - AY2020/21 39 / 101


• Examples of closed sets

MATH1.3 CALCULUS II - AY2020/21 40 / 101


Outline

1 Directional Derivatives

2 Maximum & Minimum Rate of Change

3 Optimization Problems

4 Double Integrals

MATH1.3 CALCULUS II - AY2020/21 41 / 101


3. Optimization Problems

In optimization problems we are looking for the largest value or the


smallest value that a function can take.

For example,
Find the shortest distance from the point (1, 2) to the curve
xy = 4.

Suppose the temperature on a hot plate is T (x, y ) = x − y . Find


the hottest spot on the ellipse 2x 2 + 9y 2 = 16.

What is the least surface area of a closed right circular cylindrical


can whose volume is 18π cm3 ?

A rectangular box without a lid is to be made from 12m2


cardboard. Find the maximum volume of such a box.
MATH1.3 CALCULUS II - AY2020/21 42 / 101
• Lagrange Multiplier - One constraint

We discuss the method of Lagrange multipliers for maximizing or


minimizing a function f (x, y ) subject to a constraint of the form
g(x, y ) = k . That is

f (x, y ) −→ max/min
g(x, y ) = k .

MATH1.3 CALCULUS II - AY2020/21 43 / 101


• Lagrange Multipliers for f (x, y )

ASSUMPTION: Global extreme values exist.

Algorithm (1. Lagrange Multipliers for f (x, y ))


To find the maximum and minimum values of f (x, y ) subject to the
constraint g(x, y ) = k , we do the following steps:

Step 1. Find all values of x, y , and λ satisfying the equations

∇f (x, y ) = λ∇g(x, y ) and g(x, y ) = k .

Step 2. Evaluate f at all points (x, y ) that are found from Step 1.
The largest of these values is the maximum value, while the
smallest of these values is the minimum value.

MATH1.3 CALCULUS II - AY2020/21 44 / 101


• Remark.
1 If λ = 0, then ∇f (x, y ) gives stationary points of f .

2 If λ 6= 0, then both vectors ∇f (x, y ) and g(x, y ) are parallel or


opposite each to other.

• Diagram: ∇f (x, y ) = λ∇g(x, y )

MATH1.3 CALCULUS II - AY2020/21 45 / 101


Example (2.)
Find the extreme values of the function f (x, y ) = x 2 + 2y 2 on the circle
x 2 + y 2 = 1.

MATH1.3 CALCULUS II - AY2020/21 46 / 101


Example 2 (cont.)
Solution. The circle x 2 + y 2 = 1 is closed and bounded, and the
function f (x, y ) = x 2 + 2y 2 is continuous everywhere on R2 . Then the
maximum and minimum  values of f exist.
f (x, y ) = x 2 + 2y 2 −→ max / min
We have the problem
g(x, y ) = x 2 + y 2 = 1.

We apply the method of Lagrange multipliers which means to solve the


equations
∇f = λ∇g and g(x, y ) = 1.
Since ∇f = λ∇g means fx = λgx and fy = λgy , we have
2x = 2xλ (1)
4y = 2y λ (2)
x 2 + y 2 = 1. (3)
MATH1.3 CALCULUS II - AY2020/21 47 / 101
Example 2 (cont.)

From (1) 2x = 2xλ, we have x(1 − λ) = 0, which gives x = 0 or λ = 1.


- If x = 0, then (3) x 2 + y 2 = 1 gives y = ±1.
- If λ = 1, then (2) 4y = 2y λ and we have 2y = 0 ⇐⇒ y = 0, and
hence by (3) x = ±1.

Thus the maximum and minimum of f are at the following fours points
(0, ±1), (±1, 0).

Evaluating f at these points, we have f (0, ±1) = 2, f (±1, 0) = 1.

Consequently, the maximum value of f on the circle x 2 + y 2 = 1 is 2,


attained at (0, ±1), while the minimum value of f on this circle is 1,
attained at (±1, 0).

MATH1.3 CALCULUS II - AY2020/21 48 / 101


• Lagrange Multipliers for f (x, y , z)
The Algorithm is the same as for functions of two variables, adding the
third variable z.
ASSUMPTION: Global extreme values exist.

Algorithm (3. Lagrange Multipliers for f (x, y , z))


To find the maximum and minimum values of f (x, y , z) subject to the
constraint g(x, y , z) = k , we do the following steps:

Step 1. Find all values of x, y , z, and λ satisfying the conditions

∇f (x, y , z) = λ∇g(x, y , z) and g(x, y , z) = k .

Step 2. Evaluate f at all points (x, y , z) that are found from Step 1.
The largest of these values is the maximum value, while the
smallest of these values is the minimum value.
MATH1.3 CALCULUS II - AY2020/21 49 / 101
Example (4.)
A rectangular box without a lid is to be made from 12m2 cardboard.
Find the maximum volume of such a box.

Solution. Let x, y , z denote respectively the length, width and height


of the box (x > 0, y > 0, z > 0). Then the box’s volume V = xyz and
the box’s area (withouta lid) is g(x, y , z) = 2xz + 2yz + xy = 12.
V (x, y , z) = xyz −→ max
We have the problem
g(x, y , z) = 2xz + 2yz + xy = 12.

We solve equations ∇V = λ∇g and g(x, y , z) = 12, which become


yz = λ(2z + y ) (4)
xz = λ(2z + x) (5)
xy = λ(2x + 2y ) (6)
2xz + 2yz + xy = 12. (7)
MATH1.3 CALCULUS II - AY2020/21 50 / 101
Example 4 (cont.)

Multiplying (4) by x, (5) by y , and (6) by z, we have

xyz = λ(2xz + xy ) (8)


xyz = λ(2yz + xy ) (9)
xyz = λ(2xz + 2yz). (10)

It is important to note that λ 6= 0, for otherwise, yz = xz = xy = 0 from


(4), (5), and (6), which would contradict (7).

From (8) and (9), we have 2xz + xy = 2yz + xy , which gives x = y .

From (9) and (10), we have 2yz + xy = 2xz + 2yz, which yields y = 2z.

MATH1.3 CALCULUS II - AY2020/21 51 / 101


Example 4 (cont.)

Now substituting x = y = 2z into (7) (which is 2xz + 2yz + xy = 12),


we have

4z 2 + 4z 2 + 4z 2 = 12 ⇐⇒ z2 = 1 ⇐⇒ z = 1,

which gives x = y = 2.

This is the only point we found, and V (2, 2, 1) = 4.

To check whether 4 is max or min, we just take any point (x, y , z) with
g(x, y , z) = 12 and compute V (x, y , z) to compare with 4.
 5  5  10
=⇒ Take say 2, 1, , for which V 2, 1, = < 4. So we
3 3 3
conclude that V (2, 2, 1) = 4 is the maximum volume.

MATH1.3 CALCULUS II - AY2020/21 52 / 101


Outline

1 Directional Derivatives

2 Maximum & Minimum Rate of Change

3 Optimization Problems

4 Double Integrals

MATH1.3 CALCULUS II - AY2020/21 53 / 101


4. Double Integrals
Z b
Recall: Definite integral f (x) dx
a
Let f be a continuous function on [a, b].
We partition the interval [a, b] into n subintervals of equal length
b−a
∆x = by x0 = a < x1 < x2 < . . . < xn = b.
n ∗ ∗
We also let x1 , x2 , . . . , xn∗ be sample points from each subinterval,
so xk∗ ∈ [xk −1 , xk ].
Then the definite integral of f from a to b is
Z b Xn
f (x) dx = lim f (xk∗ )∆x.
a n→∞
k =1
(independent of a choice of sample points (xk∗ )).
X n
The expression f (xk∗ )∆x is called a Riemann sum.
k =1
MATH1.3 CALCULUS II - AY2020/21 54 / 101
MATH1.3 CALCULUS II - AY2020/21 55 / 101
• Double Integrals
The idea of a definite integral is generalized to double integrals of
functions of two variables.

• Our aim: To study the integral of a function of two variables f (P)


over a region D in the plane R2 , with the notation D f (P) dA.
RR

• Diagram: Double integral

MATH1.3 CALCULUS II - AY2020/21 56 / 101


• Application: Volume under a surface over a region D
Consider a solid over a region D of the xy -plane.
Suppose f (P) ≥ 0 is the height at each point P ∈ D, where f is a
continuous function on D.
Application 1.
The volume V of the solid is given by
ZZ
V = f (P) dA.
D

Note that the solid lies above D and under the surface z = f (P).
Remark. In particular, when f (P) = 1 on D, we obtain the area A(D) of
the region D as ZZ
A(D) = 1 dA.
D
MATH1.3 CALCULUS II - AY2020/21 57 / 101
• Application: Total charge, total mass, and moment of
a lamina

Suppose a lamina (thin plate) occupies a region D of R2 .

• An electric charge is distributed over D and the charge density (in


units of charge per unit area) is given by σ(P) at a point P in D, where
σ is a continuous function on D.

Application 2.
The total charge Q is given by
ZZ
Q= σ(P) dA.
D

MATH1.3 CALCULUS II - AY2020/21 58 / 101


• The density (in units of mass per unit area) is given by ρ(x, y ) at a
point (x, y ) in D, where ρ is a continuous function on D.

Application 3.
(a) The total mass M is given by
ZZ
M= ρ(x, y ) dA.
D

(b) The moment of the entire lamina about the x-axis, respectively
y -axis, is
ZZ ZZ
Mx = y ρ(x, y ) dA, respectively My = xρ(x, y ) dA.
D D

(c) The coordinates (x̄, ȳ ) of the center of the mass of the lamina are

My Mx
x̄ = , ȳ = .
M M
MATH1.3 CALCULUS II - AY2020/21 59 / 101
• Double Integrals over Rectangles
ZZ
We begin with discussing the double integral f (x, y ) dA of a
R
function f (x, y ) over a closed rectangle R in R2 , where

R = [a, b] × [c, d] = {(x, y ) ∈ R2 : a ≤ x ≤ b, c ≤ y ≤ d}.

MATH1.3 CALCULUS II - AY2020/21 60 / 101


We partition both intervals [a, b] and [c, d] into:

a = x0 < x1 < x2 < . . . < xi−1 < xi < . . . < xm = b,


c = y0 < y1 < y2 < . . . < yj−1 < yj < . . . < yn = d.

Then R are partitioned into mn sub-rectangles:



Rij = [xi−1 , xi ] × [yj−1 , yj ] = (x, y ) : xi−1 ≤ x ≤ xi , yj−1 ≤ y ≤ yj

for i = 1, ..., m and j = 1, ..., n.

The area of Rij is

∆Aij = (xi − xi−1 ) · (yj − yj−1 ) = ∆x · ∆y .

MATH1.3 CALCULUS II - AY2020/21 61 / 101


• Diagram: Partitioning rectangle R

MATH1.3 CALCULUS II - AY2020/21 62 / 101


• On sub-rectangles

In each sub-rectangle Rij , we choose a point (xij∗ , yij∗ ) and compute the
value  
f xij∗ , yij∗ ∆Aij .

We define the double Riemann sum as


m X
X n
f (xij∗ , yij∗ )∆Aij .
i=1 j=1

MATH1.3 CALCULUS II - AY2020/21 63 / 101


• Diagram: f (xij∗ , yij∗ )∆Aij

MATH1.3 CALCULUS II - AY2020/21 64 / 101


• Diagram: Approximating sums

MATH1.3 CALCULUS II - AY2020/21 65 / 101


• Double integral over R

Definition (4.)
The double integral of f (x, y ) over R is defined as follows:
ZZ X n
m X
f (x, y ) dA = lim f (xij∗ , yij∗ )∆Aij ,
R kPk→0
i=1 j=1

if the limit exists, where kPk denotes the longest diagonal of all the
sub-rectangles Rij ’s, xij∗ , yij∗ and ∆Aij as defined above.

Remark. It is usually difficult to evaluate double integrals by definition.


Therefore, we learn how to evaluate such integrals in the sequel.

MATH1.3 CALCULUS II - AY2020/21 66 / 101


• Iterated Integrals

Now, we see how a double integral can be expressed as an iterated


integral, which can be evaluated by calculating two single integrals.

Suppose f (x, y ) is a function of two variables that is continuous over


the rectangle R = [a, b] × [c, d].

MATH1.3 CALCULUS II - AY2020/21 67 / 101


• Via slicing, keeping x fixed

The volume of each thin slice is A(x) · δx.


Z d
For a fixed value of x, we have A(x) = f (x, y ) dy .
c !
Z d
Then the volume of each thin slice is A(x) · δx = f (x, y ) dy · δx.
c

MATH1.3 CALCULUS II - AY2020/21 68 / 101


Summing the volumes of all slices, and allowing the δx to be smaller
and smaller, we obtain
!
Z Z b d
f (x, y ) dy dx.
a c

Z b Z d
• Iterated integral f (x, y ) dy dx
a c
The iterated integral
!
Z b Z d Z b Z d
f (x, y ) dy dx = f (x, y ) dy dx
a c a c

is obtained by
first integrate w.r.t. y (holding x fixed) from y = c to y = d,
then integrate the resulting function w.r.t. x from x = a to x = b.

MATH1.3 CALCULUS II - AY2020/21 69 / 101


• Via slicing, keeping y fixed
Similarly, we can also have compute a double integral via slicing,
keeping y fixed, to get the iterated integral.
Z dZ b
• Iterated integral f (x, y ) dx dy
c a
The iterated integral
!
Z d Z b Z d Z b
f (x, y ) dx dy = f (x, y ) dx dy
c a c a

is obtained by
first integrate w.r.t. x (holding y fixed) from x = a to x = b,
then integrate the resulting function w.r.t. y from y = c to y = d.

MATH1.3 CALCULUS II - AY2020/21 70 / 101


ZZ
• Evaluating f (x, y ) dA
R

Z b Z d Z d Z b
Both f (x, y ) dy dx and f (x, y ) dx dy are iterated
a c c a
integrals (but w.r.t. different orders of x and y ).

We have the following important result.

Theorem (5. Fubini’s Theorem)


If f is continuous on the rectangle
R = [a, b] × [c, d] = {(x, y ) ∈ R2 : a ≤ x ≤ b, c ≤ y ≤ d}, then
ZZ Z b Z d Z d Z b
f (x, y ) dA = f (x, y ) dy dx = f (x, y ) dx dy .
R a c c a

MATH1.3 CALCULUS II - AY2020/21 71 / 101


Example (6.)
ZZ
Evaluate the double integral (x − 3y 2 ) dA, where R = [0, 2] × [1, 2].
R

Solution. By Fubini’s Theorem, we have two ways to do:


• Integrating w.r.t. y first:
ZZ Z 2Z 2 Z 2h i2
2 2
(x − 3y ) dA = (x − 3y ) dy dx = xy − y 3 dx
R 0 1 0 1
2 2
x2
Z 
= (x − 7) dx = − 7x = −12.
0 2 0
• Integrating w.r.t. x first:
ZZ Z 2Z 2 Z 2 2 2
2 2 x 2
(x − 3y ) dA = (x − 3y ) dx dy = − 3y x dy
R 1 0 1 2 0
Z 2 h i2
= (2 − 6y 2 ) dy = 2y − 2y 3 = −12.
1 1

MATH1.3 CALCULUS II - AY2020/21 72 / 101


Example (7.)
ZZ
Evaluate y sin(xy ) dA, where R = [1, 2] × [0, π].
R

Solution. By Fubini’s Theorem, we may evaluate the double integral


as follows (w.r.t. x first):
ZZ Z π Z 2 Z π h ix=2
y sin(xy ) dA = y sin(xy ) dx dy = dy − cos(xy )
R 0 1 0x=1
sin(2y ) π
Z π  
= [cos y − cos(2y )] dy = sin y − =0
0 2 0

MATH1.3 CALCULUS II - AY2020/21 73 / 101


Example 7 (another solution)
• Question: How about the other order of integration (i.e. integrate
w.r.t. y first)?

We have ZZ Z 2Z π
y sin(xy ) dA = y sin(xy ) dy dx.
R 1 0

In this case, we should use integration by parts for the internal integral:
 y =π
Z π   Z π  
 − cos(xy )  − cos(xy )
y sin(xy ) dy =  y
  − 1 dy
0 |{z} | {z } |{z} x 
0
|{z}
0
x
u v0 u | {z } u | {z }
v y =0 v

sin(xy ) y =π
 
−π cos(πx) 1 π
= + 2
= 2 sin πx − cos πx.
x x y =0 x x

MATH1.3 CALCULUS II - AY2020/21 74 / 101


Hence,
ZZ Z 2 
1 π
y sin(xy ) dA = 2
sin πx − cos πx dx.
R 1 x x

Now, observe that


 
1 π d − sin πx
sin πx − cos πx = .
x2 x dx x

Therefore, we have
ZZ  2
sin πx sin 2π sin π
y sin(xy ) dA = − =− + = 0.
R x 1 2 1

This way is clearly more complicated!

MATH1.3 CALCULUS II - AY2020/21 75 / 101


• Double integrals over general regions - I
• Non-rectangular region D of type I

Consider the region D in the sketch:

The values of x run from a to b.


For each fixed x, the values of y run from g1 (x) to g2 (x) (on the
boundaries, y can be expressed in terms of x).
MATH1.3 CALCULUS II - AY2020/21 76 / 101
We describe D as
n o
D = (x, y ) : a ≤ x ≤ b, g1 (x) ≤ y ≤ g2 (x) .

Theorem (8.)
If f is continuous on a region D of type I, i.e. on
n o
D = (x, y ) : a ≤ x ≤ b, g1 (x) ≤ y ≤ g2 (x) ,

then ZZ Z b Z g2 (x)
f (x, y ) dA = f (x, y ) dy dx.
D a g1 (x)

MATH1.3 CALCULUS II - AY2020/21 77 / 101


• Diagram: Type I
The area of the vertical slice shown here is A(x). To calculate the
volume of the solid, we integrate this area from x = a to x = b:
Z b Z b Z g2 (x)
A(x) dx = f (x, y ) dy dx.
a a g1 (x)

MATH1.3 CALCULUS II - AY2020/21 78 / 101


• Double integrals over general regions - I
• Some other non-rectangular regions D of type I

MATH1.3 CALCULUS II - AY2020/21 79 / 101


Example (9.)
ZZ
Evaluate (x + 2y ) dA, where D is the region bounded by the
D
parabolas y = 2x 2 and y = 1 + x 2 .

Solution. It is useful to sketch the region D.


Note that the two parabolas intersect when 2x 2 = 1 + x 2 ⇐⇒ x = ±1.

MATH1.3 CALCULUS II - AY2020/21 80 / 101


From the sketch, we have the values of x run from −1 to 1. For each
fixed x, the values of y run from 2x 2 to 1 + x 2 . Thus
n o
D = (x, y ) : −1 ≤ x ≤ 1, 2x 2 ≤ y ≤ 1 + x 2 .

Then we have
ZZ Z 1 Z 1+x 2
(x + 2y ) dA = (x + 2y ) dy dx
D −1 2x 2
Z 1h iy =1+x 2
= xy + y 2 dx
−1 y =2x 2
Z 1  32
= −3x 4 − x 3 + 2x 2 + x + 1 dx = .
−1 15

MATH1.3 CALCULUS II - AY2020/21 81 / 101


• Double integrals over general regions - II
• Non-rectangular region D of type II

Consider the region D in the sketch:

The values of y run from c to d.


For each fixed y , the values of x run from h1 (y ) to h2 (y ) (on the
boundaries, x can be expressed in terms of y ).
MATH1.3 CALCULUS II - AY2020/21 82 / 101
So we have
n o
D = (x, y ) : c ≤ y ≤ d, h1 (y ) ≤ x ≤ h2 (y ) .

Similarly, we have the following result.

Theorem (10.)
If f is continuous on a region D of type II, i.e. on
n o
D = (x, y ) : c ≤ y ≤ d, h1 (y ) ≤ x ≤ h2 (y ) ,

then ZZ Z d Z h2 (y )
f (x, y ) dA = f (x, y ) dx dy .
D c h1 (y )

MATH1.3 CALCULUS II - AY2020/21 83 / 101


• Diagram: Type II
The area of the vertical slice shown here is A(x). To calculate the
volume of the solid, we integrate this area from y = c to y = d:
Z d Z d Z h2 (y )
A(y ) dy = f (x, y ) dx dy .
c c h1 (y )

MATH1.3 CALCULUS II - AY2020/21 84 / 101


• Double integrals over general regions - II
• Some other non-rectangular regions D of type II

MATH1.3 CALCULUS II - AY2020/21 85 / 101


Example (11.)
Find the volume of the solid that lies under the paraboloid z = x 2 + y 2
and above the region D in the xy -plane bounded by the line y = 2x
and the parabola y = x 2 .

Solution. Note that the volume under z = x 2 + y 2 and above D is


ZZ
V = (x 2 + y 2 ) dA.
D
The two parabolas intersect when 2x = x 2 ⇐⇒ x = 0, x = 2.

MATH1.3 CALCULUS II - AY2020/21 86 / 101


• First, we can describe D as a region of type I:
n o
D = (x, y ) : 0 ≤ x ≤ 2, x 2 ≤ y ≤ 2x .

Then the volume under z = x 2 + y 2 and above D is


ZZ Z 2 Z 2x
2 2
V = (x + y ) dA = (x 2 + y 2 ) dy dx
D 0 x2
Z 2  y =2x !
1
= x 2y + y 3 dx
0 3 y =x 2
Z 2
1 216
= − x 3 (x 3 + 3x − 14) dx = .
0 3 35

MATH1.3 CALCULUS II - AY2020/21 87 / 101


Example 11 (Alternative solution)
• We can also describe D as a region of type II:
n y √ o
D = (x, y ) : 0 ≤ y ≤ 4, ≤x ≤ y .
2

MATH1.3 CALCULUS II - AY2020/21 88 / 101


Example 11 (Alternative solution - cont.)

Then, we have

ZZ Z 4Z y
2 2
V = (x + y ) dA = (x 2 + y 2 ) dx dy
D 0 y /2
Z 4 
1 3 13 3 5 216
= y2 − y +y2 dy = .
0 3 24 35

MATH1.3 CALCULUS II - AY2020/21 89 / 101


Example (12.)
ZZ
Evaluate xy dA, where D is the region bounded by the line
D
y = x − 1 and the parabola y 2 = 2x + 6.

Solution. Points of intersection are

(x − 1)2 = 2x + 6 ⇐⇒ x 2 − 4x − 5 = 0
⇐⇒ (x − 5)(x + 1) = 0 ⇐⇒ x = −1, x = 5.

MATH1.3 CALCULUS II - AY2020/21 90 / 101


Example 12 (cont.)
We can describe D as a region of either type I (the left figure) or type II
(the right figure):

MATH1.3 CALCULUS II - AY2020/21 91 / 101


Example 12 (cont.)

If we use a description of D as a region of type II, that is

y2
 
D = (x, y ) : −2 ≤ y ≤ 4, −3≤x ≤y +1 ,
2

then we have
4 y +1 4 x=y +1
x 2y
ZZ Z Z Z 
xy dA = xy dx dy = dy
D −2 y2
−3 −2 2 2
x= y2 −3
2
Z 4
1
= y (−y 4 + 16y 2 + 8y − 32) dy = 36.
−2 8

If we would have used a description of D as a region of type I, then we


would have more work involved - we come back to this later.

MATH1.3 CALCULUS II - AY2020/21 92 / 101


Example (13. Changing the order of integration)
Evaluate the iterated integral
Z 1Z 1
sin(y 2 ) dy dx.
0 x

Solution.
Z If we wish to integrate w.r.t. y first, then we have to evaluate
2
sin(y ) dy . Unfortunately, it is impossible to find the integral of
sin(y 2 ) as it is not an elementary function.

The trick we apply here is to change the order of integration, i.e., we


Z 1Z 1 Z ?Z ?
2
evaluate the integral sin(y ) dy dx by sin(y 2 ) dx dy .
0 x ? ?
How to do?

MATH1.3 CALCULUS II - AY2020/21 93 / 101


Example 13 (cont.)
Technique: Sketch the region D and re-describe it.
Z 1Z 1
From the iterated integral sin(y 2 ) dy dx, we note that
0 x
0 ≤ x ≤ 1, x ≤ y ≤ 1.
Then D is the region
n o
D = (x, y ) : 0 ≤ x ≤ 1, x ≤y ≤1 ,
which is a region of type I (which requires to integrate w.r.t. y first).
Now we sketch D and describe it as the region of type II:
n o
D = (x, y ) : 0 ≤ y ≤ 1, 0 ≤ x ≤ y .
So we evaluate the given integral by changing the order:
Z 1Z 1 Z 1Z y
2
sin(y ) dy dx = sin(y 2 ) dx dy .
0 x 0 0
MATH1.3 CALCULUS II - AY2020/21 94 / 101
Example 13 (cont.)

We have
Z 1Z y Z 1h ix=y
sin(y 2 ) dx dy = x sin(y 2 ) dy
0 0 0 x=0
Z 1
= y sin(y 2 ) dy
0
 1
1 1
= − cos(y 2 ) = (1 − cos 1).
2 0 2

Therefore, Z 1Z 1
1
sin(y 2 ) dy dx = (1 − cos 1).
0 x 2

MATH1.3 CALCULUS II - AY2020/21 95 / 101


Properties of double integrals

• Over Non-overlapping region

Proposition (14.)
If R = R1 ∪ R2 , where R1 and R2 are two non-overlapping regions, then
ZZ ZZ ZZ
f (x, y ) dA = f (x, y ) dA + f (x, y ) dA.
R R1 R2

MATH1.3 CALCULUS II - AY2020/21 96 / 101


Example (15 - Come back to Example 12.)
ZZ
Evaluate xy dA, where D is the region bounded by the line
D
y = x − 1 and the parabola y 2 = 2x + 6.

We already know two descriptions of D, as a region of either type I (the


left figure) or type II (the right figure)

MATH1.3 CALCULUS II - AY2020/21 97 / 101


Example 15 - cont.

If we use a description of D as a region of type I, then D is the union of


two non-overlapping regions D1 ∪ D2 , where
n √ √ o
D1 = (x, y ) : −3 ≤ x ≤ −1, − 2x + 6 ≤ y ≤ 2x + 6

and n √ o
D2 = (x, y ) : −1 ≤ x ≤ 5, x − 1 ≤ y ≤ 2x + 6 .

In this case, by Proposition 14, we have


√ √
ZZ Z −1 Z 2x+6 Z 5 Z 2x+6
xy dA = √ xy dy dx + xy dy dx.
D −3 − 2x+6 −1 x−1

It is clear that this needs more work than the first method.

MATH1.3 CALCULUS II - AY2020/21 98 / 101


• Linear Property of Double Integrals

Proposition (16.)
Suppose
f and g are functions of two variables defined on D,
f and g are both integrable over D.
Then, for any real numbers c and d, we have
ZZ ZZ ZZ
[c f (x, y ) + d g(x, y )] dA = c f (x, y ) dA + d g(x, y ) dA.
D D D

MATH1.3 CALCULUS II - AY2020/21 99 / 101


• Order Properties of Double Integrals

Proposition (17.)
(a) If f (x, y ) ≥ g(x, y ) for all (x, y ) ∈ D, then
ZZ ZZ
f (x, y ) dA ≥ g(x, y ) dA.
D D

(b) If m ≤ f (x, y ) ≤ M for all (x, y ) ∈ D, then


ZZ ZZ ZZ
m dA ≤ f (x, y ) dA ≤ M dA .
| D{z } D
| D{z }
m A(D) M A(D)

MATH1.3 CALCULUS II - AY2020/21 100 / 101


END OF CHAPTER 2

MATH1.3 CALCULUS II - AY2020/21 101 / 101

You might also like