math 209 lab solutions - page not found | university of albertarms8/teaching/labs.pdf ·...

67
MATH 209 Lab Solutions Richard M. Slevinsky 1 November 21, 2013 1 Contact: [email protected]

Upload: ngothu

Post on 25-Nov-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

MATH 209 Lab Solutions

Richard M. Slevinsky1

November 21, 2013

1Contact: [email protected]

Contents

1 Multivariable Functions and Limits 2

2 Partial Derivatives 6

3 Directional Derivatives and Gradients 15

4 Maximum and Minimum Problems 20

5 Lagrange Multipliers 27

6 Double Integrals 36

7 Polar Coordinates, Centre of Mass, Surface Area 42

8 Triple Integrals 46

9 Line Integrals 50

10 Green’s Theorem 55

11 Surface Integrals 57

12 Stokes’ Theorem and the Divergence Theorem 62

1

Lab 1

Multivariable Functions and Limits

Problems

1. Find the domain and range of the following functions and sketch their graphs:

(a) z = f(x, y) =√x2 + y2;

The domain is {(x, y) : x ∈ R, y ∈ R}.The range is {z : z ∈ R, z ≥ 0}.

(b) z = f(x, y) = 3x2;The domain is {(x, y) : x ∈ R, y ∈ R}.The range is {z : z ∈ R, z ≥ 0}.

(c) x = f(y, z) =√

4− y2 − z2.The domain is {(y, z) : y ∈ R, z ∈ R, y2 + z2 ≤ 4}.The range is {x : x ∈ R, 0 ≤ x ≤ 2}.

2. Find each of the following limits, or show that the limit does not exist:

(a) lim(x,y)→(0,0)2x2y

2x4 + 3 y2;

2

Let y = mx2. Then we have:

lim(x,y)→(0,0)

2x2y

2x4 + 3 y2= lim

x→0

2mx4

2x4 + 3m2x4,

= limx→0

2m

2 + 3m2=

2m

2 + 3m2.

But this is different for every value m we choose, so the limit DNE.

(b) lim(x,y)→(0,0)x2y3

2x2 + 3 y2;

Let y = mx. Then we have:

lim(x,y)→(0,0)

x2y3

2x2 + 3 y2= lim

x→0

m3 x5

2x2 + 3m2x2,

= limx→0

m3

2 + 3m2x3 = 0.

Clearly, it works for any line y = mx. However, how can we be sure? Switch to polar coordinates:

lim(x,y)→(0,0)

x2y3

2x2 + 3 y2= lim

r→0

r2 cos2 θr3 sin3 θ

2 r2 cos2 θ + 3 r2 sin2 θ,

= limr→0

cos2 θ sin3 θ

2 cos2 θ + 3 sin2 θr3,

= limr→0

cos2 θ sin3 θ

2 + sin2 θr3 = 0.

(c) lim(x,y)→(e,10)3 ey

2

10 lnx.

Sometimes it is as easy as plugging in the values!

lim(x,y)→(e,10)

3 ey2

10 lnx=

3 e100

10 ln e= 0.3e100.

Exercises

1. Find the domain and range and sketch the graph for each of the following functions:

(a) z = f(x, y) = 2 y;The domain is {(x, y) : x ∈ R, y ∈ R}.The range is {z : z ∈ R}.

(b) y = f(x, z) = 3x2 + z;The domain is {(x, y) : x ∈ R, z ∈ R}.The range is {y : y ∈ R}.

(c) z = f(x, y) =√

12− x2 − y2.The domain is {(x, y) : x ∈ R, y ∈ R, x2 + y2 ≤ 12}.The range is {z : z ∈ R, 0 ≤ z ≤

√12}.

2. Find the limit, or show that the limit does not exist:

3

(a) lim(x,y)→(0,0)x2 − y2

x2 + y2;

Let y = mx, then:

lim(x,y)→(0,0)

x2 − y2

x2 + y2= lim

x→0

x2 −m2x2

x2 +m2x2,

=1−m2

1 +m2.

But this is different for every value m we choose, so the limit DNE.

(b) lim(x,y)→(0,0)6x3√x2 + y2

;

In polar coordinates:

lim(x,y)→(0,0)

6x3√x2 + y2

= limr→0

6 r3 cos3 θ√r2 cos2 θ + r2 sin2 θ

,

= limr→0

6 r3 cos3 θ√r2

= limr→0

6 r2 cos3 θ = 0.

(c) lim(x,y,z)→(2,1,0)x2 − 2 y3 − 4 z

x+ y3 + 2 z.

Substituting values, we find:

lim(x,y,z)→(2,1,0)

x2 − 2 y3 − 4 z

x+ y3 + 2 z=

22 − 2 13 − 4 · 02 + 13 + 2 · 0

=2

3.

3. Show:

(a) lim(x,y)→(0,0)sin(x+ y)

x+ y= 1;

In polar coordinates:

lim(x,y)→(0,0)

sin(x+ y)

x+ y= lim

r→0

sin(r(cos θ + sin θ))

r(cos θ + sin θ), cos θ + sin θ =

√2 sin(θ + π/4)

= limr→0

sin(r√

2 sin(θ + π/4))

r√

2 sin(θ + π/4), Recall : lim

r→0

sin(rα)

rα= 1.

(b) lim(x,y)→(0,0)sinx+ sin y

x+ y= 1. [Hint: sinα+ sinβ = 2 sin

(α+β2

)cos(α−β2

).]

4

Using the hint, we obtain:

lim(x,y)→(0,0)

sinx+ sin y

x+ y= lim

(x,y)→(0,0)

2 sin(x+y

2

)cos(x−y

2

)x+ y

, Recall : cos(0) = 1

= lim(x,y)→(0,0)

sin(x+y

2

)· 1

x+y2

= 1, from part (a).

4. Find the value of k such that f(x, y) =

x4

x2 + y2, (x, y) 6= (0, 0)

k , (x, y) = (0, 0)is continuous at (0, 0). Is f(x, y)

continuous everywhere? Why?

Taking the limit, we find:

lim(x,y)→(0,0)

x4

x2 + y2= lim

r→0

r4 cos4 θ

r2 cos2 θ + r2 sin2 θ,

= limr→0

r2 cos4 θ = 0.

Therefore, k = 0. It is then continuous everywhere, since f(x, y) is otherwise a rational function andthere are no other singularities.

5

Lab 2

Partial Derivatives

Part I

Problems

1. Find the differentials of the following functions and write the tangent plane approximation at the givenpoint (x0, y0). Use this to estimate the function as required below:

(a) f(x, y) = x2 − 2 y2 + tan(x y) +1

x, (x0, y0) = (−2, 0). Estimate f(−1.95,−0.02);

The differential is:

df = fx dx+ fy dy,

=

(2x+ y sec2(x y)− 1

x2

)dx+

(−4 y + x sec2(x y)

)dy.

Evaluating the differential at the point (x0, y0) = (−2, 0), we find:

∆f = f − f0 ≈ fx(x0, y0)∆x+ fy(x0, y0)∆y,

f − 7

2≈(−4− 1

4

)(x+ 2) + (0− 2)(y − 0).

Equivalently, we find the tangent plane:

T (x, y) =7

2− 17

4(x+ 2)− 2 y.

Estimating the function at (−1.95,−0.02):

f(−1.95,−0.02) ≈ T (−1.95,−0.02) =7

2− 17

4(0.05) + 2(0.02),

= 3.3275.

Compare : f(−1.95,−0.02) ≈ 3.3279.

(b) f(x, y, z) = ln(x y) + ey z + sin(x z), (x0, y0, z0) = (2, 4, π). Estimate f(−1.9, 4.1, π).The differential is:

df = fx dx+ fy dy + fz dz,

=

(1

x+ z cos(x z)

)dx+

(1

y+ z ey z

)dy + (y ey z + x cos(x z)) dz.

6

Evaluating the differential at the point (x0, y0) = (2, 4, π), we find:

∆f = f − f0 ≈ fx(x0, y0, z0)∆x+ fy(x0, y0, z0)∆y + fz(x0, y0, z0)∆z,

f − ln(8)− e4π ≈(π +

1

2

)(x− 2) +

(π e4π +

1

4

)(y − 4) +

(4 e4π + 2

)(z − π).

Equivalently, we find the tangent plane:

T (x, y, z) = ln(8) + e4π +

(π +

1

2

)(x− 2) +

(π e4π +

1

4

)(y − 4) +

(4 e4π + 2

)(z − π).

Estimating the function at (1.9, 4.1, π):

f(1.9, 4.1, π) ≈ T (1.9, 4.1, π) = ln(8) + e4π +

(π +

1

2

)(1.9− 2) +

(π e4π +

1

4

)(4.1− 4),

= 3.768× 105.

Compare : f(1.9, 4.1, π) ≈ 3.926× 105.

2. The ideal gas law relates pressure P , volume V , and temperature T of an ideal gas by PV = kT . where

k is a constant. Show that∂P

∂V

∂V

∂T

∂T

∂P= −1.

7

We find:

∂P

∂V= −kT

V 2,

∂V

∂T=k

P=PV

PT=V

T,

∂T

∂P=V

k.

Therefore, combining all the results, we find:

∂P

∂V

∂V

∂T

∂T

∂P= −kT

V 2× V

T× V

k= −1.

Exercises

1. If z = f(x, y) = arctan(x y), verify that fxy = fyx;

We find:

fx =y

1 + (x y)2,

fxy =1 + (x y)2 − y x2 y

(1 + (x y)2)2=

1

(1 + (x y)2)2,

while:

fy =x

1 + (x y)2,

fyx =1 + (x y)2 − x y2 x

(1 + (x y)2)2=

1

(1 + (x y)2)2.

Therefore, they are equal.

2. Find the differential of f(x, y) = x y2 +√x+ y. Find the equation of the tangent plane to the graph

of z = f(x, y) at (x0, y0) = (3, 1) and use it to estimate f(2.9, 0.9).

The differential is:

df = fx dx+ fy dy,

=

(y2 +

1

2√x+ y

)dx+

(2x y +

1

2√x+ y

)dy.

Evaluating the differential at the point (x0, y0) = (3, 1), we find:

∆f = f − f0 ≈ fx(x0, y0)∆x+ fy(x0, y0)∆y,

f − 5 ≈(

1 +1

4

)(x− 3) +

(6 +

1

4

)(y − 1).

Equivalently, we find the tangent plane:

T (x, y) = 5 +5

4(x− 3) +

25

4(y − 1).

8

Estimating the function at (2.9, 0.9):

f(2.9, 0.9) ≈ T (2.9, 0.9) = 5 +5

4(−0.1) +

25

4(−0.1),

= 4.25.

Compare : f(2.9, 0.9) ≈ 4.2984.

3. Find the differential of f(x, y, z) =√xy2 cos z. Find the equation of the tangent plane to the graph of

w = f(x, y, z) at (x0, y0, z0) = (4, 5, 4π) and use it to estimate f(3.99, 4.98, 4.03π).

The differential is:

df = fx dx+ fy dy + fz dz,

=

(y2 cos z

2√x

)dx+

(2√xy cos z

)dy +

(−√xy2 sin z

)dz.

Evaluating the differential at the point (x0, y0) = (4, 5, 4π), we find:

∆f = f − f0 ≈ fx(x0, y0, z0)∆x+ fy(x0, y0, z0)∆y + fz(x0, y0, z0)∆z,

f − 50 ≈(

25

4

)(x− 4) + (20) (y − 5) + (0) (z − 4π).

Equivalently, we find the tangent plane:

T (x, y, z) = 50 +25

4(x− 4) + 20(y − 5).

Estimating the function at (3.99, 4.98, 4.03π):

f(3.99, 4.98, 4.03π) ≈ T (3.99, 4.98, 4.03π) = 50 +25

4(−0.01) + 20(−0.02),

= 49.5375.

Compare : f(3.99, 4.98, 4.03π) ≈ 49.3189.

Part II

Problems

1. Let z = cos(x+ 2 y), x = u2 v, and y = u v. Find∂2z

