Cal 8

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

Chapter Eight

f : Rn → R

8.1 Introduction
We shall now turn our attention to the very important special case of functions that
are real, or scalar, valued. These are sometimes called scalar fields. In the very, but
important, special subcase in which the dimension of the domain space is 2, we can

actually look at the graph of a function. Specifically, suppose f : R n → R . The

collection S = {( x 1 , x 2 , x 3 ) ∈ R 3 : f ( x1 , x 2 ) = x 3 } is called the graph of f. If f is a

reasonably nice function, then S is what we call a surface. We shall see more of this later.

Let us now return to the general case of a function f : R n → R . The derivative of f is just

∂f ∂f ∂f 
a row vector f '( x) =  L
∂ x n 
. It is frequently called the gradient of f
∂ x 1 ∂ x2

and denoted grad f or ∇f .

8.2 The Directional Derivative


In the applications of scalar fields it is of interest to talk of the rate of change of the
function in a specified direction. Suppose, for instance, the function T( x , y , z) gives the

temperature at points ( x , y , z) in space, and we might want to know the rate at which the

temperature changes as we move in a specified direction. Let f : R n → R , let a ∈ R n ,

and let u ∈ R n be a vector such that | u| = 1. Then the directional derivative of f at a in

the direction of the vector u is defined to be

d
Du f ( a) = f (a + tu) t =0 .
dt

8.1
Now that we are experts on the Chain Rule, we know at once how to compute such a
thing. It is simply

d
D u f (a ) = f ( a + t u) t =0 = ∇f ⋅ u .
dt

Example

The surface of a mountain is the graph of f ( x, y) = 700 − x 2 − 5 y 2 . In other words, at

the point (x, y), the height is f (x, y). The positive y-axis points North, and, of course,
then the positive x-axis points East. You are on the mountain side above the point (2, 4)
and begin to walk Southeast. What is the slope of the path at the starting point? Are you
going uphill or downhill? (Which!?).
The answers to these questions call for the directional derivative. We know we are at
the point a = (2 ,4 ) , but we need a unit vector u in the direction we are walking. This is,

1
of course, just u = (1,− 1) . Next we compute the gradient ∇f ( x , y ) = [ −2 x ,− 10 y] . At
2

the point a this becomes ∇f ( 2,4) = [ −2,− 40] , and at last we have

−2 + 40 38
∇f ⋅ u = = . This gives us the slope of the path; it is positive so we are going
2 2

uphill. Can you tell in which direction the path will be level?

Another Example

The temperature in space is given by T( x , y , z) = x 2 y + yz 3 . From the point (1,1,1), in

which direction does the temperature increase most rapidly?


We clearly need the direction in which the directional derivative is largest. The

directional derivative is simply ∇T ⋅ u =|∇ T|cosθ , where θ is the angle between ∇T and

u. Anyone can see that this will be largest when θ = 0. Thus T in creases most rapidly in

8.2
the direction of the gradient of T. Here that direction is [2 xy, x 2 + z 3 ,3 yz 2 ] . At (1,1,1),

this becomes [2, 2, 3].

Exercises

1. Find the derivative of f ( x, y, z) = x log z + 2 xy at (1, 2, 1) in the direction of the

vector [1, 2 ,2] .

2. Find the derivative of f ( x, y, z) = x cos y + 3z 3 − xz at (1, π, 1) in the direction of the

vector [3, - 2 ,2] .

3. Find the directions in which g ( x , y ) = x 2 y + e xy sin y increases and decreases most

rapidly from the point (1, 0).

4. The surface of a hill is the graph of the equation z = 1000 + x 2 − x 4 − y 2 . You stand

on the hill above the point (5,3) and pour out a glass of water. In which direct will it
begin to run? Explain.

5. The position of a particle at time t is given by r(t ) = 3( t 2 − sin t ) i + t j − cos tk , and

the position of another particle is R (t ) = t 2 i + (t 3 + t ) j + sin t k . At time t = π, what

is the rate of change of the distance between the two particles? Are they getting
closer to one another, or are they getting farther apart? (Which!) Explain.

8.3 Surface Normals

8.3
Let f : R 3 → R be a function and let c be some constant. Recall that the set

S = {( x , y , z) ∈ R 3 : f ( x , y , z) = c} is called a level set, or level surface, of the function f .

Suppose r(t ) = x (t )i + y( t ) j + z(t )k describes a curve in R 3 that lies on the surface S.

