DIRECTIONAL DERIVATIVE; GRADIENT

6. DIRECTIONAL DERIVATIVE; GRADIENT

Suppose that we know the temperature T (x, y, z) at every point of a room, say, or of a metal bar. Starting at a given point we could ask for the rate of change of the temperature with distance (in degrees per centimeter) as we move away from the starting point. The chances are that the temperature increases in some directions and decreases in other directions, and that it increases more rapidly in some directions than others. Thus the rate of change of temperature with distance depends upon the direction in which we move; consequently it is called a directional derivative. In symbols, we want to find the limiting value of ∆T /∆s where ∆s is an element of distance (arc length) in a given direction, and ∆T is the corresponding

Section 6 Directional Derivative; Gradient 291

change in temperature; we write the directional derivative as dT /ds. We could also ask for the direction in which dT /ds has its largest value; this is physically the direction from which heat flows (that is, heat flows from hot to cold, in the opposite direction from the maximum rate of temperature increase).

Before we discuss how to calculate directional derivatives, consider another ex- ample. Suppose we are standing at a point on the side of the hill of Figure 5.1 (not at the top), and ask the question “In what direction does the hill slope downward most steeply from this point?” This is the direction in which you would start to slide if you lost your footing; it is the direction most people would probably call “straight” down. We want to make this vague idea more precise. Suppose we move

a small distance ∆s on the hill; the vertical distance ∆z which we have gone may

be positive (uphill) or negative (downhill) or zero (around the hill). Then ∆z/∆s and its limit dz/ds depend upon the direction in which we go; dz/ds is a directional derivative. The direction of steepest slope is the direction in which dz/ds has its largest absolute value. Notice that since the gravitational potential energy of a mass m is V = mgz, maximizing dz/ds is the same as maximizing dV /ds, where the equipotentials on the hill are V (x, y) = mgz(x, y) = const.

Let us now state and solve the general problem of finding a directional derivative. We are given a scalar field, that is, a function φ(x, y, z) [or φ(x, y) in a two-variable problem; the following discussion applies to two-variable problems if we simply drop terms and equations containing z]. We want to find dφ/ds, the rate of change of

φ with distance, at a given point (x 0 ,y 0 ,z 0 ) and in a given direction. Let u = ia + jb + kc be a unit vector in the given direction. In Figure 6.1, we start at

(x 0 ,y 0 ,z 0 ) and go a distance s (s ≥ 0) in the direction u to the point (x, y, z); the vector joining these points is us since u is a unit vector. Then,

(x, y, z) − (x 0 ,y 0 ,z 0 ) = us = (ai + bj + ck)s

Figure 6.1 Equations (6.1) are the parametric equations of the line through (x 0 ,y 0 ,z 0 ) in the

direction u [see Chapter 3, equation (5.8)] with the distance s (instead of t) as the parameter, and with u (instead of A) as the vector along the line. From (6.1) we see that along the line, x, y, and z are each functions of a single variable, namely s [all the other letters in (6.1) are given constants]. If we substitute x, y, z in (6.1) into φ(x, y, z), then φ becomes a function of just the one variable s. That is, along the straight line (6.1), φ is a function of one variable, namely the distance along the

line measured from (x 0 ,y 0 ,z 0 ). Since φ depends on s alone, we can find dφ/ds:

This is the dot product of u with the vector i(∂φ/∂x) + j(∂φ/∂y) + k(∂φ/∂z). This vector is called the gradient of φ and is written grad φ or ∇φ (read “del φ”). By definition

292 Vector Analysis Chapter 6

φ = grad φ = i

Then we can write (6.2) as

(6.4) = ∇φ · u (directional derivative).

ds

Example 1. Find the directional derivative of φ = x 2 y + xz at (1, 2, −1) in the direction

A = 2i − 2j + k. Here u is a unit vector obtained by dividing A by |A|. Then we have

1 u= (2i − 2j + k).

Using (6.3) we get ∇

= (2xy + z)i + x 2 j + xk,

∇ φ at the point (1, 2, −1) = 3i + j + k. Then from (6.4) we find

2 1 5 at (1, 2, −1) = ∇φ · u = 2 − + = .

3 3 3 The gradient of a function has useful geometrical

ds

and physical meanings which we shall now inves- tigate. From (6.4), using the definition of a dot product, and the fact that |u| = 1, we have

dφ (6.5) ds = |∇φ| cos θ,

where θ is the angle between u and the vector ∇ φ. Thus dφ/ds is the projection of ∇φ on the

direction u (Figure 6.2). We find the largest value of dφ/ds (namely |∇φ|) if we go in the direction