∂u2and

∂2z

∂u∂v;

Since:∂z

∂u=∂z

∂x

∂x

∂u+∂z

∂y

∂y

∂u,

we have:

∂2z

∂u2=

∂u

{∂z

∂x

∂x

∂u+∂z

∂y

∂y

∂u

},

=

(∂2z

∂x2∂x

∂u+

∂2z

∂x∂y

∂y

∂u

)∂x

∂u+∂z

∂x

∂2x

∂u2+

(∂2z

∂y2∂y

∂u+

∂2z

∂x∂y

∂x

∂u

)∂y

∂u+∂z

∂y

∂2y

∂u2,

9

and:

∂2z

∂u∂v=

∂v

{∂z

∂x

∂x

∂u+∂z

∂y

∂y

∂u

},

=

(∂2z

∂x2∂x

∂v+

∂2z

∂x∂y

∂y

∂v

)∂x

∂u+∂z

∂x

∂2x

∂u∂v+

(∂2z

∂y2∂y

∂v+

∂2z

∂x∂y

∂x

∂v

)∂y

∂u+∂z

∂y

∂2y

∂u∂v.

Therefore:

∂2z

∂u2= (− cos(x+ 2 y)2u v − 2 cos(x+ 2 y)v) 2u v − sin(x+ 2 y)2 v,

+ (−4 cos(x+ 2 y)v − 2 cos(x+ 2 y)2u v) v,

= −4(u+ 1)2v2 cos(x+ 2 y)− 2 v sin(x+ 2 y),

and:

∂2z

∂u∂v=(− cos(x+ 2 y)u2 − 2 cos(x+ 2 y)u

)2u v − sin(x+ 2 y)2u,

+(−4 cos(x+ 2 y)u− 2 cos(x+ 2 y)u2

)v − 2 sin(x+ 2 y),

= −2u v(u+ 1)(u+ 2) cos(x+ 2 y)− 2(u+ 1) sin(x+ 2 y).

2. Let z = f(x, y) and y = g(x). Show that:

d2z

dx2=∂2z

∂x2+ 2

∂2z

∂x∂yg′(x) +

∂2z

∂y2(g′(x)

)2+∂z

∂yg′′(x);

10

Firstly:

dz

dx=∂z

∂x

dx

dx+∂z

∂y

dy

dx,

=∂z

∂x+∂z

∂y

dy

dx.

Then:

d2z

dx2=∂2z

∂x2dx

dx+

∂2z

∂x∂y

dy

dx+

∂2z

∂x∂y

dy

dx

dx

dx+∂2z

∂y2dy

dx

dy

dx+∂z

∂y

d2y

dx2,

=∂2z

∂x2+ 2

∂2z

∂x∂y

dy

dx+∂2z

∂y2

(dy

dx

)2

+∂z

∂y

d2y

dx2,

=∂2z

∂x2+ 2

∂2z

∂x∂yg′(x) +

∂2z

∂y2(g′(x)

)2+∂z

∂yg′′(x).

3. If y = 3f(x+ t)− 2g(x− t), find ytt and yxx;

yt = 3f ′(x+ t) + 2g′(x− t),ytt = 3f ′′(x+ t)− 2g′′(x− t),yx = 3f ′(x+ t)− 2g′(x− t),yxx = 3f ′′(x+ t)− 2g′′(x− t).

4. Find∂z

∂xand

∂z

∂ywhere z − arctan z = x+ y.

Differentiating implicitly:

0 = F (x, y, z) = x+ y + arctan z − z,

=∂F

∂x+∂F

∂z

∂z

∂x,

= 1 +

(1

1 + z2− 1

)∂z

∂x,

or:∂z

∂x=z2 + 1

z2= 1 +

1

z2.

Again, differentiating implicitly:

0 = F (x, y, z) = x+ y + arctan z − z,

=∂F

∂y+∂F

∂z

∂z

∂y,

= 1 +

(1

1 + z2− 1

)∂z

∂y,

or:∂z

∂y=z2 + 1

z2= 1 +

1

z2.

Exercises

11

1. If z = 3x ex y, x = t cos t, and y = t sin t, finddz

dtat t = π/6;

We find:

dz

dt=∂z

∂x

dx

dt+∂z

∂y

dy

dt,

= 3(1 + x y)ex y (cos t− t sin t) + 3x2ex y (sin t+ t cos t) ,

dz

dt

∣∣∣∣t=π/6

= 3

(1 +

π√

3

12

π

12

)eπ

2√3/144

(√3/2− π/12

)+ 3π23/144eπ

2√3/144

(1/2 + π

√3/12

)≈ 2.9457.

2. (Conversion to polar coordinates) If T = 2x3 − 3x y + y2, x = r cos θ, and y = r sin θ, find∂T

∂rand

∂T

∂θ;

We have:

∂T

∂r=∂T

∂x

∂x

∂r+∂T

∂y

∂y

∂r,

=(6x2 − 3 y

)cos θ + (2 y − 3x) sin θ,

and:

∂T

∂θ=∂T

∂x

∂x

∂θ+∂T

∂y

∂y

∂θ,

= −(6x2 − 3 y

)r sin θ + (2 y − 3x) r cos θ.

3. (Conversion to polar coordinates) If x = r cos θ, y = r sin θ, and z = f(x, y), show that:(∂z

∂x

)2

+

(∂z

∂y

)2

=

(∂z

∂r

)2

+1

r2

(∂z

∂θ

)2

;

Since:

∂z

∂r=∂z

∂x

∂x

∂r+∂z

∂y

∂y

∂r,

=∂z

∂xcos θ +

∂z

∂ysin θ,

and:

1

r

∂z

∂θ=

1

r

∂z

∂x

∂x

∂θ+

1

r

∂z

∂y

∂y

∂θ,

= −∂z∂x

sin θ +∂z

∂ycos θ,

12

summing the squares gives:(∂z

∂r

)2

+1

r2

(∂z

∂θ

)2

=

(∂z

∂xcos θ +

∂z

∂ysin θ

)2

+

(−∂z∂x

sin θ +∂z

∂ycos θ

)2

,

=

(∂z

∂x

)2

cos2 θ + 2∂z

∂x

∂z

∂ycos θ sin θ +

(∂z

∂y

)2

sin2 θ,

+

(∂z

∂x

)2

sin2 θ − 2∂z

∂x

∂z

∂ysin θ cos θ +

(∂z

∂y

)2

cos2 θ,

=

(∂z

∂x

)2 (cos2 θ + sin2 θ

)+

(∂z

∂y

)2 (cos2 θ + sin2 θ

),

=

(∂z

∂x

)2

+

(∂z

∂y

)2

.

4. If U = 3f(x, y), x = 5t − 2s, and y = 2t + 2s, express∂2U

∂t∂sin terms of the partial derivatives of f

with respect to x and y;

We have:

∂U

∂s= 3

∂f

∂x

∂x

∂s+ 3

∂f

∂y

∂y

∂s,

= −6∂f

∂x+ 6

∂f

∂y,

∂2U

∂t∂s= −6

∂2f

∂x2∂x

∂t− 6

∂2f

∂x∂y

∂y

∂t+ 6

∂2f

∂y∂x

∂x

∂t+ 6

∂2f

∂y2∂y

∂t,

= −30∂2f

∂x2− 12

∂2f

∂x∂y+ 30

∂2f

∂y∂x+ 12

∂2f

∂y2,

or:∂2U

∂t∂s= −30

∂2f

∂x2+ 18

∂2f

∂y∂x+ 12

∂2f

∂y2.

5. Let z3 + t z = s2 + t2 − 1. Find∂z

∂tand

∂z

∂sat (t, s) = (1, 0);

When t = 1 and s = 0, we have: z3 + z = 0, or z = 0,±i. We reject the imaginary solutions to have areal surface.

Let F (s, t, z) = z3 + t z + 1− s2 − t2 = 0. Then:

0 =∂F

∂t+∂F

∂z

∂z

∂t,

= z − 2 t+(3 z2 + t

) ∂z∂t,

∂z

∂t=

2 t− z3 z2 + t

,

∂z

∂t

∣∣∣∣(t,s,z)=(1,0,0)

=2

1= 2.

13

As well:

0 =∂F

∂s+∂F

∂z

∂z

∂s,

= −2 s+(3 z2 + t

) ∂z∂s,

∂z

∂s=

2 s

3 z2 + t,

∂z

∂s

∣∣∣∣(t,s,z)=(1,0,0)

= 0.

6. Find the equation of the plane tangent to the surface y2 + x z + ln |x y z| = 2 + e at the point (x, y) =

(1, 1).

When x = 1 and y = 1, we have: 1 + z + ln z = 2 + e, or z = e.

Let F (x, y, z) = y2 + x z + ln |x y z| − 2− e = 0. To find the tangent plane, we require the differential,which requires the partial derivatives:

0 =∂F

∂x+∂F

∂z

∂z

∂x,

= z +1

x+

(x+

1

z

)∂z

∂x,

∂z

∂x= −z + x−1

x+ z−1,

∂z

∂x

∣∣∣∣(x,y,z)=(1,1,e)

= − e+ 1

1 + e−1.

And:

0 =∂F

∂y+∂F

∂z

∂z

∂y,

= 2 y +1

y+

(x+

1

z

)∂z

∂y,

∂z

∂y= −2 y + y−1

x+ z−1,

∂z

∂y

∣∣∣∣(x,y,z)=(1,1,e)

= − 5

2(1 + e−1).

Then, the differential is:

dz = −(

e+ 1

1 + e−1

)dx−

(5

2(1 + e−1)

)dy,

and the tangent plane is then:

T (x, y) = e−(

e+ 1

1 + e−1

)(x− 1)−

(5

2(1 + e−1)

)(y − 1).

14

Lab 3

Directional Derivatives and Gradients

Problems

1. Find equations for the tangent plane and the normal line to the surface x y + sin z = 2 at (1, 2, 0);

To form the tangent plane and the normal line, we require the vector n which is normal to plane (andtherefore parallel to the line). If our function can be written as f(x, y, z) = x y + sin z − 2 = 0, asabove, then this vector is in the direction of the gradient:

∇f(x, y, z) =

⟨∂f

∂x,∂f

∂y,∂f

∂z

⟩,

= 〈y, x, cos z〉 ,n = ∇f(x, y, z)|(x,y,z)=(1,2,0) = 〈2, 1, 1〉 .

Then the tangent plane is written as n · (r − r0) = 0, where r is a variable vector and r0 is the pointin question:

〈2, 1, 1〉 · (〈x, y, z〉 − 〈1, 2, 0〉) = 0.

As well, the normal line is written as r(t) = r0 + nt, where t is a parameter:

〈x(t), y(t), z(t)〉 = 〈1, 2, 0〉+ 〈2, 1, 1〉t,= 〈1 + 2 t, 2 + t, t〉.

2. Find the greatest rate of change of the function f(x, y) = ex−y at (x, y) = (1, 1). In which directiondoes this occur?

The gradient of f(x, y) is:

∇f(x, y) =

⟨∂f

∂x,∂f

∂y

⟩,

=⟨ex−y,−1ex−y

⟩= ex−y 〈1,−1〉 ,

∇f(x, y)|(x,y)=(1,1) = 〈1,−1〉 .

Therefore, the greatest rate of change of the function f(x, y) is |∇f | =√

12 + 12 =√

2, and this occursin the direction of the gradient, that is: u = 1√

2〈1,−1〉.

15

Exercises

1. Find the directional derivative of f(x, y, z) = x2 − y z + z2 x at the point P (1,−4, 3) in the directionof the point Q(2,−1, 8) [note: you must first find the vector from P to Q]. What is the maximum rateof increase of f in any direction at P?

The vector from P to Q is QP = (2 − 1,−1 + 4, 8 − 3) = (1, 3, 5) =⇒ u = 1√35〈1, 3, 5〉. The gradient

of f at P is:

∇f(x, y, z) =

⟨∂f

∂x,∂f

∂y,∂f

∂z

⟩,