This means, of course, that f ( r( t )) = f ( x (t ), y ( t ), z( t )) = c . Now look at the derivative

with respect to t of this equation:

d
f ( r(t )) = ∇f ⋅ r'( t ) = 0 .
dt

In other words, the gradient of f and the tangent to the curve are perpendicular. Note there
was nothing special about our choice of r(t); it is any curve on the surface. The gradient
∇f is thus perpendicular, or normal to the surface f ( x, y, z) = c .

Example
Suppose we want to find an equation of the plane tangent to the surface

x 2 + 3y 2 + 2z 2 = 12

at the point (1, -1, 2). For an equation of a plane, we need a point a on the plane and a
vector N normal to the plane. Then the equation we seek is simply N ⋅ ( x − a) = 0 ,

where x = ( x , y , z) . In the case at hand, we have a point on the plane: a = (1, -1, 2).

Let’s find a normal vector N. We have just learned that the gradient of

f ( x, y, z) = x 2 + 3 y 2 + 2 z2 does the job.

∇f ( x , y , z) = [2 x ,6 y ,4 z] ,

8.4
and so N = ∇ f (1,− 12
, ) = [2 ,−68
, ] . The tangent plane is thus given by the equation

N ⋅ ( x − a) = 0 , which in this case is

2( x − 1) − 6( y + 1) + 8( z − 2) = 0 .

You should note that the discussion here didn’t depend on the dimension of the

domain. Thus if f : R 2 → R , then the set {( x , y ) ∈ R 2 : f ( x , y ) = c} is a level curve of f,

and the gradient of f is normal to such a curve.


Combining these results with what we know about the directional derivative, we see
that at a point the value of a function increases most rapidly in a direction normal to the
level set passing through that point. On a contour map of a portion of the Earth’s
surface, for example, the steepest path is in the direction normal to the contour lines.

Exercises

6. Find an equation for the plane tangent to the surface z = x 2 + 2 y 2 at the point (1,1,3).

7. Find an equation for the plane tangent to the surface z = log( x + y ) at the point
2 2

(10
, ,0) .

8. Find an equation for the plane tangent to the surface cosπ x − x 2 y + e xz + yz = 4 at

the point (0,1,2).

9. Find an equation of the straight line tangent to the curve of intersection of the surfaces

x 3 + 3x 2 y 2 + y 3 + 4 xy − z 2 = 0 and x 2 + y 2 + z 2 = 11 at the point (1, 1, 3).

8.5
8.4 Maxima and Minima

Let f : R n → R . A point a in the domain of f is called a local minimum if there is an

open ball B (a ; r ) centered at a such that f ( x) − f (a) ≥ 0 for all x ∈ B( a; r ) . If f is a nice

function, then this means the directional derivative Du f ( a) ≥ 0 for all unit vectors u. In

other words, ∇f (a ) ⋅ u ≥ 0 . Then it must be true that both ∇f (a ) ⋅ u ≥ 0 and

−∇f (a) ⋅ u = ∇ f ( a) ⋅ (− u) ≥ 0 . This can be so for every u only of ∇f (a ) = 0 . Thus f has

a local minimum at a point at which it has a derivative only if the derivative is zero there.
You should guess the definition of a local maximum and see why it must be true that
the gradient is zero at such a point. Thus if a is a local minimum or a local maximum of f,
and if f has a derivative at a, then the derivative ∇f (a ) = 0. You should be aware of the

fact that here, just as in Mrs. Turner’s elementary calculus class, the converse is not
necessarily true. We may have ∇f (a ) = 0 without a being either a local minimum or a

local maximum.

Example
Let us find all local maxima and local minima of the function

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

Meditate on just how should proceed. This function clearly has a derivative everywhere,
so at any local maximum or minimum, this derivative, or gradient, must be zero. So let’s
begin by finding all points at which ∇f (a ) = 0 . In other words, we want (x, y) at which

∂f ∂f
= 0 and = 0:
∂x ∂y

8.6
∂f
= 2x + y + 3 = 0
∂x

∂f
= x + 2y − 3 = 0
∂y

We are thus faced with the border-line trivial problem of solving the system of equations

2 x + y = −3
.
x + 2y = 3

There is just one solution: ( x , y ) = (−3, 3) . Now let us reflect on what we have here.

What we have actually found is all the points that cannot possibly be local minima or
maxima. These are all points except (-3, 3).. All we know right now is that this point is
the only possible candidate. Let’s find out what we have by the hammer and tongs
method of examining the quantity f (− 3 + x , 3 + y ) − f ( − 3,3 ) :