Figure 6.2 of ∇φ (that is, θ = 0 in Figure 6.2). If we go in

the opposite direction (that is, θ = 180 ◦ in Figure 6.2) we find the largest rate of decrease of φ, namely dφ/ds = −|∇φ|.

Example 2. Suppose that the temperature T at the point (x, y, z) is given by the equation T=x 2 −y 2 + xyz + 273. In which direction is the temperature increasing most rapidly at (−1, 2, 3), and at what rate? Here ∇T = (2x+yz)i+(−2y +xz)j+xyk = 4i − 7j − 2k at (−1, 2, 3), and the increase in temperature is fastest in the direction √ √ of this vector. The rate of increase is dT /ds = |∇T | =

69. We

Section 6 Directional Derivative; Gradient 293

can also say that the temperature is decreasing most rapidly in the direction −∇T ; √ in this direction, dT /ds = −

69. Heat flows in the direction −∇T (that is, from hot to cold).

Next suppose u is tangent to the surface φ = const. at the point P (x 0 ,y 0 ,z 0 ) (Figure 6.3). We want to show that dφ/ds in the direction u is then equal to zero. Consider ∆φ/∆s for paths P A, P B, P C, etc., approaching the tangent u. Since φ = const. on the surface, and P , A, B, C, etc. are all on the surface, ∆φ = 0, and ∆φ/∆s = 0 for such paths. But dφ/ds in the tangent direction is the limit of ∆φ/∆s as ∆s → 0 (that is, as P A, P B,

Figure 6.3 etc., approach u), so dφ/ds in the direction u is

zero also. Then for u along the tangent to φ = const., ∇φ · u = 0; this means that ∇ φ is perpendicular to u. Since this is true for any u tangent to the surface at the

point (x 0 ,y 0 ,z 0 ), then at that point:

The vector ∇φ is perpendicular (normal) to the surface φ =const.

Since |∇φ| is the value of the directional derivative in the direction normal (that is, perpendicular) to the surface, it is often called the normal derivative and written |∇φ| = dφ/dn.

We now see that the direction of largest rate of change of a given function φ with distance is perpendicular to the equipotentials (or level lines) φ = const. In the temperature problem, the direction of maximum dT /ds is then perpendicular to the isothermals. At any point this is the direction of ∇T and is called the direction of the temperature gradient. In the problem of the hill, the direction of steepest slope at any point is perpendicular to the level lines, that is, along ∇z or ∇V .

Example 3. Given the surface x 3 y 2 z = 12, find the equations of the tangent plane and normal line at (1, −2, 3).

This is a level surface of the function w = x 3 y 2 z, so the normal direction is the direction of the gradient

∇ w = 3x 2 y 2 zi + 2x 3 yzj + x 3 y 2 k = 36i − 12j + 4k at (1, −2, 3).

A simpler vector in the same direction is 9i − 3j + k. Then (see Chapter 3, Section

5) the equation of the tangent plane is

9(x − 1) − 3(y + 2) + (z − 3) = 0,

and the equations of the normal line are

In (6.3) we have written the gradient in terms of its rectangular components. It is useful to write it in cylindrical and spherical coordinates also. (Note that this includes polar coordinates when z = 0). In cylindrical coordinates we want the components of ∇φ in the directions e r ,e θ , and e z = k. According to (6.4),

294 Vector Analysis Chapter 6

the component of ∇f in any direction u is the directional derivative df /ds in that direction. (We are changing the function from φ to f since φ is used as an angle in spherical, and sometimes in cylindrical and polar, coordinates.) The element of arc length ds in the r direction is dr so the directional derivative in the r direction is

df /dr (θ and z constant) which we write as ∂f /∂r. In the θ direction, the element of arc length is r dθ (Chapter 5, Section 4) so the directional derivative in the θ direction is df /(r dθ) (with r and z constant) which we write as (1/r)∂f /∂θ. Thus we have in cylindrical coordinates (or polar without the z term)

(6.7) f=e r

+e θ

+e z

in cylindrical coordinates.

In a similar way we can show (Problem 21) that

(6.8) ∇ f=e r

+e θ

+e φ

in spherical coordinates.

PROBLEMS, SECTION 6

1. Find the gradient of w = x 2 y 3 z at (1, 2, −1).

2. Starting from the point (1, 1), in what direction does the function φ = x 2 −y 2 + 2xy decrease most rapidly?

3. Find the derivative of xy 2 + yz at (1, 1, 2) in the direction of the vector 2i − j + 2k. 4. Find the derivative of ze x cos y at (1, 0, π/3) in the direction of the vector i + 2j. 5. Find the gradient of φ = z sin y − xz at the point (2, π/2, −1). Starting at this