= 〈2x+ z2,−z, 2x z − y〉,∇f(x, y, z)|(x,y,z)=(1,−4,3) = 〈11,−3, 10〉.

Therefore, the directional derivative in the direction of the point Q is:

Duf = u · ∇f =1√35〈1, 3, 5〉 · 〈11,−3, 10〉,

=11− 9 + 50√

35=

52√35.

The maximum rate of increase of f in any direction at P is:

|∇f | = |〈11,−3, 10〉| ,=√

121 + 9 + 100 =√

230.

2. Find equations for the tangent plane and the normal line to the ellipsoid 4x2 + 9 y2 + z2 − 49 = 0 atthe point P (1,−2, 3);

To form the tangent plane and the normal line, we require the vector n which is normal to plane (andtherefore parallel to the line). If our function can be written as f(x, y, z) = 4x2 + 9 y2 + z2 − 49 = 0,

16

as above, then this vector is in the direction of the gradient:

∇f(x, y, z) =

⟨∂f

∂x,∂f

∂y,∂f

∂z

⟩,

= 〈8x, 18 y, 2 z〉 ,n = ∇f(x, y, z)|(x,y,z)=(1,−2,3) = 〈8,−36, 6〉 .

Then the tangent plane is written as n · (r − r0) = 0, where r is a variable vector and r0 is the pointin question:

〈8,−36, 6〉 · (〈x, y, z〉 − 〈1,−2, 3〉) = 0.

As well, the normal line is written as r(t) = r0 + nt, where t is a parameter:

〈x(t), y(t), z(t)〉 = 〈1,−2, 3〉+ 〈8,−36, 6〉t,= 〈1 + 8 t,−2− 36 t, 3 + 6 t〉.

3. The directional derivative of f(x, y, z) at a given point P is greatest in the direction of the vector〈2, 2,−1〉, and takes the value 2 in this direction. Find the directional derivative of f(x, y, z) at P inthe direction of the vector 〈1,−1, 2〉 [hint: for u a unit vector, then Duf = u · ∇f = |∇f | cos θ];

The maximal value of the directional derivative is given as 2. Therefore we know that |∇f | = 2. Wemust then find the angle between the direction 〈2, 2,−1〉 and 〈1,−1, 2〉, or more precisely the cosine of

17

this angle. From linear algebra, we recall that:

cos θ =u · v||u||||v||

,

=〈1,−1, 2〉 · 〈2, 2,−1〉||〈1,−1, 2〉||||〈2, 2,−1〉||

,

=2− 2− 2√

1 + 1 + 4√

4 + 4 + 1,

=−2√6√

9,

=−2

3√

6.

Therefore, the directional derivative in the direction u = 〈1,−1, 2〉 is Duf = −43√6.

4. Prove that the sphere x2 + y2 + z2 = a2 and the cone x2 + y2 − z2 = 0 are orthogonal at every pointof intersection.

Orthogonality requires their gradients to be orthogonal:

ns = ∇fs = 〈2x, 2 y, 2 z〉,nc = ∇fc = 〈2x, 2 y,−2 z〉.

Therefore, we require the dot product to be equal to 0:

ns · nc = 〈2x, 2 y, 2 z〉 · 〈2x, 2 y,−2 z〉,= 4x2 + 4 y2 − 4 z2,

but the values of z2 must be at once on the sphere, and as well on the cone. Since they are on thecone, z2 = x2 + y2, and therefore:

ns · nc = 4x2 + 4 y2 − 4(x2 + y2) = 0.

18

19

Lab 4

Maximum and Minimum Problems

Problems

1. Find and classify all the critical points of the function f(x, y) = x4 − 12x y + y4;

The critical points occur where the gradient (vector of partial derivatives) is 0:

∇f(x, y) = 〈4x3 − 12 y, 4 y3 − 12x〉,〈0, 0〉 = 〈4x3 − 12 y, 4 y3 − 12x〉.

The first equation implies y = x3/3, and the second equation implies y = (3x)1/3. Therefore, we find:

x3/3 = (3x)1/3,

x9/27 = 3x,

x(x8/27− 3) = 0,

x(x8 − 81) = 0.

The real roots of this equation are x = 0,±811/8 = 0,±31/2. The critical points are therefore (x, y) =

(0, 0),±(31/2, 31/2). The second derivative test requires the determinant:

D(x, y) =

∣∣∣∣∣ fxx(x, y) fxy(x, y)

fyx(x, y) fyy(x, y)

∣∣∣∣∣ ,=

∣∣∣∣∣ 12x2 −12

−12 12 y2

∣∣∣∣∣ ,= 144(x2 y2 − 1).

At the critical points, we find:

Critical point D(x, y) fxx(x, y) Classification(0, 0) -144 N/A Saddle point

(31/2, 31/2) 1152 36 Local minimum(−31/2,−31/2) 1152 36 Local minimum

20

2. Find the absolute minimum of the function f(x, y) = x4 + 2x2 y2 +y4 + 1 inside the circle x2 +y2 = a2

for any a > 0. Conclude that this is the absolute minimum of the function on R2;

The critical points occur where the gradient (vector of partial derivatives) is 0:

∇f(x, y) = 〈4x3 + 4x y2, 4 y3 + 4x2 y〉,〈0, 0〉 = 4〈x3 + x y2, y3 + x2 y〉.

The first equation implies either x = 0 or x2 + y2 = 0, and the second equation implies either y = 0

or x2 + y2 = 0. Therefore, the critical point is (x, y) = (0, 0). The second derivative test requires thedeterminant:

D(x, y) =

∣∣∣∣∣ fxx(x, y) fxy(x, y)

fyx(x, y) fyy(x, y)

∣∣∣∣∣ ,=

∣∣∣∣∣ 12x2 + 4 y2 8x y

8x y 12 y2 + 4x2

∣∣∣∣∣ ,= 144x2 y2 + 48x4 + 48 y4 + 16x2 y2 − 64x2 y2,

= 96x2 y2 + 48x4 + 48 y4.

At the critical point, we find:

Critical point D(x, y) fxx(x, y) Classification(0, 0) 0 0 No info

However, the value of the function at the critical point is f(0, 0) = 0 + 0 + 0 + 1 = 1. Notice, as well,that the function can also be written as f(x, y) = x4 + 2x2 y2 + y4 + 1 = (x2 + y2)2 + 1. Therefore,on the circle x2 + y2 = a2, the function is f(x,±

√a2 − x2) = a4 + 1, so that for any a > 0, f(0, 0) is

smaller than the value of f on the circle.

3. Find the absolute minimum and maximum of the function f(x, y) = (x2− 4x) cos y on the rectangularregion 1 ≤ x ≤ 3, −π

4 ≤ y ≤π4 ;

21

The critical points occur where the gradient (vector of partial derivatives) is 0:

∇f(x, y) = 〈(2x− 4) cos y,−(x2 − 4x) sin y〉,〈0, 0〉 = 〈(2x− 4) cos y,−(x2 − 4x) sin y〉.

The first equation implies either x = 2 or y = ±π2 /∈ [−π/4, π/4], and the second equation implies

either x = 0, x = 4, or y = 0. Therefore, the critical point is (x, y) = (2, 0). The second derivative testrequires the determinant:

D(x, y) =

∣∣∣∣∣ fxx(x, y) fxy(x, y)

fyx(x, y) fyy(x, y)

∣∣∣∣∣ ,=

∣∣∣∣∣ 2 cos y −(2x− 4) sin y

−(2x− 4) sin y −(x2 − 4x) cos y

∣∣∣∣∣ ,= −2(x2 − 4x) cos2 y − (2x− 4)2 sin2 y.

At the critical point, we find:

Critical point D(x, y) fxx(x, y) Classification(2, 0) 8 2 Local minimum

At the critical point, f(2, 0) = −4.

On the line x = 1, we have f(1, y) = −3 cos y, which has a local minimum at y = 0 and local maximaat y = ±π/4. f(1, 0) = −3, f(1,±π/4) = −3/

√2.

On the line x = 3, we have f(3, y) = −3 cos y, which has a local minimum at y = 0 and local maximaat y = ±π/4. f(3, 0) = −3, f(3,±π/4) = −3/

√2.

On the lines y = ±π/4, we have f(x,±π/4) = (x2 − 4x)/√

2. Completing the square, we findf(x,±π/4) = (x− 2)2/

√2− 2

√2. Due to the symmetry about the point x = 2, the local minima are

f(2,±π/4) = −2√

2, and the local maxima are f(2± 1,±π/4) = −3/√

2.

Considering all points, the absolute minimum is f(2, 0) = −4 and the absolute maximum is f(2 ±1,±π/4) = −3/

√2.

22

4. A flat circular plate has the shape of the unit disk x2 + y2 ≤ 1. The plate is heated so that thetemperature at any point (x, y) is given by T (x, y) = x2 + 2 y2−x. Find the hottest and coldest pointsand temperatures on the plate.

The critical points occur where the gradient (vector of partial derivatives) is 0:

∇T (x, y) = 〈2x− 1, 4 y〉,〈0, 0〉 = 〈2x− 1, 4 y〉.

The first equation implies x = 1/2 and the second equation implies y = 0. Therefore, the critical pointis (x, y) = (1/2, 0). The second derivative test requires the determinant:

D(x, y) =

∣∣∣∣∣ Txx(x, y) Txy(x, y)

Tyx(x, y) Tyy(x, y)

∣∣∣∣∣ ,=

∣∣∣∣∣ 2 0

0 4

∣∣∣∣∣ ,= 8.

At the critical point, we find:

Critical point D(x, y) Txx(x, y) Classification(1/2, 0) 8 2 Local minimum

At the critical point, T (1/2, 0) = −1/4.

On the circle y = ±√

1− x2, the temperature is:

T (x,±√

1− x2) = x2 + 2(1− x2)− x,= 2− x− x2,= −(x+ 1/2)2 + 9/4.

Therefore, on the circle, the minimum temperature is T (1, 0) = 0 and the maximum temperature isT (−1/2,±

√3/2) = 9/4.

Therefore, the hottest points are at (−1/2,±√

3/2) and the coldest point is at (1/2, 0).

23

Exercises

1. Classify the relative maxima and minima of f(x, y) = x3 + y3 − 3x− 12 y + 20;

The critical points occur where the gradient (vector of partial derivatives) is 0:

∇f(x, y) = 〈3x2 − 3, 3 y2 − 12〉,〈0, 0〉 = 3〈x2 − 1, y2 − 4〉.

The first equation implies x = ±1, and the second equation implies y = ±2. Therefore, the four criticalpoints are (x, y) = (±1,±2). The second derivative test requires the determinant:

D(x, y) =

∣∣∣∣∣ fxx(x, y) fxy(x, y)

fyx(x, y) fyy(x, y)

∣∣∣∣∣ ,=

∣∣∣∣∣ 6x 0

0 6 y

∣∣∣∣∣ ,= 36x y.

At the critical points, we find:

Critical point D(x, y) fxx(x, y) Classification(1, 2) 72 6 Local minimum

(1,−2) -72 N/A Saddle point(−1, 2) -72 N/A Saddle point

(−1,−2) 72 -6 Local maximum

2. A rectangular box has four sides and a bottom but no top. The volume of the box is 108 m3. Find thedimension of the box such that the surface area is a minimum;

Let l, w, h be the length, width, and height of the box, respectively. Also, let V be the volume and Sbe the surface area. Then, we know that:

V = 108 = l × w × h, and,

S = l × w + 2× l × h+ 2× w × h.

24

From the volume equation, we have h =108

l w. Therefore:

S = l w + 2 (l + w)108

l w,

= l w + 216

(1

w+

1

l

).

Taking the gradient of S, we find:

∇S = 〈0, 0〉 =

⟨w − 216

l2, l − 216

w2

⟩.

From the first equation, w = 216l2

and from the second w = ±√

216l = +

√216l , where the negative width

is excluded on physical grounds. Solving for the length:

216

l2=

√216

l,

√216 = l3/2,

l = 2161/3 = 6,⇒ w = 6, h = 3.