f ( − 3 + x , 3 + y ) − f ( − 3,3 ) = f ( − 3 + x , 3 + y ) − ( − 5)
= ( − 3 + x ) 2 + ( − 3 + x)( 3 + y) + ( 3 + y) 2 + 3( − 3 + x) − 3( 3 + y) + 9
2
 y 3y 2
= x 2 + xy + y 2 =  x +  +
 2 4

It is therefore clear that f (− 3 + x , 3 + y ) − f ( − 3,3 ) ≥ 0 , which means that (-3, 3) is a local

minimum.

Exercises

In each of the following, find all local maxima and minima:

8.7
10. f ( x , y ) = x 2 + 3xy + 3y 2 − 6 x + 3 y − 6

11. f ( x, y) = x 2 + xy + 3x + 2 y + 5

12. f ( x, y) = 2 xy − 5x 2 − 2 y 2 + 4x − 4

13. f ( x, y) = x 2 + 2 xy

14. f ( x, y) = y − x 2

8.5 Least Squares


We shall next look at some very simple, yet important, applications in which the
location of a minimum value of a function is sought.
Suppose we have a set of n points in the plane, say ( x1 , y1 ),( x 2 , y2 ),K,( x n , y n ) ,

and we seek the straight line that "best" fits this collection of points. We first decide
what we mean by "best". Let's say we mean the line that minimizes the sum of the
squares of the vertical distances from the points to the line. We can describe all
nonvertical lines in the world by means of two variables, traditionally called m and b.
Thus every such line has the form y = mx + b . Our quest is thus for the values of m and

b at which the function


n
f ( m, b) = ∑ (mxi + b − y i ) 2
i =1

has its minimum value. Knowing these values will give us our line.
We simply apply our vast and growing knowledge of calculus and find where the
gradient of f is 0:

8.8
∂f ∂f
∇f = ( , ) =0 .
∂m ∂ b

Now,
∂f n n n n
= ∑ 2 x i (mxi + b − yi ) = 2[m∑ x i2 + b∑ x i − ∑ xi y i ], and
∂ m i =1 i =1 i= 1 i =1

∂f n n n
= ∑ 2( mxi + b − yi ) = 2[m∑ xi + nb − ∑ yi ].
∂ b i =1 i =1 i =1

We are thus faced with solving the 2 x 2 linear system

n n n
m∑ x i2 + b ∑ xi = ∑ x i y i
i= 1 i =1 i =1
n n
m∑ x i + bn = ∑ yi
i= 1 i= 1

Meditate sufficiently to convince yourself that there is always exactly one


solution to this system, and continue meditating sufficiently to convince yourself that
there must be an honest-to-goodness minimum of the original function at this solution.
Let's have a go at an example. Suppose we have the following table of values:

x y

0 1

1 2

2 4

3 3.5

4 5

8.9
5 4

7 7

8 9

9 12

10 18

12 21

15 29

The linear system for m and b is

718m + 76b = 1156.5


76m +12b = 115.5

255 993
Solving this system gives us m = and b = − . In other words, the line that best
142 568
fits the data in the “sense of least squares” is

255 993
y= x−
142 568

Here’s a picture of this line together with the data points:

8.10
Looks pretty good!

Exercises

15. Here is a table of Köchel numbers versus year of composition for the compositions of
W. A. Mozart. Find the "least squares" straight line approximation to this table and
use it to estimate the year in which Mozart's Sinfonia Concertante in E-flat major was
composed.

Köchel Year
Number composed

1 1761

75 1771

155 1772

219 1775

271 1777

351 1780

425 1783

503 1786

575 1789

626 1791

[This problem is taken from Calculus and Analytic Geometry (8th Edition), by
Thomas & Finney.]

8.11
16. Find some data somewhere (The Statistical Abstract of the United States is a good
source of interesting data.), find the least squares linear approximation to the data, and
say something intelligent about your results.

8.6 More Maxima and Minima


In real life, one is most likely interested in finding the places at which the largest
and smallest values of a function f : D → R occur, rather than in simply finding local

maxima and minima. (Here D is a subset of R n .). To begin, let's think a moment about
how we can tell if there is a maximum or minimum value of f on D. First, we suppose
that f is continuous—otherwise, anything can happen! Next, what properties of D will
insure the existence of a biggest and smallest value of f ? The answer is fairly simple.

