Section 12.6: Directional Derivatives and the Gradient Vector Recall that if f is a differentiable function of x and y and z = f (x, y), then the partial derivatives fx (x, y) and fy (x, y) give the rate of change of z in the direction of x and y, respectively. Suppose we want to find the rate of change of z in the direction of an arbitrary unit vector ~u = hu1 , u2 i. Consider the surface S defined by z = f (x, y) and let z0 = f (x0 , y0 ) so that P = (x0 , y0 , z0 ) lies on S. The vertical plane passing through (x0 , y0 , z0 ) in the direction of ~u intersects S in a curve C. The slope of the tangent line to C at P is the rate of change of z in the direction of ~u. Figure 1: Illustration of the directional derivative. Definition: The directional derivative of f at (x0 , y0 ) in the direction of a unit vector ~u = hu1 , u2 i is f (x0 + u1 h, y0 + u2 h) − f (x0 , y0 ) D~u f (x0 , y0 ) = lim h→0 h provided this limit exists. Theorem: If f is a differentiable function of x and y, then f has a directional derivative for any unit vector ~u = hu1 , u2 i and D~u f (x, y) = fx (x, y)u1 + fy (x, y)u2 . Example: Find the directional derivative of f (x, y) = x2 y 3 + 2x4 y at (1, −2) in the direction * √ + 1 3 , . of ~u = 2 2 The partial derivatives are fx (x, y) = 2xy 3 + 8x3 y fx (1, −2) = −24 fy (x, y) = 3x2 y 2 + 2x4 fy (1, −2) = 14. Then the directional derivative is 1 D~u f (1, −2) = −24 + 14 2 √ ! √ 3 = 7 3 − 12. 2 Example: Find the directional derivative of f (x, y) = ~v = h12, 5i. √ x − y at (5, 1) in the direction of A unit vector in the direction of ~v is ~v ~u = = ||~v || 12 5 , 13 13 . The partial derivatives are 1 fx (x, y) = √ 2 x−y 1 fx (5, 1) = 4 1 fy (x, y) = − √ 2 x−y 1 fy (5, 1) = − . 4 Then the directional derivative is 1 D~u f (5, 1) = 4 12 13 1 − 4 5 13 = 7 . 52 Note: The vector that specifies the direction must be a unit vector. Definition: If f is a differentiable function of x and y, then the gradient of f is the vector function ∇f (x, y) = hfx (x, y), fy (x, y)i. Example: Find the gradient of f (x, y) = exy + sin(x2 + 2y). The gradient vector is ∇f (x, y) = hyexy + 2x cos(x2 + 2y), xexy + 2 cos(x2 + 2y)i. Theorem: (Gradient Formula for the Directional Derivative) If f is a differentiable function of x and y, then D~u f (x, y) = ∇f (x, y) · ~u. Example: Find the directional derivative of f (x, y) = xexy at (−3, 0) in the direction of ~v = h2, 3i. A unit vector in the direction of ~v is ~v = ~u = ||~v || 2 3 √ ,√ 13 13 . The gradient of f is ∇f (x, y) = hexy + xyexy , x2 exy i. At (−3, 0), ∇f0 = h1, 9i. Then the directional derivative is 2 27 29 D~u f (−3, 0) = ∇f0 · ~u = √ + √ = √ . 13 13 13 Note: The directional derivative and gradient can be extended to functions of three variables. If f (x, y, z) is differentiable, then ∇f (x, y, z) = hfx (x, y, z), fy (x, y, z), fz (x, y, z)i and the directional derivative of f at (x0 , y0 , z0 ) in the direction of the unit vector ~u is D~u f (x0 , y0 , z0 ) = ∇f (x0 , y0 , z0 ) · ~u. Example: Find the directional derivative of f (x, y, z) = ~v = h4, 2, −4i. √ xyz at (2, 4, 2) in the direction of A unit vector in the direction of ~v is ~v 1 ~u = = h4, 2, −4i = ||~v || 6 2 1 2 , ,− 3 3 3 . The gradient of f is ∇f (x, y, z) = yz xz xy , √ , √ √ 2 xyz 2 xyz 2 xyz . At (2, 4, 2), ∇f0 = h1, 21 , 1i. Then the directional derivative is D~u f (2, 4, 2) = ∇f0 · ~u = 2 1 2 1 + − = . 3 6 3 6 Given a function f , in which direction does f change most rapidly? What is the greatest rate of change? Theorem: (Maximal Property of the Gradient) Suppose f is a differentiable function of two or three variables. The maximum value of the directional derivative D~u f is ||∇f || and it occurs in the direction of the gradient ∇f . Example: Let f (x, y, z) = 3x2 − 5xy + xyz. Find the rate of change of f at (2, 2, 7) in the direction of ~v = h1, 1, −1i. In which direction does f change most rapidly? What is the maximum rate of change at (2, 2, 7)? A unit vector in the direction of ~v is ~v ~u = = ||~v || 1 1 1 √ , √ , −√ 3 3 3 . The gradient of f is ∇f (x, y, z) = h6x − 5y + yz, −5x + xz, xyi . At (2, 2, 7), ∇f0 = h16, 4, 4i. Then the directional derivative is 16 D~u f (2, 2, 7) = ∇f0 · ~u = √ . 3 The greatest change occurs in the direction of ∇f0 = h16, 4, 4i and the greatest change is √ √ ||∇f0 || = 256 + 16 + 16 = 12 2. Suppose S is a level surface defined by f (x, y, z). That is, f (x, y, z) = k for some constant k. If (x0 , y0 , z0 ) lies on S, then ∇f (x0 , y0 , z0 ) is a vector that is normal to the tangent plane at (x0 , y0 , z0 ). Figure 2: Illustration of a level surface f (x, y, z) = k and the gradient vector ∇f (x0 , y0 , z0 ). Definition: Let S be the level surface defined by f (x, y, z) = k and let (x0 , y0 , z0 ) lie on S. The plane with normal vector ∇f0 passing through (x0 , y0 , z0 ) is the tangent plane to the surface S at (x0 , y0 , z0 ). The line passing through (x0 , y0 , z0 ) in the direction of ∇f0 is the normal line to S at (x0 , y0 , z0 ). Example: Find equations for the tangent plane and normal line to the surface defined by x2 y + y 2 z + xz 2 = 5 at (2, 1, −1). Let f (x, y, z) = x2 y + y 2 z + xz 2 . The gradient of f is ∇f (x, y, z) = h2xy + z 2 , x2 + 2yz, y 2 + 2xzi. At (2, 1, −1), ∇f0 = h5, 2, −3i. An equation of the tangent plane is 5(x − 2) + 2(y − 1) − 3(z + 1) = 0 5x + 2y − 3z = 15. The parametric equations for the normal line are x = 2 + 5t y = 1 + 2t z = −1 − 3t.