The second derivative test requires the determinant:

D(l, w) =

∣∣∣∣∣ Sll(l, w) Slw(l, w)

Swl(l, w) Sww(l, w)

∣∣∣∣∣ ,=

∣∣∣∣∣ 432l3

1

1 432w3

∣∣∣∣∣ ,=

4322

(l w)3− 1.

At the critical point, we find:

Critical point D(l, w) Sll(l, w) Classification(6, 6) 3 2 Local minimum

25

The dimensions of the box of volume 108 m3 with minimal surface area are (l, w, h) = (6, 6, 3) m.

3. Find the absolute maximum and minimum of the function f(x, y) = 1+4x−5 y on the closed triangularregion with vertices (0, 0), (2, 0), and (0, 3).

Since it is a plane, the absolute maxima and minima will be at one of the vertices. f(0, 0) = 1,f(2, 0) = 9 and f(0, 3) = −14. Therefore, the absolute maximum is 9 and the absolute minimum is−14.

Next week, we will find the global minimum of the function:

f(x, y) = esin(50x) + sin(60 ey) + sin(70 sin(x)) + sin(sin(80 y))− sin(10(x+ y)) +x2 + y2

4.

26

Lab 5

Lagrange Multipliers

Problems

1. Say the temperature T at any point (x, y, z) in space is given by T = 4x y z2. Find the hottest pointon the sphere F = x2 + y2 + z2 − 100 = 0;

We equate gradients:

∇T = λ∇F,4〈y z2, x z2, 2x y z〉 = λ〈2x, 2 y, 2 z〉,

giving us three equations for four unknowns. Adding the constraint F = 0, we have four equations forfour unknowns:

4 y z2 = 2λx,

4x z2 = 2λ y,

8x y z = 2λ z,

x2 + y2 + z2 = 100.

Simplifying by substituting the constraint equation, we find:

4 y(100− x2 − y2) = 2λx,

4x(100− x2 − y2) = 2λ y,

8x y = 2λ.

Again for λ:

4 y(100− x2 − y2) = 8x2 y,

4x(100− x2 − y2) = 8x y2.

And:

100− x2 − y2 = 2x2,

100− x2 − y2 = 2 y2.

27

Or:

100− 3x2 − y2 = 0,

100− x2 − 3 y2 = 0.

Therefore, the values of x and y must solve the above system. By subtraction, we find x = ±5 andy = ±5. At these values, 25 + 25 + z2 = 100, or z2 = 50, and z = ±5

√2. The hottest point occurs

when T at the highest value of T (±5,±5,±5√

2). This occurs when the signs of the x and y values arethe same. Therefore, the hottest points are located at (x, y, z) = (5, 5,±5

√2) and (−5,−5,±5

√2).

2. Show that the product of the angles of a triangle is largest when the triangle is equilateral;

We seek to:

maximize P = θ1θ2θ3 subject to S = θ1 + θ2 + θ3 − 180 = 0,

θi > 0, i = 1, 2, 3.

Equating gradients, we find:

∇P = λ∇S,〈θ2θ3, θ1θ3, θ1θ2〉 = λ〈1, 1, 1〉.

The four equations we have are:

θ2θ3 = λ,

θ1θ3 = λ,

θ1θ2 = λ,

θ1 + θ2 + θ3 = 180.

The top three equations can be rearranged as:

θ3(θ2 − θ1) = 0,

θ1(θ3 − θ2) = 0,

θ2(θ3 − θ1) = 0,

implying θ1 = θ2 = θ3 = 60 from the angular constraint. This is the equilateral triangle.

3. Let C denote the line of intersection of the planes 3x + 2 y + z = 6 and x − 4 y + 2 z = 8. Find thepoint on C that is closest to the origin;

The point that is closest to the origin minimizes the distance, and also the distance squared, which issimpler to work with. Equating gradients:

∇d2(x, y, z) = λP1 + µP2,

2〈x, y, z〉 = λ〈3, 2, 1〉+ µ〈1,−4, 2〉,

28

These three equations with the two planes give:

2x− 3λ− µ = 0,

2 y − 2λ+ 4µ = 0,

2 z − λ− 2µ = 0,

3x+ 2 y + z = 6,

x− 4 y + 2 z = 8.

This system of five equations and five unknowns has the solution (check) x = 11657 , y = −44

57 , z = 8257 ,

λ = 2019 , µ = 52

57 . The closest point is therefore: (x, y, z) = 157(116,−44, 82).

4. A container is constructed in the shape of a cylinder with a top and a bottom (e.g. a beer can). If thesurface area of the container has a fixed value S, find the radius and height of the container that willmaximize the enclosed volume.

The volume of a cylinder is V = πr2h, while the surface area is S = 2πrh+ 2πr2. Therefore, we wishto:

maximize V = πr2h subject to S = 2πrh+ 2πr2.

Equating gradients, we find:

∇V = λ∇S,π〈2 r h, r2〉 = 2πλ〈h+ 2 r, r〉.

These two equations are:

2π r h = 2πλ(h+ 2 r),

π r2 = 2πλ r.

The second equation gives r = 0 or λ = r2 . Since r = 0 won’t maximize anything, inserting the second

possibility into the first equation above:

2π r h = 2πr

2(h+ 2 r),

2h = h+ 2 r,

h = 2 r.

Therefore, the height is twice the size of the radius.

Exercises

1. Find the maximum value of f(x, y, z) = x+ y + z on the sphere x2 + y2 + z2 = 25;

Equating gradients:

∇f = λ∇F,〈1, 1, 1〉 = λ〈2x, 2 y, 2 z〉,

29

giving us three equations for four unknowns. Adding the constraint F = 0, we have four equations forfour unknowns:

1 = 2λx,

1 = 2λ y,

1 = 2λ z,

x2 + y2 + z2 = 25.

Simplifying by substituting into the constraint equation, we find:(1

)2

+

(1

)2

+

(1

)2

= 25,

3

4= 25λ2,

or λ = ±√

3/10. Choosing only the positive branch for the position (otherwise we actually find theminimum value of f), we find x = y = z = 5/

√3. Therefore, the maximum value of f on the sphere is

f(5/√

3, 5/√

3, 5/√

3) = 5√

3.

2. Let C be the curve of intersection of the surface y2−z2 = 1 and the plane x−y = 1. Find the minimumvalue of f(x, y, z) = x2 + y2 + z2 on C;

Letting g1(x, y, z) = y2 − z2 − 1 = 0 and g2(x, y, z) = x− y − 1 = 0, we equate gradients:

∇f = λ∇g1 + µ∇g2,〈2x, 2 y, 2 z〉 = λ〈0, 2 y,−2 z〉+ µ〈1,−1, 0〉.

These three equations with the two surfaces gives five equations for five unknowns:

2x− µ = 0,

2 y − λ2 y + µ = 0,

2 z + λ2 z = 0,

y2 − z2 = 1,

x− y = 1.

From the last and first equations x = 1 + y and therefore µ = 2(1 + y). Inserting this into the secondequation and simplifying:

4 y − λ2 y = −2,

z + λz = 0,

y2 − z2 = 1.

Therefore, from this middle equation, either z = 0 or λ = −1. If z = 0, then y = ±1 from the bottomequation and x = 1 ± 1 = 2, 0 from above. Therefore, f(x, y, z) = 02 + (±1)2 + (1 ± 1)2 = 3 ± 2. Ifλ = −1, then y = −1/3. However, if −1 < y < 1, then from the bottom equation z ∈ C and thereforethe point is not on both curves. The minimum value is f(0,−1, 0) = 1.

30

3. What is the volume of the largest rectangular box (with edges parallel to the axes) which can be

inscribed in the ellipsoidx2

36+y2

9+z2

16= 1?

Since x, y, and z are the coordinate lengths, the volumes of the rectangular boxes with edges parallelto the axes is V = 2x2 y2 z = 8x y z. Therefore, equating gradients:

∇V = λ∇E,

8〈y z, x z, x y〉 = λ

⟨x

18,2 y

9,z

8

⟩.

With the ellipsoidal constraint:

8 y z − λx

18= 0,

8x z − 2λy

9= 0,

8x y − λz

8= 0,

x2

36+y2

9+z2

16= 1.

From the first equation λ = 144 y zx . Therefore:

8x z − 288 y2z

9x= 0,

8x y − 144 y z2

8x= 0,

x2

36+y2

9+z2

16= 1.

Simplifying the top two equations:

x2 − 4 y2 = 0,

4x2 − 9 z2 = 0,

x2

36+y2

9+z2

16= 1.

Solving the top two equations for y2 and z2 and inserting in the ellipsoidal equation, we have:

y2 =x2

4,

z2 =4x2

9,

x2

36+x2

36+x2

36= 1.

Therefore, x2 = 12, or x = ±2√

3, y = ±√

3, and z = ±4/√

3. Taking only the positive points, thelargest box has the volume V (2

√3,√

3, 4/√

3) = 64√

3.

4. Find the point on the plane z = 4x+ 9 y which is closest to the point (1, 1, 2).

31

We seek to minimize the distance (squared) from the point to the plane:

minimize d2P = (x− 1)2 + (y − 1)2 + (z − 2)2 subject to S = 4x+ 9 y − z = 0.

Equating gradients, we find:

∇d2P = λ∇S,2〈x− 1, y − 1, z − 2〉 = λ〈4, 9,−1〉.

With the planar constraint:

2(x− 1)− 4λ = 0,

2(y − 1)− 9λ = 0,

2(z − 1) + λ = 0,

4x+ 9 y − z = 0.

This system of four equations and four unknowns has the solution (check) x = 5049 , y = − 5

49 , z = 5549 ,

and λ = −1249 .

This week, we will find the global minimum of the function:

f(x, y) = esin(50x) + sin(60 ey) + sin(70 sin(x)) + sin(sin(80 y))− sin(10(x+ y)) +x2 + y2

4.

This is problem 4 in The SIAM 100-Digit Challenge [1]. For x and y large, f(x, y) is dominated by theparaboloid x2+y2

4 , since the values of the other terms lie in the intervals [1/e, e], [−1, 1], [−1, 1], [− sin 1, sin 1],and [−1, 1], respectively. Therefore, we know the minimum will be reasonably near the origin. However,what is reasonable? We can break the problem down into three steps:

1. Find a bounded region that contains the minimum;

2. Identify the rough location of the lowest point in that region;

3. Zoom in closer to pinpoint the minimum to high precision.

Part I

We evaluate the function on the 2601 values of x and y from −0.25 to 0.25 in steps of 0.01. The function canbe as small as −3.24. Outside the circle of radius 1, the function is at least e−1−1−1−sin 1−1+ 1

4 > −3.23.Therefore, the minimum must be inside the circle of radius 1.

Part II

Many animals and insects interact with eachother, whether this may be for the purposes of protection frompredators, or for cooperation in hunting, finding shelter, or otherwise [2]. Bees, ants, birds, and fish havebeen studied in particular because they are all relatively easy to study. For example, bee hives host around5,000-10,000 bees, which is few enough to be individually counted and monitored. Insects can communicatewith one another by releasing pheromones into the environment. These pheromones can indicate the sourceand quality of food, or a threat.

32

PSO seeks to use simple algorithmic rules from the insect interactions, apply them to agents with randommotion, and hope to derive meaningful global information of the problem the agents are trying to solve. Forbees and ants that are harvesting food, they may look like [2]:

1. Wander to find food;

2. When I find food, harvest it and lay a trail of pheromones back to hive/hill;

3. If I find a trail, follow it, harvest food, and reinforce the shortest trail with pheromones to hive/hill.

Bees and ants have become the prototype species for PSO and Ant-Colony Optimization (ACO). While theyare similar, the ACO is very similar to the simple rules above, while the PSO takes advantage of the abilityof bees to fly. This results in the Particle Swarm Optimization algorithm [3]:

1. Initialization of agents i = 1, . . . , N , with random positions ~xi and speeds ~vi;

Loop over all agents

2. Evaluate the function f(~xi);