Certainly D must be a closed subset of R n ; consider, for example the function


, ) → R given simply by f ( x) = x , which has neither a maximum nor a minimum on
f :( 01

D = (01
, ) . Having the domain be closed, however, is not sufficient to guarantee the

existence of a maximum and minimum. Consider, for example f : R → R again with

, ) → R given by f ( x) = x . The domain R is certainly closed, but f has neither a


f :( 01

maximum nor a minimum. We need also to have the domain be bounded. It turns out that
for continuous f , if the domain D is both closed and bounded, then there must necessarily
be a maximum and a minimum value for f on D. Let's think a moment about what the
candidates for such points are. If the biggest or smallest value of f occurs in the interior of
D, then surely the point at which it occurs is a local maximum (or minimum). If f has a
gradient there, then the gradient must be 0 . The points at which the largest or smallest
values occur must therefore be either i)points in the interior of D at which the gradient of f
vanishes, ii)points in the interior at which the gradient of f does not exist, or iii)points in
D but not in the interior of D (that is, points on the boundary of D).
Hark back to Mrs. Turner's third grade calculus class. How did you find the
maximum value of a function f whose domain D is a closed interval [a , b] ⊂ R ? Recall

8.12
found all points in the interior (that is, in the open interval (a,b)) at which the derivative
vanishes. You then simply evaluated f at these points, evaluated f at any points in (a,b)
at which there is no derivative, evaluated f at the two end points of the interval (in this
one dimensional case, the boundary of D is particularly simple.), and then picked out the
biggest and smallest numbers you computed. The situation in higher dimensions is a bit
more complicated, mostly because the boundary of even a nice domain D is not a nice
finite set as in the case of an interval, but is an infinite set. Let's look at an example.

Example

A flat circular plate has the shape of the region {( x , y ) ∈ R 2 : x 2 + y 2 ≤ 1} . The

temperature at the point ( x , y ) on the plate is given by T( x , y ) = x 2 + 2 y 2 − x . Our

assignment is to find the hottest and coldest points on the plate. According to our
previous discussion, candidates for the hottest and coldest points are all points inside the
circular boundary at which the gradient of T is 0 and all points on the boundary. (Note
that T has a gradient at all points inside the circle.) First, let's find where among all points

( x , y ) such that x 2 + y 2 < 1 , the ones at which ∇T = (2 x − 14


, y) = 0 . This is easy; it

1
should be clear there is just one such point: ( ,0) . Now for the more difficult part,
2
finding the candidates on the boundary. Note that the boundary may be described by the
vector equation
r(t ) = cos t i + sin t j , where 0 ≤ t ≤ 2π .

The temperature on this set is then given by


T( t ) = T ( r(t )), 0 ≤ t ≤ 2π

[Here we are abusing the notation, as we have done before, by using the same name for
the function T( x , y ) and the composition T( r(t )) .] We are now faced with the one

dimensional problem of finding the maximum and minimum values of a nice differentiable
function of one variable on a closed interval. First, we know the endpoints of the interval
are candidates: t = 0, and t = 2π . We have at this point added one more point to our list

8.13
of candidates: r(0) = r(2π ) = (10
, ) . Now for candidates inside the interval, we seek

dT
places at which the derivative = 0 . From the Chain Rule, we know
dt
dT
= ∇ T( r(t )) ⋅ r'( t ) = (2 cos t − 14
, sin t ) ⋅ (− sin t ,cos t ) = 2 cos t sin t + sin t .
dt
dT
The equation = 0 now becomes
dt
2 cos t sin t + sin t = 0, or
sin t ( 2 cos t + 1) = 0

1
Thus sint = 0 , or 2 cos t + 1 = 0. We have, in other words, y = 0 , or x = − . When
2

1 3 3
y = 0 , then x = 1 or x = −1; and when x = − , then y = or y = − . Thus our
2 2 2

1 3 1 3
new candidates are (1,0), (− 10
, ), (- , ), and (− ,− ) . These together with the one
2 2 2 2
1
we have already found, ( ,0) , make up our entire list of possibilities for the hottest and
2
coldest points on the plate. All we need do now is to compute the temperature at each of
these points:
1 1 1 1
T( ,0) = − = − .
2 4 2 4
T(10, ) = 1− 1 = 0
T( −10, ) = 1+ 1 = 2
1 3 1 3 1 3 1 9
T( − , ) = T( − ,− ) = + + =
2 2 2 2 4 2 2 4