point, in what direction is φ decreasing most rapidly? Find the derivative of φ in the direction 2i + 3j.

6. Find a vector normal to the surface x 2 +y 2 − z = 0 at the point (3, 4, 25). Find the equations of the tangent plane and normal line to the surface at that point.

7. Find the direction of the line normal to the surface x 2 y+y 2 z+z 2 x + 1 = 0 at the point (1, 2, −1). Write the equations of the tangent plane and normal line at this point.

8. (a) Find the directional derivative of φ = x 2 + sin y − xz in the direction i + 2j − 2k at the point (1, π/2, −3).

(b) Find the equation of the tangent plane and the equations of the normal line to φ = 5 at the point (1, π/2, −3).

9. (a)

Given φ = x 2 −y 2 z, find ∇φ at (1, 1, 1).

(b) Find the directional derivative of φ at (1, 1, 1) in the direction i − 2j + k. (c)

Find the equations of the normal line to the surface x 2 −y 2 z = 0 at (1, 1, 1). For Problems 10 to 14, use a computer as needed to make plots of the given surfaces and

the isothermal or equipotential curves. Try both 3D graphs and contour plots.

Section 6 Directional Derivative; Gradient 295

10. If the temperature in the (x, y) plane is given by T = xy −x, sketch a few isothermal curves, say for T = 0, 1, 2, −1, −2. Find the direction in which the temperature changes most rapidly with distance from the point (1, 1), and the maximum rate of change. Find the directional derivative of T at (1, 1) in the direction of the vector 3i − 4j. Heat flows in the direction −∇T (perpendicular to the isothermals). Sketch

a few curves along which heat would flow. 11. (a)

Given φ = x 2 −y 2 , sketch on one graph the curves φ = 4, φ = 1, φ = 0, φ = −1, φ = −4. If φ is the electrostatic potential, the curves φ = const. are equipotentials, and the electric field is given by E = −∇φ. If φ is temperature, the curves φ =const. are isothermals and ∇φ is the temperature gradient; heat flows in the direction −∇φ.

(b) Find and draw on your sketch the vectors −∇φ at the points (x, y) = (±1, ±1), (0, ±2), (±2, 0). Then, remembering that ∇φ is perpendicular to φ = const., sketch, without computation, several curves along which heat would flow [see(a)].

12. For Problem 11, (a)

Find the magnitude and direction of the electric field at (2, 1). (b)

Find the direction in which the temperature is decreasing most rapidly at (−3, 2).

(c) Find the rate of change of temperature with distance at (1, 2) in the direction 3i − j.

13. Let φ = e x cos y. Let φ represent either temperature or electrostatic potential. Refer to Problem 11 for definitions and find:

(a) The direction in which the temperature is increasing most rapidly at (1, −π/4) and the magnitude of the rate of increase.

(b) The rate of change of temperature with distance at (0, π/3) in the direction √ i+j 3.

(c) The direction and magnitude of the electric field at (0, π). (d)

The magnitude of the electric field at x = −1, any y. 14. (a)

2 Suppose that a hill (as in Fig. 5.1) has the equation z = 32 − x 2 − 4y , where z = height measured from some reference level (in hundreds of feet). Sketch a

contour map (that is, draw on one graph a set of curves z = const.); use the contours z = 32, 19, 12, 7, 0.

(b) If you start at the point (3, 2) and in the direction i + j, are you going uphill or downhill, and how fast?

15. Repeat Problem 14b for the following points and directions. (a) (4, −2), i + j

(b) (−3, 1), 4i + 3j (c) (2, 2), −3i + j

(d) (−4, −1), 4i − 3j 16. Show by the Lagrange multiplier method that the maximum value of dφ/ds is |∇φ|.

That is, maximize dφ/ds given by (6.3) subject to the condition a 2 +b 2 +c 2 = 1. You should get two values (±) for the Lagrange multiplier λ, and two values (maximum and minimum) for dφ/ds. Which is the maximum and which is the minimum?

17. Find ∇r, where r = px 2 +y 2 , using (6.7) and also using (6.3). Show that your results are the same by using (4.11) and (4.12). As in Problem 17, find the following gradients in two ways and show that your answers are equivalent.

18. ∇ x

20. ∇ (r 2 ) 21. Verify equation (6.8); that is, find ∇f in spherical coordinates as we did for cylin-

19. ∇ y

drical coordinates. Hint: What is ds in the φ direction? See Chapter 5, Figure 4.5.

296 Vector Analysis Chapter 6