3. Compare the value of the function f(~xi) with the best value of the agent. Let this be the vector ~p. If thecurrent value is the best, replace it;

4. Identify the agent with the best value ~p. Let this be the vector ~g representing the entire swarm’s bestvalue;

5. Update the agents’ positions and velocities as:

~vi ← ω~vi + φpU(0, 1)⊗ (~pi − ~xi) + φgU(0, 1)⊗ (~pg − ~xi),~xi ← ~xi + ~vi. (5.1)

6. Terminate when the optimal value (to an error tolerance) is obtained.

End loop

33

In (5.1), 0 < ω < 1 is an inertial term, −2 < φp < 2, −2 < φg < 2, ⊗ denotes component-wise multiplication,and U(0, 1) denotes a uniformly distributed random variable on the interval [0, 1].

Part III

To get really high precision result, we need something that converges very quickly. Remember the Newton-Raphson method? Suppose we want to find the solution to:

min f(x) =⇒ f ′(x) = 0. (5.2)

Using the linear approximation to f ′(xi), we have:

L(x) = f ′(xi) + (x− xi)f ′′(xi). (5.3)

Setting the linear approximation to 0, we solve:

0 = f ′(xi) + (xi+1 − xi)f ′′(xi), (5.4)

for xi+1 as:

xi+1 = xi −f ′(xi)

f ′′(xi). (5.5)

Suppose, now we have two variables:

min f(x, y) =⇒ ∇f(x, y) = 0. (5.6)

But setting the gradient to 0 is actually a system of two equations:

fx(x, y) = 0, (5.7)

fy(x, y) = 0, (5.8)

with two unknowns x and y. Fortunately, we can form the tangent plane approximation (the generalizationof the linear approximation) to both equations:

Tfx(x, y) = fx(xi, yi) + (x− xi)fxx(xi, yi) + (y − yi)fxy(xi, yi), (5.9)

Tfy(x, y) = fy(xi, yi) + (x− xi)fxy(xi, yi) + (y − yi)fyy(xi, yi), (5.10)

Setting both equations simultaneously to 0 at the new iterate (xi+1, yi+1), we have:[fxx(xi, yi) fxy(xi, yi)

fxy(xi, yi) fyy(xi, yi)

][xi+1 − xiyi+1 − yi

]= −

[fx(xi, yi)

fy(xi, yi)

]. (5.11)

This is a familiar system of two equations for two unknowns. We can solve this![xi+1

yi+1

]=

[xiyi

]−

[fxx(xi, yi) fxy(xi, yi)

fxy(xi, yi) fyy(xi, yi)

]−1 [fx(xi, yi)

fy(xi, yi)

]. (5.12)

34

Bibliography

[1] F. Bornemann et al. Think Globally, Act Locally in The SIAM 100-Digit Challenge, SIAM, 4:77–100,2004.

[2] M. Beekman et al. Biological Foundations of Swarm Intelligence in Swarm Intelligence, Springer-Verlag,1:3–41, 2008.

[3] J. Kennedy and R.C. Eberhart Particle swarm optimization, Proceedings of the IEEE internationalconference on neural networks IV, 1942–1948, 1995.

35

Lab 6

Double Integrals

Problems

1. Evaluate the following integrals:

(a)∫ 3

0

∫ 5

−2(2x y + x) dx dy;

∫ 3

0

∫ 5

−2(2x y + x) dx dy =

∫ 3

0

[x2 y +

x2

2

]5−2

dy,

=

∫ 3

0

(25 y +

25

2− 4 y − 2

)dy,

=

∫ 3

0

(21 y +

21

2

)dy,

=21

2

[y2 + y

]30,

=21

2(9 + 3) = 126.

(b)∫ 1

0

∫ x

0x y dy dx;

∫ 1

0

∫ x

0x y dy dx =

∫ 1

0

[x y2

2

]x0

dx,

=

∫ 1

0

x3

2dx,

=

[x4

8

]10

=1

8.

(c)∫∫

Dey

2dA, where D = {(x, y)| 0 ≤ x ≤ y, 0 ≤ y ≤ 1};

36

∫∫Dey

2dA =

∫ 1

0

∫ y

0ey

2dx dy,

=

∫ 1

0

[x ey

2]y0

dy =

∫ 1

0y ey

2dy =

[ey

2

2

]10

=e− 1

2.

(d)∫ π

0

∫ π

x

sin y

ydy dx;

In this case, D = {(x, y)|x ≤ y ≤ π, 0 ≤ x ≤ π} = {(x, y)| 0 ≤ x ≤ y, 0 ≤ y ≤ π}. Thisequivalence is shown graphically below.

0 pi/3 2 pi/3 pi0

pi/3

2 pi/3

pi

x

y

The region D = {(x,y) | x ≤ y ≤ π, 0 ≤ x ≤ π}or equivalently D = {(x,y) | 0 ≤ x ≤ y, 0 ≤ y ≤ π}.

D

Then:

∫ π

0

∫ π

x

sin y

ydy dx =

∫ π

0

∫ y

0

sin y

ydx dy,

=

∫ π

0

[x

sin y

y

]y0

dy,

=

∫ π

0sin y dy = [− cos y]π0 = 2.

(e)∫ 8

0

∫ 2

x1/3

1

y4 + 1dy dx.

In this case, D = {(x, y)|x1/3 ≤ y ≤ 2, 0 ≤ x ≤ 8} = {(x, y)| 0 ≤ x ≤ y3, 0 ≤ y ≤ 2}. Thisequivalence is shown graphically below.Then:

37

0 1 2 3 4 5 6 7 80

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

x

y

The region D = {(x,y) | x1/3 ≤ y ≤ 2, 0 ≤ x ≤ 8}or equivalently D = {(x,y) | 0 ≤ x ≤ y3, 0 ≤ y ≤ 2}.

D

∫ 8

0

∫ 2

x1/3

1

y4 + 1dy dx =

∫ 2

0

∫ y3

0

1

y4 + 1dx dy,

=

∫ 2

0

[x

y4 + 1

]y30

dy,

=

∫ 2

0

y3

y4 + 1dy =

[1

4ln(y4 + 1)

]20

=1

4ln 17.

Exercises

1. Evaluate:

(a)∫∫

Rx2 y2 dA, R = [0, a]× [0, b];

We find: ∫∫Rx2 y2 dA =

∫ a

0

∫ b

0x2 y2 dy dx,

=

∫ a

0

[x2 y3

3

]b0

dx,

=

∫ a

0

x2 b3

3dx,

=

[x3 b3

9

]a0

=a3b3

9.

(b)∫∫

R

√1− y2 dA, R is the triangle with vertices (0, 0), (1, 0), and (1, 1);

38

We find: ∫∫R

√1− y2 dA =

∫ 1

0

∫ x

0

√1− y2 dy dx,

=

∫ 1

0

∫ 1

y

√1− y2 dx dy,

=

∫ 1

0(1− y)

√1− y2 dy,

=

∫ 1

0

√1− y2 dy −

∫ 1

0y√

1− y2 dy,

4+

[1

3(1− y2)3/2

]10

,

4− 1

3.

(c)∫∫

Dx y2 dA, D is the region in the first quadrant lying between the curves y = x2 and x = y2;

The curves intersect at x = y2 = x4, or x = 0, 1. We find:∫∫Dx y2 dA =

∫ 1

0

∫ √xx2

x y2 dy dx,

=

∫ 1

0

[x y3

3

]√xx2

dx,

=1

3

∫ 1

0(x5/2 − x7) dx,

=1

3

[2x7/2

7− x8

8

]10

,

=1

3

(2

7− 1

8

)=

3

56.

(d)∫∫

Dey

3dA, D = {(x, y)|

√x ≤ y ≤ 1, 0 ≤ x ≤ 1}.

The region D = {(x, y)|√x ≤ y ≤ 1, 0 ≤ x ≤ 1} = {(x, y)| 0 ≤ x ≤ y2, 0 ≤ y ≤ 1}. Therefore, we

find: ∫∫Dey

3dA =

∫ 1

0

∫ y2

0ey

3dx dy,

=

∫ 1

0y2 ey

3dy,

=

[1

3ey

3

]10

=e− 1

3.

2. The volume of the solid region that lies above the region D in the xy-plane and under the graph ofz = f(x, y) ≥ 0 is given by the double integral V =

∫∫D f(x, y) dA. Find the volume of the region

enclosed by the planes z = x+ y, z = 6, x = 0, y = 0, and z = 0; [Hint: sketch the region first.]

The planes x = y = z = 0 mean the region is bound to one of the eight octants. With the planesz = 6 = x+ y, we recognize it is the first octant.

39

Then D = {(x, y)| 0 ≤ y ≤ 6− x, 0 ≤ x ≤ 6}, f(x, y) = 6− x− y, and:

V =

∫∫Df(x, y) dA =

∫ 6

0

∫ 6−x

0(6− x− y) dy dx,

=

∫ 6

0

[(6− x)y − y2

2

]6−x0

dx,

=

∫ 6

0

(6− x)2

2dx,

=

[−(6− x)3

6

]60

=63

6= 36.

3. Find the volume of the region that lies below the surface z = 1 − x2 and above the region in thexy-plane given by D = {(x, y)| 0 ≤ y ≤ x, 0 ≤ x ≤ 1}.

The region is visualized as:

40

Then:

V =

∫∫Df(x, y) dA =

∫ 1

0

∫ x

0(1− x2) dy dx,

=

∫ 1

0

[y(1− x2)

]x0

dx,

=

∫ 1

0x(1− x2) dx =

[−(1− x2)2

4

]10

=1

4.

41

Lab 7

Polar Coordinates, Centre of Mass, SurfaceArea

Problems

1. Find the volume lying between the paraboloids z = x2 + y2 and 3 z = 4− x2 − y2;

In polar coordinates, the paraboloids are z = r2 and 3 z = 4− r2. They intersect when 3 r2 = 4− r2,or r = 1. Therefore:

V =

∫∫D

(4− x2 − y2

3− x2 − y2

)dA =

∫ 2π

0

∫ 1

0

(4− r2

3− r2

)r dr dθ,

= 2π

∫ 1

0

(4 r − 4 r3

3

)dr,

= 2π

[2 r2 − r4

3

]10

=2π

3.

2. A thin plate lying in the xy-plane is bounded by the curves x2 + 4 y2 = 12 and x = 4 y2 and has amass density ρ(x, y) = x. Find the total mass of the plate;

From the two curves, 16 y4 + 4 y2 = 12, or 4 y4 + y2− 3 = 0, or y2 = −1±√1+48

8 = −1±78 = −1, 3/4. For

the real solutions, we find y2 = 3/4 or y = ±√

3/2. The region is visualized below.

42

0 0.5 1 1.5 2 2.5 3

−1.5

−1

−0.5

0

0.5

1

1.5

x

y D

The region D = {(x,y) | 4 y2 ≤ x ≤ (12 − 4 y2)1/2, −31/2/2 ≤ y ≤ +31/2/2}.

The total mass is then:

m =

∫∫Dρ(x, y) dA =

∫ √3/2−√3/2

∫ √12−4 y2

4 y2x dx dy,

=

∫ √3/2−√3/2

[x2

2

]√12−4 y2

4 y2dy,

=1

2

∫ √3/2−√3/2

(12− 4 y2 − 16 y4

)dy,

=

∫ √3/20

(12− 4 y2 − 16 y4

)dy, by symmetry,

=

[12 y − 4 y3

3− 16 y5

5

]√3/20

,

= 6√

3− 4 · 3√

3

3 · 8− 16 · 9

√3

5 · 32=

(6− 1

2− 9

10

)√3 =

23√

3

5.

3. The centroid of an object is the centre of mass computed under the assumption that the mass densityis ρ = 1. Find the centroid of the region in the xy-plane that lies inside the cardioid r = a(1 + cos θ).

As 0 ≤ θ ≤ 2π, −1 ≤ cos θ ≤ 1. Therefore, the radius of this cardioid is from 0 ≤ r ≤ 2 a, meaningr ≥ 0. This fact ensures that the cardioid does not have a little circle within itself that can happenwhen r < 0 as in r = a(1 + 2 cos θ), for example. We find the mass:

m =

∫ 2π

0

∫ a(1+cos θ)

01 r dr dθ,

=

∫ 2π

0

[r2

2

]a(1+cos θ)

0

dθ,

=

∫ 2π

0

a2(1 + cos θ)2

2dθ,

= a2∫ 2π

0

1 + 2 cos θ + cos2 θ

2dθ.

43

Now,∫ 2π

0cosmθ dθ = [sinmθ]2π0 = 0 when m = 0,±1,±2, . . . (check). Using cos2 θ = 1+cos 2θ

2 , then:

m = a2∫ 2π

0

2 + 1 + cos 2θ

4dθ,

= a2∫ 2π

0

3

4dθ =

3πa2

2.

Then for x:

x =1

m

∫ 2π

0

∫ a(1+cos θ)

01 · x r dr dθ,

=1

m

∫ 2π

0

∫ a(1+cos θ)

0r2 cos θ dr dθ,

=1

m

∫ 2π

0

[r3

3

]a(1+cos θ)

0

cos θ dθ,

=1

m

∫ 2π

0

a3(1 + cos θ)3

3cos θ dθ,

=a3

m

∫ 2π

0

1 + 3 cos θ + 3 cos2 θ + cos3 θ

3cos θ dθ,

=a3

m

∫ 2π

0

cos θ + 3 cos2 θ + 3 cos3 θ + cos4 θ

3dθ.

By the same logic as above for the mass, cos θ integrates to 0 and so does cos3 θ (check). Therefore,again using cos2 θ = 1+cos 2θ

2 , we find:

x =a3

m

∫ 2π

0

3 cos2 θ + cos4 θ

3dθ,

=a3

m

∫ 2π

0

6(1 + cos 2θ) + (1 + cos 2θ)2

12dθ,

=a3

m

∫ 2π

0

6 + 6 cos 2θ + 1 + 2 cos 2θ + cos2 2θ

12dθ,

=a3

m

∫ 2π

0

7 + cos2 2θ

12dθ,

=a3

m

∫ 2π

0

14 + 1 + cos 4θ

24dθ,

=15πa3

12m=

5πa3

4m=

5a

6.

For y:

y =1

m

∫ 2π

0

∫ a(1+cos θ)

01 · y r dr dθ,

=1

m

∫ 2π

0

∫ a(1+cos θ)

0r2 sin θ dr dθ,

=1

m

∫ 2π

0

[r3

3

]a(1+cos θ)

0

sin θ dθ,

=1

m

∫ 2π

0

a3(1 + cos θ)3 sin θ

3dθ = 0.

44

because it is an odd function about θ = π, the middle of the integration interval.

Exercises

1. Evaluate∫∫

R

√x2 + y2 dA where R is the region in the xy-plane lying between the curves x2 + y2 = 9

and x2 + y2 = 16;

2. Find the volume lying inside both the sphere x2 + y2 + z2 = a2 and the cylinder x2 + y2 = a x;

3. Evaluate I =

∫ +∞

−∞e−x

2/2 dx; [Hint: consider I2 instead.]

Considering I2 instead of I, we have:

I2 =

∫ +∞

−∞

∫ +∞

−∞e−x

2/2e−y2/2 dx dy,

=

∫ +∞

−∞

∫ +∞

−∞e−(x

2+y2)/2 dx dy.

Therefore, in polar coordinates, we find:

I2 =

∫ 2π

0

∫ ∞0

e−r2/2r dr dθ,

= 2π[−e−r2/2

]∞0

= 2π.

Therefore, since I > 0, we find I = +√I2 =

√2π.

45

Lab 8

Triple Integrals

Part I

Problems

1. Evaluate∫ 1

0

∫ 2x

x

∫ y

02x y z dz dy dx;

We find: ∫ 1

0

∫ 2x

x

∫ y

02x y z dz dy dx =

∫ 1

0

∫ 2x

x

[x y z2

]y0

dy dx,

=

∫ 1

0

∫ 2x

xx y3 dy dx,

=

∫ 1

0

[x y4

4

]2xx

dx,

=

∫ 1

0

x5(24 − 1)

4dx,

=

[x6(24 − 1)

4 · 6

]10

=24 − 1

24=

15

24=

5

8.

2. Evaluate∫∫∫

E2x dV where E =

{(x, y, z) ∈ R3 : 0 ≤ x ≤

√4− y2, 0 ≤ y ≤ 2, 0 ≤ z ≤ y

};

46

We find: ∫∫∫E

2x dV =

∫ 2

0

∫ √4−y2

0

∫ y

02x dz dx dy,

=

∫ 2

0

∫ √4−y2

0[2x z]y0 dx dy,

=

∫ 2

0

∫ √4−y2

02x y dx dy,

=

∫ 2

0

[x2 y

]√4−y20

dy,

=

∫ 2

0y(4− y2) dy,

=

[−(4− y2)2

4

]20

= 4.

3. Find the volume of the tetrahedron enclosed by the coordinate planes and the plane 2x + y + z = 4.The plane is z = 4−2x−y and is therefore above the xy-plane in the first octant. Projecting the planeonto the xy-plane (z = 0 plane), we find 2x + y = 4, or y = 4 − 2x. When y = 0, x = 2. Therefore,the region of the tetrahedron is E =

{(x, y, z) ∈ R3 : 0 ≤ z ≤ 4− 2x− y, 0 ≤ y ≤ 4− 2x, 0 ≤ x ≤ 2

},

and we find:

V =

∫∫∫E

dV =

∫ 2

0

∫ 4−2x

0

∫ 4−2x−y

0dz dy dx,

=

∫ 2

0

∫ 4−2x

0(4− 2x− y) dy dx,

=

∫ 2

0

[(4− 2x)y − y2

2

]4−2x0

dx,

=

∫ 2

0

(4− 2x)2

2dx,

=

[−(4− 2x)3

2 · 2 · 3

]20

=43

4 · 3=

16

3.

Exercises

1. LeB be the rectangular boxB ={

(x, y, z) ∈ R3 : 0 ≤ x ≤ a, 0 ≤ y ≤ b, 0 ≤ z ≤ c}. Evaluate

∫∫∫B

(x y2+

z3) dV ;

2. Evaluate∫∫∫

E(3 + 2x y) dV , where E is the region lying above the xy-plane and below the sphere

x2 + y2 + z2 = 4;

3. Find the volume of the region E ={

(x, y, z) ∈ R3 : 0 ≤ x ≤ 5, 0 ≤ y ≤ 3x, y ≤ z ≤ x+ 2}.

Part II

Problems

47

1. Use cylindrical coordinates to find the volume of the region lying in the first octant, bounded aboveby the paraboloid z = 4− x2 − y2 and lying within the cylinder x2 + y2 = 2x;

In cylindrical coordinates, the two functions are z = 4− r2 and r2 = 2 r cos θ or r = 2 cos θ. Therefore,the region in the problem is E =

{(r, θ, z) : 0 ≤ z ≤ 4− r2, 0 ≤ r ≤ 2 cos θ, 0 ≤ θ ≤ π/2

}, and we find:

V =

∫∫∫E

dV =

∫ π/2

0

∫ 2 cos θ

0

∫ 4−r2

0r dz dr dθ,

=

∫ π/2

0

∫ 2 cos θ

0r(4− r2) dr dθ,

=

∫ π/2

0

[−(4− r2)2

2 · 2

]2 cos θ0

dθ,

=

∫ π/2

0

(42

4− (4− 4 cos2 θ)2

4

)dθ,

=

∫ π/2

0

(42

4− 42 sin4 θ

4

)dθ,

= 4

∫ π/2

0(1− sin4 θ) dθ.

To integrate the sin4 θ term, we expand using the angle doubling identity:

4

∫ π/2

0(1− sin4 θ) dθ = 4

∫ π/2

0

(1−

(1− cos 2θ

2

)2)

dθ,

= 4

∫ π/2

0

(1− 1− cos 2θ + cos2 2θ

4

)dθ = 4

∫ π/2

0

(1− 1− cos 2θ + (1 + cos 4θ)/2

4

)dθ,

=

∫ π/2

0(4− 1 + cos 2θ − (1 + cos 4θ)/2) dθ =

∫ π/2

0

(5/2 + cos 2θ − cos 4θ

2

)dθ,

=

[5θ/2 +

sin 2θ

2− sin 4θ

8

]π/20

=5π

4.

2. Find the volume of the region that lies inside the cone φ = α and the sphere ρ = a;

The region can be characterized as E = {(ρ, θ, φ) : 0 ≤ ρ ≤ a, 0 ≤ θ ≤ 2π, 0 ≤ φ ≤ α}. Therefore, wefind:

V =

∫∫∫E

dV =

∫ α

0

∫ 2π

0

∫ a

0ρ2 sinφ dρdθ dφ,

=

∫ α

0

∫ 2π

0

[ρ3

3

]a0

sinφ dθ dφ = 2πa3

3

∫ α

0sinφ dφ,

= 2πa3

3[− cosφ]α0 =

2πa3(1− cosα)

3.

3. Compute∫∫∫

Ez√x2 + y2 + z2 dV where E is the region in problem 2.

The region in problem 2 is E = {(ρ, θ, φ) : 0 ≤ ρ ≤ a, 0 ≤ θ ≤ 2π, 0 ≤ φ ≤ α}. Since z = ρ cosφ and

48

ρ =√x2 + y2 + z2, we find:∫∫∫

Ez√x2 + y2 + z2 dV =

∫ α

0

∫ 2π

0

∫ a

0ρ cosφ ρ ρ2 sinφ dρdθ dφ,

=

∫ α

0

∫ 2π

0

∫ a

0ρ4 cosφ sinφ dρ dθ dφ,

= 2πa5

5

∫ α

0cosφ sinφ dφ.

Since sin 2φ = 2 sinφ cosφ:∫∫∫Ez√x2 + y2 + z2 dV = 2π

a5

5

∫ α

0

sin 2φ

2dφ,

= 2πa5

5

[− cos 2φ

4

]α0

=πa5(1− cos 2α)

10.

Exercises

1. Compute∫∫∫

Ex2 dV where E is the interior of the unit sphere centered on the origin;

2. Consider the plane y = z and the paraboloid z = x2 + y2. Convert these equations to cylindricalcoordinates. Solve them simultaneously to determine the r and θ values where these two surfacesintersect. Find the volume of the region that lies between these two surfaces;

3. Find the volume of the region that lies between the paraboloids z = 10−x2−y2 and z = 2(x2 + y2 − 1

).

49

Lab 9

Line Integrals

Part I

Problems

1. A thin wire has the shape of the right half of a unit circle and the mass density ρ(x, y) = x e−y. Findthe mass of the wire;

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

x

y

The thin wire with nonconstant mass density.

0.2

0.4

0.6

0.8

1

1.2

1.4

Parameterizing the circle as x(t) = cos t and y(t) = sin t, −π2 ≤ t ≤

π2 , we find:

m =

∫Cρ(x, y) ds =

∫ π2

−π2

x e−y

√(dx

dt

)2

+

(dy

dt

)2

dt,

=

∫ π2

−π2

cos t e− sin t√

sin2 t+ cos2 tdt,

=

∫ π2

−π2

cos t e− sin t dt =[−e− sin t

]π2

−π2

= −e−1 + e1 = 2 sinh 1.

2. Evaluate∫C

F · dr where F(x, y) =〈x, y〉

(x2 + y2)3/2and C is the curve r(t) = et〈cos t, sin t〉, 0 ≤ t ≤ 1;

50

0.9 1 1.1 1.2 1.3 1.4 1.5 1.6

0

0.5

1

1.5

2

x

y

The Force F along the path r.

We find:

F(x, y) = F(t) =〈et cos t, et sin t〉

(e2 t)3/2= e−2 t〈cos t, sin t〉,

dr = r′(t) dt = et〈cos t− sin t, sin t+ cos t〉.

Therefore: ∫C