1
Finally, we have our answer. The coldest point is ( ,0) , and the hottest points are
2

1 3 1 3
(− , ) and (− ,− ).
2 2 2 2

8.14
Exercises

17. Find the maximum and minimum value of f ( x, y) = x 2 − xy + y 2 + 4 on the closed

area in the first quadrant bounded by the triangle formed by the lines x = 0 , y = 4 ,

and y = x .

18. Find the maximum and minimum values of f ( x , y ) = (4 y − y 2 )cos x on the closed

π π
area bounded by the rectangle 1 ≤ y ≤ 3 , − ≤x≤ .
4 4

8.7 Even More Maxima and Minima


It should be clear now that the really troublesome part of finding maxima and
minima is in dealing with the constrained problem; that is, the problem of finding the
maxima and minima of a given function on a set of lower dimension than the domain of the
function. In the problems of the previous section, we were fortunate in that it was easy
to find parametric representations of the these sets; in general, this, of course, could be
quite difficult. Let's see what we might do about this difficulty.
Suppose we are faced with the problem of finding the maximum or minimum value

of the function f : D → R , where D = {( x, y) ∈ R 2 : g ( x , y ) = 0} , where g is a nice

function. (In other words, D is a level curve of g .) Suppose r(t ) is a vector description

of the curve D. Now then, we are seeking a maximum or minimum of the function
dF
F (t ) = f ( r( t )) . At a maximum or minimum, we must have = 0 . (Here g is
dt
sufficiently nice to insure that g ( x , y ) = 0 is a closed curve, and so there are no endpoints

dF
to worry about.) The Chain Rule tells us that = ∇f ⋅ r' = 0 . Thus at a maximum or
dt
minimum, the gradient of f must be perpendicular to the tangent to g ( x , y ) = 0 . But if

∇f is perpendicular to the tangent to the level curve g ( x , y ) = 0 , then it must have the

8.15
same direction as the normal to this curve. This is just what we need to know, for the
gradient of g is normal to this curve. Thus at a maximum or minimum, ∇f and ∇g must

"line up". Thus ∇f = λ ∇ g , and there is no need actually to know a vector representation

r for g ( x , y ) = 0 .

Let's see this idea in action. Suppose we wish to find the largest and smallest

values of f ( x, y) = x 2 + y 2 on the curve x 2 − 2 x + y 2 − 4 y = 0 .

Here, we may take g ( x , y ) = x 2 − 2 x + y 2 − 4 y . Then ∇f = 2x i + 2 y j , and

∇g = (2 x − 2) i + (2 y − 4) j , and our equation ∇f = λ ∇ g becomes

2x = λ (2 x − 2)
2 y = λ ( 2 y − 4)

We obtain a third equation from the requirement that the point ( x , y ) be on the curve

g ( x , y ) = 0 . In other words, we need to find all solutions to the system of equations

2 x = λ (2 x − 2)
2 y = λ (2 y − 4)
x 2 − 2 x + y2 − 4 y = 0

The first two equations become


x ( λ - 1) = λ
y (λ − 1) = 2λ

λ 2λ
Thus x = and y = . (What about the possibility that λ − 1 = 0 ?). The last
λ −1 λ −1

λ2 2λ 4λ 2 8λ
equation then becomes − + − = 0 ; or,
(λ − 1) 2
λ − 1 (λ − 1) 2
λ −1

λ2 − 2λ (λ − 1) = 0,
λ2 − 2λ = 0
We have two solutions: λ = 0 and λ = 2 . What do you make of the solution λ = 0 ?

These values of λ give us two candidates for places at which extrema occur: x = 0 and

y = 0 ; and x = 2 and y = 4 . Now then f ( 00


, ) = 0 , and f ( 2,4) = 4 + 16 = 20 . There

8.16
we have them—the minimum value is 0 and it occurs at (0,0); and the maximum value is
20, and it occurs at (2,4).
This method for finding "constrained" extrema is generally called the method of

Lagrange Multipliers. (The variable λ is called a Lagrange multiplier.)

Exercises

19. Use the method of Lagrange multipliers to find the largest and smallest values of

f ( x, y) = 4 x + 3y on the circle x 2 + y 2 = 1 .

20. Find the points on the ellipse x 2 + 2 y 2 = 1 at which f ( x, y) = xy has its extreme

values.

21. Find the points on the curve x 2 + xy + y 2 = 1 that are nearest to and farthest from the

origin.

8.17

You might also like