3.6. DIRECTIONAL DERIVATIVES AND THE GRADIENT VECTOR 17 3.6 Directional Derivatives and te Gradient Vector 3.6.1 Functions of two Variables Directional Derivatives Let us first quickly review, one more time, te notion of rate of cange. Given y = f (x), te quantity f (x + ) f (x) = f (x) f (a) x a is te rate of cange of f wit respect to x. It studies ow f canges wen x canges. Wen we take te limit of te above quantity as 0 or as x a, ten we ave te instantaneous rate of cange wic is also called te derivative. Similarly, if y = f (x, y), ten te quantity f (x +, y) f (x, y) studies ow f canges wit x or in te direction of x. Te quantity f (x, y + ) f (x, y) studies ow f canges wit y or in te direction of y. Wen we take te limit of te above quantities as 0, we ave te instantaneous rate of cange of f wit respect to x and y respectively. Tese instantaneous rates of cange are also called te partials of f wit respect to x and y respectively. Tey are denoted f x or f y. Tese rates of cange only study ow f canges wen eiter x or y is canging. Since f is a function of bot x and y, bot x and y are likely to cange at te same time. So, we also need to study ow f canges wit respect to bot x and y. In oter words, we also need to study te rate of cange of f in any direction, not just te direction of x or y. Let u = a, b be a non-zero unit vector. We wis to study ow f canges in te direction of u. If we start at (x, y) and move units in te direction of u to a point (x, y ), ten te rate of cange is given by f (x, y ) f (x, y) We need to find wat x and y are. Tey are easy to find. If x = x + a and y = y + b ten we will ave moved by a + b = a + b =
18 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES since u is a unit vector. So, we see tat te rate of cange of f in te direction of te unit vector u is given by f (x + a, y + b) f (x, y) If we take te limit as 0, ten we ave te instantaneous rate of cange of f in te direction of u. So, we ave te following definition: Definition 6 Te directional derivative of f at a point (x 0, y 0 ) in te direction of te unit vector u = a, b is given by: assuming tis limit exists. D u f (x 0, y 0 ) = lim 0 f (x 0 + a, y 0 + b) f (x 0, y 0 ) Definition 66 Te directional derivative of f at any point (x, y) in te direction of te unit vector u = a, b is given by: assuming tis limit exists. D u f (x, y) = lim 0 f (x + a, y + b) f (x, y) Example 67 Find te derivative of f (x, y) = x + y in te direction of u = 1, at te point (1, 1, ). First, since u is not a unit vector, we must replace it wit a unit vector in te same direction. Suc a vector is u u = 1 1, Te directional derivative is ( ) f 1 + 1, 1 + f (1, 1) lim 0 = lim 0 ( ) ( 1 + 1 + 1 + ) 1 + = lim + + 1 + 4 + 4 0 6 + = lim 0 ( ) 6 = lim + 0 = 6 Remark 68 It is important to use a unit vector for te direction in wic we want to compute te derivative.
3.6. DIRECTIONAL DERIVATIVES AND THE GRADIENT VECTOR 19 It turns out tat we do not ave to compute a limit every time we need to compute a directional derivative. We ave te following teorem: Teorem 69 If f is a differentiable function in x and y, ten f as a directional derivative in te direction of any unit vector u = a, b and D u f (x, y) = f x (x, y) a + f y (x, y) b (3.13) If u makes an angle θ wit te positive x-axis, ten we also ave D u f (x, y) = f x (x, y) cos θ + f y (x, y) sin θ (3.14) Proof. We begin by proving te second part. 1. Proof of equation 3.14. Since u is a unit vector, if it makes an angle θ wit te positive x-axis, we can write u = cos θ, sin θ. Te result follows from equation 3.13.. Proof of equation 3.13. We prove tat for an arbitrary point (x 0, y 0 ) we ave: D u f (x 0, y 0 ) = f x (x 0, y 0 ) a+f y (x 0, y 0 ) b. Let us define te function g by g () = f (x 0 + a, y 0 + b) Ten, we see tat g (0) = lim 0 g () g (0) = f (x 0 + a, y 0 + b) f (x 0, y 0 ) lim 0 = D u f (x 0, y 0 ) (3.1) On te oter and, we can also write g () = f (x, y) were x = x 0 + a and y = y 0 + b. f is a function of x and y. But since bot x and y are functions of, f is also a function of. Using te cain rule (see previous section), we ave Terefore, g () = df d = f dx x d + f dy y d = f x (x, y) a + f y (x, y) b g (0) = f x (x 0, y 0 ) a + f y (x 0, y 0 ) b (3.16) From equations 3.1 and 3.16, we see tat D u f (x 0, y 0 ) = f x (x 0, y 0 ) a + f y (x 0, y 0 ) b Since tis is true for any (x 0, y 0 ), te result follows.
160 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES Example 70 Find te derivative of f (x, y) = x + y u = 1, at te point (1, 1, ). in te direction of Tis is te example we did above, using limits. Like above, we must use te unit vector aving te same direction. Suc a vector is u u = 1 1, Terefore, D u f (1, 1) = f x (1, 1) 1 +f y (1, 1). First, we compute te partials of f f x (x, y) = x Terefore, Similarly, Terefore, f x (1, 1) = f y (1, 1) = D u f (1, 1) = + 4 = 6 Te Gradient Vector Te above formula, f x (x, y) a+f y (x, y) b can be written as f x (x, y), f y (x, y) a, b. Te vector on te left as a special name: te gradient vector. Definition 71 If f is a function of two variables in x and y, ten te gradient of f, denoted f (read "grad f" or "del f") is defined by: f (x, y) = f x (x, y), f y (x, y) Example 7 Compute te gradient of f (x, y) = sin xe y. f (x, y) = f x (x, y), f y (x, y) cos xe y, sin xe y Example 73 Compute f (0, 1) for f (x, y) = x + y + xy. f (x, y) = f x (x, y), f y (x, y) = x + y, y + x Terefore, f (0, 1) =,
3.6. DIRECTIONAL DERIVATIVES AND THE GRADIENT VECTOR 161 We can express te directional derivative in terms of te gradient. Teorem 74 If f is a differentiable function in x and y, ten f as a directional derivative in te direction of any unit vector u = a, b and Proof. We know tat D u f (x, y) = f (x, y) u (3.17) D u f (x 0, y 0 ) = f x (x 0, y 0 ) a + f y (x 0, y 0 ) b = f x (x, y), f y (x, y) a, b = f (x, y) u Remark 7 From formula 3.17, we can recover te formulas for te partials of f wit respect to x and y. For example, te partial of f wit respect to x is te directional derivative of f in te direction of i = 1, 0. So, we ave D i f (x, y) = f x (x, y), f y (x, y) 1, 0 = f x (x, y) So, we can use formula 3.17 to compute te derivative in any direction, including x and y. 3.6. Functions of tree Variables Wat we ave derived above also applies to functions of tree variables. Given a function f (x, y, z) and a vector u = a, b, c, we ave te following: f(x+a,y+b,z+c) f(x,y,z) D u f (x, y, z) = lim 0. If we write x = (x, y, z), ten we can write D u f ( x ) = lim and tis works for functions of or 3 variables. f (x, y, z) = f x, f y, f z. We can write D u f (x, y, z) = f (x, y, z) u. f( x + u ) f( x ) 0 Example ( ) 76 Find te directional derivative of f (x, y, z) = x cos y sin z at 1, π, π 4 in te direction of u =, 1, 4. 1 First, we find a unit vector aving te same direction. Suc a vector is 1, 1, 4. Next, we compute f = cos y sin z, x sin y sin z, x cos y cos z
16 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES So, ( f 1, π, π ) = 4, 0, It follows tat te directional derivative we seek is: D u f ( 1, π, π ) 4 = f = ( 1, π, π ) 4, 0, = 3 1 0.9 8 1, 1, 4 1 1 1, 1, 4 3.6.3 Maximizing te directional derivative As we saw above, te gradient can be used to find te directional derivative. It as many more applications. One suc application is tat we can use te gradient to find te direction in wic a function as te largest rate of cange. If you tink of te grap of a function as a -D surface in 3-D, or a terrain on wic you are walking, ten te gradient can be used to find te direction in wic te terrain is te steepest. Of course, depending on wat you are trying to acieve, tis may be te direction you want to avoid!! Tis can be accomplised as follows. Teorem 77 Suppose tat f is a differentiable function and u is a unit vector. Te maximum value of D u f at a given point is f and it occurs wen u as te same direction as f at te given point. Proof. We ave already proven tat D u f = f u = f u cos θ were θ is te smallest angle between u and f. Since u is a unit vector, we ave D u f = f cos θ So, we see tat tis is maximum wen cos θ is maximum, tat is wen cos θ = 1. In tis case, we ave D u f = f Since it appens wen cos θ = 1, it appens wen θ = 0 tat is wen u as te same direction as f. Remark 78 Using a similar argument, we see tat te minimum value of D u f at a given point is f and it occurs wen u as te direction of f at te given point.
3.6. DIRECTIONAL DERIVATIVES AND THE GRADIENT VECTOR 163 Example 79 Suppose tat te temperature at eac point of a metal plate is given by T (x, y) = e x cos y + e y cos x 1. In wat direction does te temperature increase most rapidly at te point (0, 0)? Wat is te rate on increase?. In wat direction does te temperature decrease most rapidly at te point (0, 0)? Solution to #1: f (x, y) = e x cos y e y sin x, e y cos x e x sin y At (0, 0) te temperature increases most rapidly in te direction of Te rate of increase is f (0, 0) = 1, 1 f (0, 0) = Solution to #: At (0, 0), temperature decreases most rapidly in te direction of f (0, 0) = 1, 1 A picture of te gradient field around te origin in sown in figure 3.13. We plotted te gradient at eac point near te origin. Remember tat te gradient is a vector, it is represented as an arrow. Te lengt of eac arrow is te magnitude of te gradient and its direction, te direction of te gradient. 3.6.4 Te Gradient as a Normal: Tangent Planes and Normal Lines to a Level Surface Te Gradient Vector and Level Curves. Given a function of two variables z = f (x, y), its grap is a surface in R 3. If k is any constant, ten te grap of f (x, y) = k is a curve. It is called te level curves of f (x, y). Geometrically, it is te intersection of te grap of z = f (x, y) wit te plane z = k. Example 80 Te grap of z = f (x, y) = x + y is a paraboloid. Te intersection of a paraboloid wit a plane z = k were k > 0 is te circle centered at te origin of radius k. It is easy to see. If z = k and z = x + y ten x + y = k. Tis is te equation of te circle centered at te origin of radius k. Figure 3.14 sows te grap of z = f (x, y) = x + y as well as te level curves f (x, y) = k for k = 1, k =, k = 3, k = 4 and k =. Since tese level curves are -D objects wic live in a plane parallel to te xy-plane, te figure also sows teir projection in te xy-plane.
164 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES y 0. 0.4 0.3 0. 0.1 0. 0.4 0.3 0. 0.1 0.1 0. 0.3 0.4 0. 0.1 x 0. 0.3 0.4 0. Figure 3.13: Gradient field for f (x, y) = e x cos y + e y cos x Te gradient of f is f (x, y) = f x (x, y), f y (x, y). It is a -D vector. It as te remarkable property tat it is ortogonal to te level curves f (x, y) = k. Tis is summarized in te following proposition. Proposition 81 Let z = f (x, y) be a function wose partial derivatives in x and y exist. Let k be any constant. Let C denote te level curves f (x, y) = k. Let P = (x 0, y 0 ) be a point on C. Ten f (x 0, y 0 ) is ortogonal to C at P. Proof. To sow tis, we sow tat f (x 0, y 0 ) is ortogonal to te tangent vector to C at P. Let r (t) = x (t), y (t) be te position vector of te curve C. Let t 0 be te value of t suc tat r (t 0 ) = x 0, y 0. Ten, Tus Using te cain rule, we ave tat is In particular, at (x 0, y 0 ) we ave f (x (t), y (t)) = k df (x, y) dt = 0 f dx x dt + f dy y dt = 0 f (x, y) r (t) = 0 f (x 0, y 0 ) r (t 0 ) = 0
3.6. DIRECTIONAL DERIVATIVES AND THE GRADIENT VECTOR 16 Figure 3.14: Grap of z = x + y and level curves
166 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES 4 0 40 z 30 4 0 10 0 0 0 y x 4 4 Figure 3.1: Grap of a surface, its level curves and gradient vectors Example 8 Looking back at te previous example, f (x, y) = x + y and considering te level curve x + y = 4. It is a circle of radius centered at te origin. Witout computations, we know tat a vector perpendicular to tis circle at te point (, 0), tat is at te intersection of te curve and te x-axis is a vector parallel to i. We an verify it using our teorem. Te teorem says tat suc a vector would be f (, 0). f (x, y) = x, y ence f (, 0) =, 0 = i, so it is parallel to i. Using te teorem. we also see tat f (, ) =, = 1, 1 tis means tat a vector perpendicular to our curve at te point (, ) is parallel to 1, 1. We could ave predicted tat because (, ) is te point of intersection between our curve and te line y = x. A direction vector for tis line will be perpendicular to te curve. Suc a vector is 1, 1.Figure 3.1 sows te surface z = x + y, its level curves, and te two gradient vectors computed above, one is in red, te oter one in green. One can see te gradient vectors are indeed perpendicular to te level curves. Te Gradient Vector and Level Surfaces Tere is a similar result for level surfaces. Given a function of tree variables F (x, y, z), te grap of F (x, y, z) = k is a surface. It is called te level surface of te function F (x, y, z). Suppose tat S is a level surface of a function F (x, y, z) wit equation F (x, y, z) = k were k is a constant. Let P = (x 0, y 0, z 0 ) be a point on S. We ave te following proposition:
3.6. DIRECTIONAL DERIVATIVES AND THE GRADIENT VECTOR 167 Proposition 83 F (x 0, y 0, z 0 ) is ortogonal to S at P. Proof. We prove te result by proving tat F (x 0, y 0, z 0 ) is ortogonal to any curve on S troug P. Let C be any curve on S troug P given by its position vector r (t) = x (t), y (t), z (t). Let t 0 be te value of t suc tat r (t0 ) = x 0, y 0, z 0, te coordinates of P in oter words t 0 is te value of te parameter for wic te curve is at P. Because C is on S, we ave F (x (t), y (t), z (t)) = k Since x, y, z are differentiable of t, F is also a differentiable function of t. Using te cain rule, and differentiating bot sides wit respect to t, we ave df dt = 0 F dx x dt + F dy y dt + F dz z dt = 0 F Since F = x, F y, F z and r dx (t) = dt, dy dt, dz dt, te above equation can be written as F (x, y, z) r (t) = 0 In particular, at (x 0, y 0, z 0 ) we ave F (x 0, y 0, z 0 ) r (t 0 ) = 0 Tus, F (x 0, y 0, z 0 ) is ortogonal to te tangent vector of any curve troug P. Since tese tangent vectors are on te tangent plane, it follows tat F (x 0, y 0, z 0 ) is ortogonal to S at P. Example 84 Find a vector perpendicular to te surface 4x + y + z = 16 at te point (1,, ). We define F (x, y, z) = 4x + y + z and te surface can be tougt of a level surface to tis function, more specifically, te level surface corresponding to F (x, y, z) = 16. A vector perpendicular to tis surface is f (1,, ). f (x, y, z) = 8x, 4y, z ence f (1,, ) = 8, 8, 4. Tangent Plane to a Level Surface Te tecnique developed ere is not to be confused wit work done in previous sections. Earlier, we learned ow to find te tangent plane to a surface given by z = f (x, y) at te point (x 0, y 0, z 0 ). You will recall tat te equation of suc a plane is z z 0 = f x (x 0, y 0 ) (x x 0 ) + f y (x 0, y 0 ) (y y 0 ) (3.18) In tis subsection, we learn ow to find te equation of te tangent plane to a level surface S of a function F (x, y, z) at a point P = (x 0, y 0, z 0 ), tat is a surface given by F (x, y, z) = k were k is a constant. Tis plane is defined by P and a vector perpendicular to S at P. Te problem is ow to find suc a
168 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES vector. In te past, wen we ave needed a vector perpendicular to a plane, if we knew two vectors on te plane, we took teir cross product. In tis case, to find a vector perpendicular to S at P or to te tangent plane to S at P, we could apply te same idea, tat is find two non parallel vectors on te tangent plane. Teir cross product would give us te vector normal we are seeking. Unfortunately, we do not ave suc vectors. We do not ave tree non colinear points to generate tem eiter. However, from te previous subsection, we know ow to find a vector perpendicular to S at P. Suc a vector is F (x 0, y 0, z 0 ). Now tat we ave a point on te tangent plane: (x 0, y 0, z 0 ) and a normal vector F (x 0, y 0, z 0 ), it follows tat te equation of te plane tangent to S at P is: F x (x 0, y 0, z 0 ) (x x 0 ) + F y (x 0, y 0, z 0 ) (y y 0 ) + F z (x 0, y 0, z 0 ) (z z 0 ) = 0 (3.19) Remark 8 We can use equation 3.19 to derive equation 3.18, te equation of te tangent plane to a surface given by z = f (x, y). If we rewrite z = f (x, y) as f (x, y) z = 0, ten we can tink of te grap of f (x, y) as a level surface of te function F (x, y, z) = 0 were F (x, y, z) = f (x, y) z. In tis case, F x = f x, F y = f y and F z = 1. Tus, using equation 3.19, we see tat te tangent plane is f x (x 0, y 0, z 0 ) (x x 0 ) + f y (x 0, y 0, z 0 ) (y y 0 ) (z z 0 ) = 0 wic is te same as equation 3.18. Example 86 Find an equation for te tangent plane to te elliptic cone x + 4y = z at te point (3,, ). We can rewrite te equation of te cone as x + 4y z = 0. Tus, te elliptic cone is a level surface of F (x, y, z) = x + 4y z, it is te level surface corresponding to F (x, y, z) = 0. Since F x = x, F y = 8y and F z = z, from equation 3.19, it follows tat te equation of te tangent plane is F x (3,, ) (x 3) + F y (3,, ) (y ) + F z (3,, ) (z ) = 0 6 (x 3) + 16 (y ) 10 (z ) = 0 6x 18 + 16y 3 10z + 0 = 0 6x + 16y 10z = 0 3x + 8y z = 0 We illustrate tis by graping te level surface x +4y z = 0, and its tangent plane at (3,, ) wic is: 3x + 8y z = 0. Tis is sown in figure 3.16. Normal line to a Level Surface Since F (x 0, y 0, z 0 ) is ortogonal to S at P, it is te direction vector of te line normal to S at P. Te equation of suc a line is x x 0 F x (x 0, y 0, z 0 ) = y y 0 F y (x 0, y 0, z 0 ) = z z 0 F z (x 0, y 0, z 0 ) (3.0)
3.6. DIRECTIONAL DERIVATIVES AND THE GRADIENT VECTOR 169 4 4 z 0 0 4 0 x y4 4 4 Figure 3.16: Grap of x + 4y z = 0 and its tangent plane 3x + 8y z = 0 at (3,, ) Example 87 Find te parametric equations for te normal line to te elliptic cone x + 4y = z at te point (3,, ). We can rewrite te equation of te cone as x + 4y z = 0. Tus, te elliptic cone is a level surface of F (x, y, z) = x + 4y z, it is te level surface corresponding to F (x, y, z) = 0. Since F x = x, F y = 8y and F z = z, from equation 3.0 and te previous exercise, it follows tat te equation of te normal line is: x 3 6 Multiplying eac side by gives x 3 3 = y 16 = y 8 = z 10 = z Tese are symmetric equations. Te parametric equations for tis line are x = 3 + 3t y = + 8t z = t Summary About te Gradient Vector We ave studied te following about te gradient vector:
170 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES f = f x, f y for functions of two variables and f = f x, f y, f z for functions of 3 variables. Te derivative of f in te direction of te unit vector u is D u f (x) = f (x) u. Te maximum value of D u f (x) is f (x), it appens in te direction of f (x). In oter words, f (x) gives te direction of fastest increase for f. f (x 0, y 0 ) is ortogonal to te level curves f (x, y) = k tat passes troug P = (x 0, y 0 ). F (x 0, y 0, z 0 ) is ortogonal to te tangent vector of any curve in S troug P were S is te level surface F (x, y, z) = k and P = (x 0, y 0, z 0 ). F (x 0, y 0, z 0 ) is ortogonal to S at P. Te equation of te tangent plane to S at P is F x (x 0, y 0, z 0 ) (x x 0 ) + F y (x 0, y 0, z 0 ) (y y 0 ) + F z (x 0, y 0, z 0 ) (z z 0 ) = 0. F (x 0, y 0, z 0 ) is te direction vector of te line normal to S at P. Te equation of te normal line to S at P is z z 0 F z (x 0, y 0, z 0 ). x x 0 F x (x 0, y 0, z 0 ) = y y 0 F y (x 0, y 0, z 0 ) = If f and g are functions of or 3 variables and c is a constant, it can be sown tat te gradient satisfies te following properties (wat do tese properties remind you of?): 1. (f + g) = f + g. (f g) = f g 3. (cf) = c f 4. (fg) = f g + g f ). ( f g = g f f g g 6. f n = nf n 1 f 3.6. Assignment Do odd# 1-3 at te end of 11. in your book. Do odd # 1-7 at te end of 11.6 in your book.