F · dr =

∫ 1

0e−2 t〈cos t, sin t〉 · et〈cos t− sin t, sin t+ cos t〉 dt,

=

∫ 1

0e−t(cos2 t− cos t sin t+ sin2 t+ sin t cos t

)dt,

=

∫ 1

0e−t(cos2 t+ sin2 t

)dt,

=

∫ 1

0e−t dt = 1− e−1.

3. Evaluate∫C

F ·dr where F(x, y, z) = 〈x z, y+ z, x〉 where C is the curve r(t) = 〈et, e−t, e2 t〉, 0 ≤ t ≤ 1;

We find:

F(x, y) = F(t) = 〈x z, y + z, x〉 = 〈e3 t, e−t + e2 t, et〉,dr = r′(t) dt = 〈et,−e−t, 2 e2 t〉.

Therefore: ∫C

F · dr =

∫ 1

0〈e3 t, e−t + e2 t, et〉 · 〈et,−e−t, 2 e2 t〉dt,

=

∫ 1

0

(e4 t − e−2 t − et + 2 e3 t

)dt,

=e4 − 1

4+e−2 − 1

2+ 1− e+

2 (e3 − 1)

3.

51

0.4

0.6

0.8

1

1

1.5

2

2.5

1

2

3

4

5

6

7

x

The Force F along the path r.

y

4. Evaluate∫Cy3 dx− x3 dy where C is the triangle with vertices (0, 0), (1, 0), and (0, 1), oriented coun-

terclockwise. Is there a scalar field whose gradient is 〈y3,−x3〉?

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

x

y

The region D = {(x,y) | 0 ≤ y ≤ 1−x, 0 ≤ x ≤ 1}.

52

Therefore we find:

F(x, y) = 〈y3,−x3〉,∫C

F · dr =

(∫C1

+

∫C2

+

∫C3

)F · dr,

r1(t) = 〈t, 0〉, r2(t) = 〈1− t, t〉, r3(t) = 〈0, 1− t〉,r′1(t) = 〈1, 0〉, r′2(t) = 〈−1, 1〉, r′3(t) = 〈0,−1〉,∫

CF · dr =

∫ 1

0〈03,−t3〉 · 〈1, 0〉dt+

∫ 1

0〈t3,−(1− t)3〉 · 〈−1, 1〉 dt+

∫ 1

0〈(1− t)3,−03〉 · 〈0,−1〉 dt,

= −∫ 1

0t3 + (1− t)3 dt = −

[t4

4− (1− t)4

4

]10

= −1

2.

The scalar field must satisfy f(x, y) = x y3 + g(y). Similarly fy(x, y) = 3x y2 + g′(y) = −x3, but thisimplies g′(y) is also a function of x, which makes the existence of a scalar field impossible. Alternatively,we assert there cannot be a scalar field as the contour integral round a closed loop is not 0, makingthe vector field not conservative.

Exercises

1. If F = 〈3x − 2 y, y + 2 z,−x2〉, evaluate∫C

F · dr where C is the curve with initial endpoint (0, 0, 0)

and final endpoint (1, 1, 1) and defined by:

(a) the parametric equations x(t) = t, y(t) = t2, z(t) = t3, 0 ≤ t ≤ 1;

(b) union of line segments joining (0, 0, 0) to (0, 1, 0) to (0, 1, 1) to (1, 1, 1);

(c) the straight line from (0, 0, 0) to (1, 1, 1);

(d) the portion of the curve of intersection of the surfaces x = z2 and z = y2 between the twoendpoints;

2. Evaluate∫Cx y2/5 ds where C is the curve r(t) =

⟨t

2, t5/2

⟩, 0 ≤ t ≤ 1.

Part II

Problems

1. Evaluate∫C

arctan y dx+x

1 + y2dy where C is any curve from (0, 1) to (1, 1);

The scalar field f(x, y) = x arctan y has gradient F(x, y) =

⟨arctan y,

x

1 + y2

⟩. Therefore, from the

fundamental theorem for line integrals:∫C

arctan y dx+x

1 + y2dy = f(1, 1)− f(0, 1),

= arctan 1 =π

4.

2. Show that∫C

(4x3 + 9x2 y2

)dx+

(6x3 y + 6 y5

)dy = 0 for any closed curve C.

53

We integrate the first part with respect to x to obtain f(x, y) = x4 + 3x3 y2 + g(y) for some arbitraryg(y). Differentiating with respect to y, we find fy(x, y) = 6x3 y+ g′(y) = 6x3 y+ 6 y5, or g′(y) = 6 y5,or g(y) = y6 + K for some arbitrary K. Therefore, f(x, y) = x4 + 3x3 y2 + y6 shows that F is aconservative vector field and any closed loop contour integral will evaluate to 0.

Exercises

1. (a) Use the methods of Example 6 to check that F(x, y) = 〈3 y2 +5 y−6x, 6x y+5x〉 is conservative;

(b) Use the Fundamental Theorem for Line Integrals to compute:∫C

(3 y2 + 5 y − 6x

)dx+ (6x y + 5x) dy,

along any path C joining initial endpoint (1, 0) to final endpoint (2, 1);

2. Show that∫C

(y2 + 2x y

)dx+

(x2 + 2x y

)dy = 0 for any closed curve C;

3. Find a potential function for F(x, y, z) = 〈ex cos y + y z, x z − ex sin y, x y〉. Use it to evaluate∫C

(ex cos y + y z) dx+ (x z − ex sin y) dy + x y dz where C is any curve from (0, 0, 0) to(0, π, π−1

).

54

Lab 10

Green’s Theorem

Let C be a positively oriented, piecewise smooth, simple closed curve be the boundary of a region D. Saythat P and Q have continuous first partial derivatives on an open region containing D. Green’s theoremstates that: ∫

CP dx+Qdy =

∫∫D

(∂Q

∂x− ∂P

∂y

)dA. (10.1)

Problems

1. Use Green’s theorem to evaluate∫C

(3x2 − 2 y

)dx+

(11 y5 + 2x

)dy where C is the circle x2+y2 = 10,

traversed counterclockwise;

We find: ∫C

(3x2 − 2 y

)dx+

(11 y5 + 2x

)dy =

∫∫D

(2−−2) dA,

= 4

∫∫D

dA = 4× π × 10 = 40π.

2. Evaluate∫C

(6x y3 − 5 y

)dx +

(9x2 y2 − 5x

)dy where C is the ellipse x2 + 4 y2 = 16, traversed

counterclockwise;

We find: ∫C

(6x y3 − 5 y

)dx+

(9x2 y2 − 5x

)dy =

∫∫D

(18x y2 − 5− 18x y2 + 5) dA,

= 0 ·∫∫

DdA = 0.

3. Use Green’s theorem to show that∫C

(2x2 − x y3

)dx+

(y2 − 6x y

)dy = 0 where C is the square with

vertices (±1,±1). Note that this does not mean that F =⟨2x2 − x y3, y2 − 6x y

⟩is conservative, and

in fact it is not conservative.

55

We find: ∫C

(2x2 − x y3

)dx+

(y2 − 6x y

)dy =

∫∫D

(−6 y −−3x y2) dA,

=

∫∫D

(3x y2 − 6 y) dA,

=

∫ 1

−1

∫ 1

−1(3x y2 − 6 y) dy dx,

=

∫ 1

−1

[x y3 − 3 y2

]1−1 dx,

=

∫ 1

−1[x(1− (−1))− 3(1− 1)] dx,

=

∫ 1

−12x dx = 0 by symmetry.

Exercises

1. Use Green’s theorem to compute∫C

F ·dr where C is the curve in each of the diagrams below traversed

counterclockwise and F =⟨x2 y2, 3x− y3

⟩:

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

y=x1/2 y=(x−2)2

x

y

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

x2+y2=4

y=x

x

y

(a) (b)

2. Evaluate∫C

[ex

2 (11− x3

)+ 2 y

]dx+[−x+ arcsin y] dy where C is the circle (x−2)2 +(y+3)2 = 64,

traversed counterclockwise;

3. Show that for a region D enclosed by a positively oriented simple closed curve C, the area of D is givenby:

A(D) =

∫Cx dy = −

∫Cy dx.

56

Lab 11

Surface Integrals

Problems

1. Find the surface area of the portion of the paraboloid x2 + y2 = 6 z that lies within the spherex2 + y2 + z2 = 16;

The surface can be parameterized by r(u, v) =

⟨u, v,

u2 + v2

6

⟩. Therefore:

|ru × rv| =

∣∣∣∣∣∣∣i j k

1 0 u/3

0 1 v/3

∣∣∣∣∣∣∣ = |−u/3i− v/3j + k| =√

1 + u2/9 + v2/9.

A(S) =

∫∫S

dS =

∫∫D|ru × rv|dA,

=

∫ 2π

0

∫ 4

0

√1 + u2/9 + v2/9 r dr dθ,

=

∫ 2π

0

∫ 4

0

√1 + r2/9 r dr dθ,

= 2π[3(1 + r2/9)3/2

]40

= 2π

(125

9− 27

9

)=

196π

9.

2. Let the mass of a thin sheet in R3 be given by m =

∫∫Sρ(x, y, z) dS, where ρ(x, y, z) is the mass

density and dS is the differential surface element. Let:

r =1

m

∫∫S

rρ(x, y, z) dS,

= 〈x, y, z〉 =1

m

∫∫S〈x, y, z〉ρ(x, y, z) dS,

=1

m

⟨∫∫Sx ρ(x, y, z) dS,

∫∫Sy ρ(x, y, z) dS,

∫∫Sz ρ(x, y, z) dS

⟩,

be the centre of mass of this thin sheet. Find the mass m and centre of mass r for a constant unitdensity upper hemisphere of radius a centred on the origin: z =

√a2 − x2 − y2;

57

The surface can be parameterized by r(u, v) =⟨u, v,√a2 − u2 − v2

⟩. Therefore:

|ru × rv| =

∣∣∣∣∣∣∣i j k

1 0 −u(a2 − u2 − v2)−1/2

0 1 −v(a2 − u2 − v2)−1/2

∣∣∣∣∣∣∣=∣∣∣u(a2 − u2 − v2)−1/2i + v(a2 − u2 − v2)−1/2j + k

∣∣∣=

√1 +

u2 + v2

(a2 − u2 − v2)=

1√a2 − u2 − v2

√a2 − u2 − v2 + u2 + v2 =

a√a2 − u2 − v2

.

Then:

m =

∫∫Sρ(x, y, z) dS =

∫∫D|ru × rv|dA,

=

∫∫D

a√a2 − u2 − v2

dA,

=

∫ a

−a

∫ √a2−u2−√a2−u2

a√a2 − u2 − v2

dv du.

To do the inner integral, let v =√a2 − u2 sin θ, then:∫ √a2−u2

−√a2−u2

a√a2 − u2 − v2

dv =

∫ π/2

−π/2

a√a2 − u2 cos θ√

a2 − u2 − (a2 − u2) sin2 θdθ,

= a

∫ π/2

−π/2

√a2 − u2 cos θ√a2 − u2| cos θ|

dθ,

= a

∫ π/2

−π/2dθ = πa.

Then, inserting this into the outer integral, we find:

m =

∫ a

−aπadu = 2πa2.

Finding the components of r now:

x =1

m

∫∫Sxρ(x, y, z) dS =

1

m

∫∫D

a u√a2 − u2 − v2

dA,

= 0 by symmetry about u,

y =1

m

∫∫Syρ(x, y, z) dS =

1

m

∫∫D

a v√a2 − u2 − v2

dA,

= 0 by symmetry about v,

z =1

m

∫∫Szρ(x, y, z) dS =

1

m

∫∫D

a√a2 − u2 − v2√a2 − u2 − v2

dA,

=1

m

∫∫Da dA = a

A(D)

m= a

πa2

2πa2=a

2.

To conclude, the mass of a constant unit density hemisphere is m = 2πa2 and is located at r = 〈0, 0, a2 〉.

58

3. Find the flux of the vector field F = 〈2x, 3 y, 2 z〉 outward through the surface comprised of the finitecylinder

{(x, y, z) ∈ R3 : x2 + y2 = 4,−2 ≤ z ≤ 3

}together with the two end caps{

(x, y, z) ∈ R3 : x2 + y2 ≤ 4, z = −2}and

{(x, y, z) ∈ R3 : x2 + y2 ≤ 4, z = 3

};

Generally speaking, the flux of the vector field is given by:

Φ =

∫∫S

F · dS =

∫∫D

F · (ru × rv) dA.

In this case, our surface should be split into the three regions S1 is the circumferential surface, and S2and S3 are the end caps. S1 can be parameterized by r(u, v) = 〈2 cosu, 2 sinu, v〉, where u ∈ [0, 2π]

and v ∈ [−2, 3]. Then:

ru × rv =

∣∣∣∣∣∣∣i j k

−2 sinu 2 cosu 0

0 0 1

∣∣∣∣∣∣∣ = 〈2 cosu, 2 sinu, 0〉 .

This vector points outward for every u ∈ [0, 2π], therefore we are finding the outward flux. And:∫∫S1

F · dS =

∫∫D1

〈4 cosu, 6 sinu, 2 v〉 · 〈2 cosu, 2 sinu, 0〉 dA,

=

∫ 2π

0

∫ 3

−2

(8 cos2 u+ 12 sin2 u

)dv du,

= 5

∫ 2π

0

(8 + 4 sin2 u

)du,

= 5

∫ 2π

0(8 + 2(1− cos 2u)) du,

= 5

∫ 2π

0(10− 2 cos 2u)) du = 100π.

S2 can be parameterized by r(u, v) = 〈v cosu, v sinu,−2〉, where u ∈ [0, 2π] and v ∈ [0, 2]. Then:

ru × rv =

∣∣∣∣∣∣∣i j k

−v sinu v cosu 0

cosu sinu 0

∣∣∣∣∣∣∣ =⟨0, 0,−v sin2 u− v cos2 u

⟩= 〈0, 0,−v〉 .

59

This vector points outward (downward), therefore we are finding the outward flux. And:∫∫S2

F · dS =

∫∫D2

〈2 v cosu, 3 v sinu,−4〉 · 〈0, 0,−v〉dA,

=

∫ 2π

0

∫ 2

04 v dv du,

= 2π[2 v2

]20

= 16π.

S3 can be parameterized by r(u, v) = 〈v cosu, v sinu, 3〉, where u ∈ [0, 2π] and v ∈ [0, 2]. Then:

ru × rv =

∣∣∣∣∣∣∣i j k

−v sinu v cosu 0

cosu sinu 0

∣∣∣∣∣∣∣ =⟨0, 0,−v sin2 u− v cos2 u

⟩= 〈0, 0,−v〉 .

This vector points inward (downward), therefore we negate the cross product to find the outward flux.And: ∫∫

S3

F · dS =

∫∫D3

〈2 v cosu, 3 v sinu, 6〉 · 〈0, 0, v〉dA,

=

∫ 2π

0

∫ 2

06 v dv du,

= 2π[3 v2

]20

= 24π.

In total, we have:

Φ =

∫∫S

F · dS =

(∫∫S1

+

∫∫S2

+

∫∫S3

)F · dS = 140π.

4. Find the flux of the vector field F = 2i + j + k upward through the surface S described parametricallyby r = u2 vi + u v2j + v3k, 0 ≤ u ≤ 1, 0 ≤ v ≤ 1.

From the surface, we find:

ru × rv =

∣∣∣∣∣∣∣i j k

2u v v2 0

u2 2u v 3 v2

∣∣∣∣∣∣∣ =⟨3 v4,−6u v3, 3u2 v2

⟩.

60

Then:

Φ =

∫∫S

F · dS =

∫ 1

0

∫ 1

0〈2, 1, 1〉 · 〈3 v4,−6u v3, 3u2 v2〉 dudv,

=

∫ 1

0

∫ 1

0

(6 v4 − 6u v3 + 3u2 v2

)dudv,

=

∫ 1

0

[6u v4 − 3u2 v3 + u3 v2

]10

dv,

=

∫ 1

0

(6 v4 − 3 v3 + v2

)dv,

=

[6 v5

5− 3 v4

4+v3

3

]10

=6

5− 3

4+

1

3=

47

60.

Exercises

1. Evaluate∫∫

Sf(x, y, z) dS where S is the upper hemisphere of the sphere of radius a centred on the

origin: z =√a2 − x2 − y2 and f(x, y, z) = x2;

2. Evaluate∫∫

Sf(x, y, z) dS where S is the portion of the plane 2x+ 3 y+ z = 6 lying in the first octant

and f(x, y, z) = x+ y;

3. Find the flux of the vector field F(x, y, z) = 〈x, y, z〉 upward through the hemisphere z =√a2 − x2 − y2;

4. Find the flux of the vector field F(x, y, z) = 〈2x, y,−z〉 outward through the surface S of the par-allelepiped bounded by the planes x = ±1, y = ±2, and z = ±3. (Note that S is comprised of sixdifferent planar faces.)

61

Lab 12

Stokes’ Theorem and the DivergenceTheorem

Part I Stokes’ theoremLet C be a simple, piecewise-smooth closed curve bounding an oriented, piecewise-smooth surface S. ThenStokes’ theorem relates the line integral of a vector field F over C to a surface integral over S:∫

CF · dr =

∫∫S

(∇× F) · dS,

where C is parameterized so that C and the normal to the surface S obey the right-hand rule. For example,if C is traversed counterclockwise about the vertical axis, then the normal points upward.

Problems

1. Use Stokes’ theorem to evaluate∫C

2 y dx − z dy + 3 dz where C is the curve of intersection of the

paraboloid z = 4− x2 − y2 with the cylinder x2 + y2 = 1;

62

We begin by computing the curl of F:

∇× F =

∣∣∣∣∣∣∣i j k∂∂x

∂∂y

∂∂z

2 y −z 3

∣∣∣∣∣∣∣ = 1i + 0j− 2k.

Then, by intersecting the cylinder and the paraboloid, we find z = 4 − x2 − y2 = 4 − 1 = 3. Sincein Stokes’ theorem, we can take any surface with boundary C, the simplest seems to be z = 3. Thissurface is r(u, v) = 〈v cosu, v sinu, 3〉 for D =

{(u, v) ∈ R3 : 0 ≤ u ≤ 2π, 0 ≤ v ≤ 1

}. Since:

ru × rv =

∣∣∣∣∣∣∣i j k

−v sinu v cosu 0

cosu sinu 0

∣∣∣∣∣∣∣ = 0i + 0j− vk,

we find: ∫∫S

(∇× F) · dS =

∫∫D〈1, 0,−2〉 · 〈0, 0,−v〉dA,

=

∫ 2π

0

∫ 1

02 v dv du = 2π.

Since we do not know in which direction the contour C is taken, we do not know in which direction

the surface normal should point. Therefore∫C

F · dr = ±2π.

2. Use Stokes’ theorem to evaluate∫C

2 y dx + x dy + z dz where C is the curve of intersection of the

plane z = x with the cylinder x2 + y2 = 1, oriented so that the curve runs counterclockwise about thevertical axis (as viewed from above).

We begin by computing the curl of F:

∇× F =

∣∣∣∣∣∣∣i j k∂∂x

∂∂y

∂∂z

2 y x z

∣∣∣∣∣∣∣ = 0i + 0j− 1k.

63

We find that C is the boundary of the elliptical intersection of the cylinder and the plane. Since inStokes’ theorem, we can take any surface with boundary C, the simplest seems to be parameterizedby r(u, v) = 〈v cosu, v sinu, v cosu〉 for D =

{(u, v) ∈ R3 : 0 ≤ u ≤ 2π, 0 ≤ v ≤ 1

}. The first two

coordinates map the circle, and the height z matches the x-coordinate, placing the circle on the planez = x. Since:

ru × rv =

∣∣∣∣∣∣∣i j k

−v sinu v cosu −v sinu

cosu sinu cosu

∣∣∣∣∣∣∣ = vi + 0j− vk,

we find:∫∫S

(∇× F) · dS = −∫∫

D〈0, 0,−1〉 · 〈v, 0,−v〉 dA, The negative properly orients the surface normal

= −∫ 2π

0

∫ 1

0v dv du = −π.

Exercises

1. Use Stokes’ theorem to evaluate∫Cz dx + z2 dy + z3 dz where C is the curve of intersection of the

plane x + y + z = 6 with the cylinder x2 + y2 = 1, oriented so that the curve runs counterclockwiseabout the vertical axis (as viewed from above);

2. Use Stokes’ theorem to evaluate∫Cy dx − x dy + z2 dz where C is the curve of intersection of the

parabolic cylinder z = y2 with the cylinder x2+y2 = 4, oriented so that the curve runs counterclockwiseabout the vertical axis (as viewed from above).

Part II The divergence theoremLet E be a bounded solid region in R3 with smooth boundary surface S. Let F be a vector field whosecomponent functions have continuous first partial derivatives on an open region containing E. Then thedivergence theorem relates surface integrals over S to triple integrals over E:∫∫

SF · dS =

∫∫∫E

(∇ · F) dV.

Problems

1. Use the divergence theorem to compute∫∫

S〈y,−x, z〉 · dS where S is the surface bounding the region

that lies above the cone z =√x2 + y2 and below the plane z = 3;

64

We find: ∫∫S

F · dS =

∫∫∫E

(∇ · F) dV,

=

∫∫∫E

1 dV,

=

∫ 2π

0

∫ 3

0

∫ 3

rr dz dr dθ,

=

∫ 2π

0

∫ 3

0r(3− r) dr dθ,

= 2π ×[

3r2

2− r3

3

]30

,

= 2π × 27

6= 9π.

2. Use the divergence theorem to compute the surface integral∫∫

SF ·dS where F = x z2i+

(x2 y − z3

)j+(

2x y + y2 z)k and S is the surface bounding the region that lies below the hemisphere z =

√a2 − x2 − y2

and above the plane z = 0;

We find: ∫∫S

F · dS =

∫∫∫E

(∇ · F) dV,

=

∫∫∫E

(z2 + x2 + y2) dV,

=

∫ 2π

0

∫ π/2

0

∫ a

0ρ2 ρ2 sinφ dρdφ dθ,

=

∫ 2π

0dθ

∫ π/2

0sinφ dφ

∫ a

0ρ4 dρ,

= [θ]2π0 [− cosφ]π/20

[ρ5

5

]a0

=2πa5

5.

3. Let the smooth closed surface S be the boundary of a bounded region E such that the componentfunctions of the vector field F = 〈P,Q,R〉 have continuous second partial derivatives on an open regioncontaining E. Prove that: ∫∫

S(∇× F) · dS = 0.

Using the divergence theorem, we find:∫∫S

(∇× F) · dS =

∫∫∫E

(∇ · (∇× F)) dV.

Since:

∇ · (∇× F) = ∇ ·

∣∣∣∣∣∣∣i j k∂∂x

∂∂y

∂∂z

P Q R

∣∣∣∣∣∣∣ ,= ∇ · 〈Ry −Qz, Pz −Rx, Qx − Py〉,= Rxy −Qxz + Pyz −Rxy +Qxz − Pyz = 0,

65

then: ∫∫∫E

(∇ · (∇× F)) dV = 0.

Exercises

1. Use the divergence theorem to compute∫∫

SF · dS where F =

(3x− 2x2

)i − yj + zk and S is the

surface of the solid that lies in the first octant and is bounded by the parabolic cylinder x = 4 − z2,the plane y = 3, and the three coordinate planes;

2. Use the divergence theorem to compute∫∫

S〈2x+ z, 2x z + y,−y2 + 3 z〉 · dS where S is the sphere of

radius 4 centred at (−3, 1, 2);

3. Compute∫∫

S〈3x− z, y,−x− 2〉 · dS where S is the tetrahedron lying in the first octant whose faces

are the plane x+ y + z = 3 and the three coordinate planes.

66