4.6 Directional Derivatives and the Gradient - Calculus Volume 3 | OpenStax (2024)

Learning Objectives

  • 4.6.1Determine the directional derivative in a given direction for a function of two variables.
  • 4.6.2Determine the gradient vector of a given real-valued function.
  • 4.6.3Explain the significance of the gradient vector with regard to direction of change along a surface.
  • 4.6.4Use the gradient to find the tangent to a level curve of a given function.
  • 4.6.5Calculate directional derivatives and gradients in three dimensions.

In Partial Derivatives we introduced the partial derivative. A function z=f(x,y)z=f(x,y) has two partial derivatives: z/xz/x and z/y.z/y. These derivatives correspond to each of the independent variables and can be interpreted as instantaneous rates of change (that is, as slopes of a tangent line). For example, z/xz/x represents the slope of a tangent line passing through a given point on the surface defined by z=f(x,y),z=f(x,y), assuming the tangent line is parallel to the x-axis. Similarly, z/yz/y represents the slope of the tangent line parallel to the y-axis.y-axis. Now we consider the possibility of a tangent line parallel to neither axis.

Directional Derivatives

We start with the graph of a surface defined by the equation z=f(x,y).z=f(x,y). Given a point (a,b)(a,b) in the domain of f,f, we choose a direction to travel from that point. We measure the direction using an angle θ,θ, which is measured counterclockwise in the x, y-plane, starting at zero from the positive x-axis (Figure 4.39). The distance we travel is hh and the direction we travel is given by the unit vector u=(cosθ)i+(sinθ)j.u=(cosθ)i+(sinθ)j. Therefore, the z-coordinate of the second point on the graph is given by z=f(a+hcosθ,b+hsinθ).z=f(a+hcosθ,b+hsinθ).

4.6 Directional Derivatives and the Gradient - Calculus Volume 3 | OpenStax (1)

Figure 4.39 Finding the directional derivative at a point on the graph of z=f(x,y).z=f(x,y). The slope of the blue arrow on the graph indicates the value of the directional derivative at that point.

We can calculate the slope of the secant line by dividing the difference in z-valuesz-values by the length of the line segment connecting the two points in the domain. The length of the line segment is h.h. Therefore, the slope of the secant line is

msec=f(a+hcosθ,b+hsinθ)f(a,b)h.msec=f(a+hcosθ,b+hsinθ)f(a,b)h.

To find the slope of the tangent line in the same direction, we take the limit as hh approaches zero.

Definition

Suppose z=f(x,y)z=f(x,y) is a function of two variables with a domain of D.D. Let (a,b)D(a,b)D and define u=cosθi+sinθj.u=cosθi+sinθj. Then the directional derivative of ff in the direction of uu is given by

Duf(a,b)=limh0f(a+hcosθ,b+hsinθ)f(a,b)h,Duf(a,b)=limh0f(a+hcosθ,b+hsinθ)f(a,b)h,

(4.36)

provided the limit exists.

Equation 4.36 provides a formal definition of the directional derivative that can be used in many cases to calculate a directional derivative.

Example 4.31

Finding a Directional Derivative from the Definition

Let θ=arccos(3/5).θ=arccos(3/5). Find the directional derivative Duf(x,y)Duf(x,y) of f(x,y)=x2xy+3y2f(x,y)=x2xy+3y2 in the direction of u=(cosθ)i+(sinθ)j.u=(cosθ)i+(sinθ)j. What is Duf(−1,2)?Duf(−1,2)?

Solution

First of all, since cosθ=3/5cosθ=3/5 and θθ is acute, this implies

sin θ = 1 ( 3 5 ) 2 = 16 25 = 4 5 . sin θ = 1 ( 3 5 ) 2 = 16 25 = 4 5 .

Using f(x,y)=x2xy+3y2,f(x,y)=x2xy+3y2, we first calculate f(x+hcosθ,y+hsinθ):f(x+hcosθ,y+hsinθ):

f ( x + h cos θ , y + h sin θ ) = ( x + h cos θ ) 2 ( x + h cos θ ) ( y + h sin θ ) + 3 ( y + h sin θ ) 2 = x 2 + 2 x h cos θ + h 2 cos 2 θ x y x h sin θ y h cos θ −h 2 sin θ cos θ + 3 y 2 + 6 y h sin θ + 3 h 2 sin 2 θ = x 2 + 2 x h ( 3 5 ) + 9 h 2 25 x y 4 x h 5 3 y h 5 12 h 2 25 + 3 y 2 + 6 y h ( 4 5 ) + 3 h 2 ( 16 25 ) = x 2 x y + 3 y 2 + 2 x h 5 + 9 h 2 5 + 21 y h 5 . f ( x + h cos θ , y + h sin θ ) = ( x + h cos θ ) 2 ( x + h cos θ ) ( y + h sin θ ) + 3 ( y + h sin θ ) 2 = x 2 + 2 x h cos θ + h 2 cos 2 θ x y x h sin θ y h cos θ −h 2 sin θ cos θ + 3 y 2 + 6 y h sin θ + 3 h 2 sin 2 θ = x 2 + 2 x h ( 3 5 ) + 9 h 2 25 x y 4 x h 5 3 y h 5 12 h 2 25 + 3 y 2 + 6 y h ( 4 5 ) + 3 h 2 ( 16 25 ) = x 2 x y + 3 y 2 + 2 x h 5 + 9 h 2 5 + 21 y h 5 .

We substitute this expression into Equation 4.36:

D u f ( a , b ) = lim h 0 f ( a + h cos θ , b + h sin θ ) f ( a , b ) h = lim h 0 ( x 2 x y + 3 y 2 + 2 x h 5 + 9 h 2 5 + 21 y h 5 ) ( x 2 x y + 3 y 2 ) h = lim h 0 2 x h 5 + 9 h 2 5 + 21 y h 5 h = lim h 0 2 x 5 + 9 h 5 + 21 y 5 = 2 x + 21 y 5 . D u f ( a , b ) = lim h 0 f ( a + h cos θ , b + h sin θ ) f ( a , b ) h = lim h 0 ( x 2 x y + 3 y 2 + 2 x h 5 + 9 h 2 5 + 21 y h 5 ) ( x 2 x y + 3 y 2 ) h = lim h 0 2 x h 5 + 9 h 2 5 + 21 y h 5 h = lim h 0 2 x 5 + 9 h 5 + 21 y 5 = 2 x + 21 y 5 .

To calculate Duf(−1,2),Duf(−1,2), we substitute x=−1x=−1 and y=2y=2 into this answer:

D u f ( −1 , 2 ) = 2 ( −1 ) + 21 ( 2 ) 5 = −2 + 42 5 = 8 . D u f ( −1 , 2 ) = 2 ( −1 ) + 21 ( 2 ) 5 = −2 + 42 5 = 8 .

(See the following figure.)

4.6 Directional Derivatives and the Gradient - Calculus Volume 3 | OpenStax (2)

Figure 4.40 Finding the directional derivative in a given direction uu at a given point on a surface. The plane is tangent to the surface at the given point (−1,2,15).(−1,2,15).

Another approach to calculating a directional derivative involves partial derivatives, as outlined in the following theorem.

Theorem 4.12

Directional Derivative of a Function of Two Variables

Let z=f(x,y)z=f(x,y) be a function of two variables xandy,xandy, and assume that fxfx and fyfy exist and f(x,y)f(x,y) is differentiable everywhere. Then the directional derivative of ff in the direction of u=cosθi+sinθju=cosθi+sinθj is given by

Duf(x,y)=fx(x,y)cosθ+fy(x,y)sinθ.Duf(x,y)=fx(x,y)cosθ+fy(x,y)sinθ.

(4.37)

Proof

Equation 4.36 states that the directional derivative of f in the direction of u=cosθi+sinθju=cosθi+sinθj is given by

Duf(a,b)=limt0f(a+tcosθ,b+tsinθ)f(a,b)t.Duf(a,b)=limt0f(a+tcosθ,b+tsinθ)f(a,b)t.

Let x=a+tcosθx=a+tcosθ and y=b+tsinθ,y=b+tsinθ, and define g(t)=f(x,y).g(t)=f(x,y). Since fxfx and fyfy both exist, and therefore ff is differentiable, we can use the chain rule for functions of two variables to calculate g(t):g(t):

g(t)=fxdxdt+fydydt=fx(x,y)cosθ+fy(x,y)sinθ.g(t)=fxdxdt+fydydt=fx(x,y)cosθ+fy(x,y)sinθ.

If t=0,t=0, then x=x0(=a)x=x0(=a) and y=y0(=b),y=y0(=b), so

g(0)=fx(x0,y0)cosθ+fy(x0,y0)sinθ.g(0)=fx(x0,y0)cosθ+fy(x0,y0)sinθ.

By the definition of g(t),g(t), it is also true that

g(0)=limt0g(t)g(0)t=limt0f(x0+tcosθ,y0+tsinθ)f(x0,y0)t.g(0)=limt0g(t)g(0)t=limt0f(x0+tcosθ,y0+tsinθ)f(x0,y0)t.

Therefore, Duf(x0,y0)=fx(x,y)cosθ+fy(x,y)sinθ.Duf(x0,y0)=fx(x,y)cosθ+fy(x,y)sinθ.

Example 4.32

Finding a Directional Derivative: Alternative Method

Let θ=arccos(3/5).θ=arccos(3/5). Find the directional derivative Duf(x,y)Duf(x,y) of f(x,y)=x2xy+3y2f(x,y)=x2xy+3y2 in the direction of u=(cosθ)i+(sinθ)j.u=(cosθ)i+(sinθ)j. What is Duf(−1,2)?Duf(−1,2)?

Solution

First, we must calculate the partial derivatives of f:f:

f x = 2 x y f y = x + 6 y , f x = 2 x y f y = x + 6 y ,

Then we use Equation 4.37 with θ=arccos(3/5):θ=arccos(3/5):

D u f ( x , y ) = f x ( x , y ) cos θ + f y ( x , y ) sin θ = ( 2 x y ) 3 5 + ( x + 6 y ) 4 5 = 6 x 5 3 y 5 4 x 5 + 24 y 5 = 2 x + 21 y 5 . D u f ( x , y ) = f x ( x , y ) cos θ + f y ( x , y ) sin θ = ( 2 x y ) 3 5 + ( x + 6 y ) 4 5 = 6 x 5 3 y 5 4 x 5 + 24 y 5 = 2 x + 21 y 5 .

To calculate Duf(−1,2),Duf(−1,2), let x=−1x=−1 and y=2:y=2:

D u f ( −1 , 2 ) = 2 ( −1 ) + 21 ( 2 ) 5 = −2 + 42 5 = 8 . D u f ( −1 , 2 ) = 2 ( −1 ) + 21 ( 2 ) 5 = −2 + 42 5 = 8 .

This is the same answer obtained in Example 4.31.

Gradient

The right-hand side of Equation 4.37 is equal to fx(x,y)cosθ+fy(x,y)sinθ,fx(x,y)cosθ+fy(x,y)sinθ, which can be written as the dot product of two vectors. Define the first vector as f(x,y)=fx(x,y)i+fy(x,y)jf(x,y)=fx(x,y)i+fy(x,y)j and the second vector as u=(cosθ)i+(sinθ)j.u=(cosθ)i+(sinθ)j. Then the right-hand side of the equation can be written as the dot product of these two vectors:

Duf(x,y)=f(x,y)·u.Duf(x,y)=f(x,y)·u.

(4.38)

The first vector in Equation 4.38 has a special name: the gradient of the function f.f. The symbol is called nabla and the vector ff is read “delf.”“delf.”

Definition

Let z=f(x,y)z=f(x,y) be a function of xandyxandy such that fxfx and fyfy exist. The vector f(x,y)f(x,y) is called the gradient of ff and is defined as

f(x,y)=fx(x,y)i+fy(x,y)j.f(x,y)=fx(x,y)i+fy(x,y)j.

(4.39)

The vector f(x,y)f(x,y) is also written as “gradf.”“gradf.”

Checkpoint 4.28

Find the directional derivative Duf(x,y)Duf(x,y) of f(x,y)=3x2y4xy3+3y24xf(x,y)=3x2y4xy3+3y24x in the direction of u=(cosπ3)i+(sinπ3)ju=(cosπ3)i+(sinπ3)j using Equation 4.37. What is Duf(3,4)?Duf(3,4)?

If the vector that is given for the direction of the derivative is not a unit vector, then it is only necessary to divide by the norm of the vector. For example, if we wished to find the directional derivative of the function in Example 4.32 in the direction of the vector −5,12,−5,12, we would first divide by its magnitude to get u.u. This gives us u=(5/13),12/13.u=(5/13),12/13. Then

Duf(x,y)=f(x,y)·u=513(2xy)+1213(x+6y)=2213x+1713y.Duf(x,y)=f(x,y)·u=513(2xy)+1213(x+6y)=2213x+1713y.

Example 4.33

Finding Gradients

Find the gradient f(x,y)f(x,y) of each of the following functions:

  1. f(x,y)=x2xy+3y2f(x,y)=x2xy+3y2
  2. f(x,y)=sin3xcos3yf(x,y)=sin3xcos3y

Solution

For both parts a. and b., we first calculate the partial derivatives fxfx and fy,fy, then use Equation 4.39.


  1. fx(x,y)=2xyandfy(x,y)=x+6y,sof(x,y)=fx(x,y)i+fy(x,y)j=(2xy)i+(x+6y)j.fx(x,y)=2xyandfy(x,y)=x+6y,sof(x,y)=fx(x,y)i+fy(x,y)j=(2xy)i+(x+6y)j.

  2. fx(x,y)=3cos3xcos3yandfy(x,y)=−3sin3xsin3y,sof(x,y)=fx(x,y)i+fy(x,y)j=(3cos3xcos3y)i(3sin3xsin3y)j.fx(x,y)=3cos3xcos3yandfy(x,y)=−3sin3xsin3y,sof(x,y)=fx(x,y)i+fy(x,y)j=(3cos3xcos3y)i(3sin3xsin3y)j.

Checkpoint 4.29

Find the gradient f(x,y)f(x,y) of f(x,y)=(x23y2)/(2x+y).f(x,y)=(x23y2)/(2x+y).

The gradient has some important properties. We have already seen one formula that uses the gradient: the formula for the directional derivative. Recall from The Dot Product that if the angle between two vectors aa and bb is φ,φ, then a·b=abcosφ.a·b=abcosφ. Therefore, if the angle between f(x0,y0)f(x0,y0) and u=(cosθ)i+(sinθ)ju=(cosθ)i+(sinθ)j is φ,φ, we have

Duf(x0,y0)=f(x0,y0)·u=f(x0,y0)ucosφ=f(x0,y0)cosφ.Duf(x0,y0)=f(x0,y0)·u=f(x0,y0)ucosφ=f(x0,y0)cosφ.

The uu disappears because uu is a unit vector. Therefore, the directional derivative is equal to the magnitude of the gradient evaluated at (x0,y0)(x0,y0) multiplied by cosφ.cosφ. Recall that cosφcosφ ranges from −1−1 to 1.1. If φ=0,φ=0, then cosφ=1cosφ=1 and f(x0,y0)f(x0,y0) and uu both point in the same direction. If φ=π,φ=π, then cosφ=−1cosφ=−1 and f(x0,y0)f(x0,y0) and uu point in opposite directions. In the first case, the value of Duf(x0,y0)Duf(x0,y0) is maximized; in the second case, the value of Duf(x0,y0)Duf(x0,y0) is minimized. If f(x0,y0)=0,f(x0,y0)=0, then Duf(x0,y0)=f(x0,y0)·u=0Duf(x0,y0)=f(x0,y0)·u=0 for any vector u.u. These three cases are outlined in the following theorem.

Theorem 4.13

Properties of the Gradient

Suppose the function z=f(x,y)z=f(x,y) is differentiable at (x0,y0)(x0,y0) (Figure 4.41).

  1. If f(x0,y0)=0,f(x0,y0)=0, then Duf(x0,y0)=0Duf(x0,y0)=0 for any unit vector u.u.
  2. If f(x0,y0)0,f(x0,y0)0, then Duf(x0,y0)Duf(x0,y0) is maximized when uu points in the same direction as f(x0,y0).f(x0,y0). The maximum value of Duf(x0,y0)Duf(x0,y0) is f(x0,y0).f(x0,y0).
  3. If f(x0,y0)0,f(x0,y0)0, then Duf(x0,y0)Duf(x0,y0) is minimized when uu points in the opposite direction from f(x0,y0).f(x0,y0). The minimum value of Duf(x0,y0)Duf(x0,y0) is f(x0,y0).f(x0,y0).
4.6 Directional Derivatives and the Gradient - Calculus Volume 3 | OpenStax (3)

Figure 4.41 The gradient indicates the maximum and minimum values of the directional derivative at a point.

Example 4.34

Finding a Maximum Directional Derivative

Find the direction for which the directional derivative of f(x,y)=3x24xy+2y2f(x,y)=3x24xy+2y2 at (−2,3)(−2,3) is a maximum. What is the maximum value?

Solution

The maximum value of the directional derivative occurs when ff and the unit vector point in the same direction. Therefore, we start by calculating f(x,y):f(x,y):

f x ( x , y ) = 6 x 4 y and f y ( x , y ) = −4 x + 4 y , so f ( x , y ) = f x ( x , y ) i + f y ( x , y ) j = ( 6 x 4 y ) i + ( −4 x + 4 y ) j . f x ( x , y ) = 6 x 4 y and f y ( x , y ) = −4 x + 4 y , so f ( x , y ) = f x ( x , y ) i + f y ( x , y ) j = ( 6 x 4 y ) i + ( −4 x + 4 y ) j .

Next, we evaluate the gradient at (−2,3):(−2,3):

f ( −2 , 3 ) = ( 6 ( −2 ) 4 ( 3 ) ) i + ( −4 ( −2 ) + 4 ( 3 ) ) j = −24 i + 20 j . f ( −2 , 3 ) = ( 6 ( −2 ) 4 ( 3 ) ) i + ( −4 ( −2 ) + 4 ( 3 ) ) j = −24 i + 20 j .

We need to find a unit vector that points in the same direction as f(−2,3),f(−2,3), so the next step is to divide f(−2,3)f(−2,3) by its magnitude, which is (−24)2+(20)2=976=461.(−24)2+(20)2=976=461. Therefore,

f ( −2 , 3 ) f ( −2 , 3 ) = −24 4 61 i + 20 4 61 j = −6 61 61 i + 5 61 61 j . f ( −2 , 3 ) f ( −2 , 3 ) = −24 4 61 i + 20 4 61 j = −6 61 61 i + 5 61 61 j .

This is the unit vector that points in the same direction as f(−2,3).f(−2,3). To find the angle corresponding to this unit vector, we solve the equations

cos θ = −6 61 61 and sin θ = 5 61 61 cos θ = −6 61 61 and sin θ = 5 61 61

for θ.θ. Since cosine is negative and sine is positive, the angle must be in the second quadrant. Therefore, θ=πarcsin((561)/61)2.45rad.θ=πarcsin((561)/61)2.45rad.

The maximum value of the directional derivative at (−2,3)(−2,3) is f(−2,3)=461f(−2,3)=461 (see the following figure).

4.6 Directional Derivatives and the Gradient - Calculus Volume 3 | OpenStax (4)

Figure 4.42 The maximum value of the directional derivative at (−2,3)(−2,3) is in the direction of the gradient.

Checkpoint 4.30

Find the direction for which the directional derivative of g(x,y)=4xxy+2y2g(x,y)=4xxy+2y2 at (−2,3)(−2,3) is a maximum. What is the maximum value?

Figure 4.43 shows a portion of the graph of the function f(x,y)=3+sinxsiny.f(x,y)=3+sinxsiny. Given a point (a,b)(a,b) in the domain of f,f, the maximum value of the gradient at that point is given by f(a,b).f(a,b). This would equal the rate of greatest ascent if the surface represented a topographical map. If we went in the opposite direction, it would be the rate of greatest descent.

4.6 Directional Derivatives and the Gradient - Calculus Volume 3 | OpenStax (5)

Figure 4.43 A typical surface in 3.3. Given a point on the surface, the directional derivative can be calculated using the gradient.

When using a topographical map, the steepest slope is always in the direction where the contour lines are closest together (see Figure 4.44). This is analogous to the contour map of a function, assuming the level curves are obtained for equally spaced values throughout the range of that function.

4.6 Directional Derivatives and the Gradient - Calculus Volume 3 | OpenStax (6)

Figure 4.44 Contour map for the function f(x,y)=x2y2f(x,y)=x2y2 using level values between −5−5 and 5.5.

Gradients and Level Curves

Recall that if a curve is defined parametrically by the function pair (x(t),y(t)),(x(t),y(t)), then the vector x(t)i+y(t)jx(t)i+y(t)j is tangent to the curve for every value of tt in the domain. Now let’s assume z=f(x,y)z=f(x,y) is a differentiable function of xandy,xandy, and (x0,y0)(x0,y0) is in its domain. Let’s suppose further that x0=x(t0)x0=x(t0) and y0=y(t0)y0=y(t0) for some value of t,t, and consider the level curve f(x,y)=k.f(x,y)=k. Define g(t)=f(x(t),y(t))g(t)=f(x(t),y(t)) and calculate g(t)g(t) on the level curve. By the chain Rule,

g(t)=fx(x(t),y(t))x(t)+fy(x(t),y(t))y(t).g(t)=fx(x(t),y(t))x(t)+fy(x(t),y(t))y(t).

But g(t)=0g(t)=0 because g(t)=kg(t)=k for all t.t. Therefore, on the one hand,

fx(x(t),y(t))x(t)+fy(x(t),y(t))y(t)=0;fx(x(t),y(t))x(t)+fy(x(t),y(t))y(t)=0;

on the other hand,

fx(x(t),y(t))x(t)+fy(x(t),y(t))y(t)=f(x,y)·x(t),y(t).fx(x(t),y(t))x(t)+fy(x(t),y(t))y(t)=f(x,y)·x(t),y(t).

Therefore,

f(x,y)·x(t),y(t)=0.f(x,y)·x(t),y(t)=0.

Thus, the dot product of these vectors is equal to zero, which implies they are orthogonal. However, the second vector is tangent to the level curve, which implies the gradient must be normal to the level curve, which gives rise to the following theorem.

Theorem 4.14

Gradient Is Normal to the Level Curve

Suppose the function z=f(x,y)z=f(x,y) has continuous first-order partial derivatives in an open disk centered at a point (x0,y0).(x0,y0). If f(x0,y0)0,f(x0,y0)0, then f(x0,y0)f(x0,y0) is normal to the level curve of ff at (x0,y0).(x0,y0).

We can use this theorem to find tangent and normal vectors to level curves of a function.

Example 4.35

Finding Tangents to Level Curves

For the function f(x,y)=2x23xy+8y2+2x4y+4,f(x,y)=2x23xy+8y2+2x4y+4, find a tangent vector to the level curve at point (−2,1).(−2,1). Graph the level curve corresponding to f(x,y)=18f(x,y)=18 and draw in f(−2,1)f(−2,1) and a tangent vector.

Solution

First, we must calculate f(x,y):f(x,y):

f x ( x , y ) = 4 x 3 y + 2 and f y = −3 x + 16 y 4 so f ( x , y ) = ( 4 x 3 y + 2 ) i + ( −3 x + 16 y 4 ) j . f x ( x , y ) = 4 x 3 y + 2 and f y = −3 x + 16 y 4 so f ( x , y ) = ( 4 x 3 y + 2 ) i + ( −3 x + 16 y 4 ) j .

Next, we evaluate f(x,y)f(x,y) at (−2,1):(−2,1):

f ( −2 , 1 ) = ( 4 ( −2 ) 3 ( 1 ) + 2 ) i + ( −3 ( −2 ) + 16 ( 1 ) 4 ) j = −9 i + 18 j . f ( −2 , 1 ) = ( 4 ( −2 ) 3 ( 1 ) + 2 ) i + ( −3 ( −2 ) + 16 ( 1 ) 4 ) j = −9 i + 18 j .

This vector is orthogonal to the curve at point (−2,1).(−2,1). We can obtain a tangent vector by reversing the components and multiplying either one by −1.−1. Thus, for example, −18i9j−18i9j is a tangent vector (see the following graph).

4.6 Directional Derivatives and the Gradient - Calculus Volume 3 | OpenStax (7)

Figure 4.45 A rotated ellipse with equation f(x, y) = 18. At the point (–2, 1) on the ellipse, there are drawn two arrows, one tangent vector and one normal vector. The normal vector is marked ∇f(–2, 1) and is perpendicular to the tangent vector. Note that the tangent vector is drawn much shorter than it actually is to fit in the figure. The direction is correct, however.

Checkpoint 4.31

For the function f(x,y)=x22xy+5y2+3x2y+4,f(x,y)=x22xy+5y2+3x2y+4, find the tangent to the level curve at point (1,1).(1,1). Draw the graph of the level curve corresponding to f(x,y)=9f(x,y)=9 and draw f(1,1)f(1,1) and a tangent vector.

Three-Dimensional Gradients and Directional Derivatives

The definition of a gradient can be extended to functions of more than two variables.

Definition

Let w=f(x,y,z)w=f(x,y,z) be a function of three variables such that fx,fy,andfzfx,fy,andfz exist. The vector f(x,y,z)f(x,y,z) is called the gradient of ff and is defined as

f(x,y,z)=fx(x,y,z)i+fy(x,y,z)j+fz(x,y,z)k.f(x,y,z)=fx(x,y,z)i+fy(x,y,z)j+fz(x,y,z)k.

(4.40)

f(x,y,z)f(x,y,z) can also be written as gradf(x,y,z).gradf(x,y,z).

Calculating the gradient of a function in three variables is very similar to calculating the gradient of a function in two variables. First, we calculate the partial derivatives fx,fy,fx,fy, and fz,fz, and then we use Equation 4.40.

Example 4.36

Finding Gradients in Three Dimensions

Find the gradient f(x,y,z)f(x,y,z) of each of the following functions:

  1. f(x,y,z)=5x22xy+y24yz+z2+3xzf(x,y,z)=5x22xy+y24yz+z2+3xz
  2. f(x,y,z)=e−2zsin2xcos2yf(x,y,z)=e−2zsin2xcos2y

Solution

For both parts a. and b., we first calculate the partial derivatives fx,fy,fx,fy, and fz,fz, then use Equation 4.40.


  1. fx(x,y,z)=10x2y+3z,fy(x,y,z)=−2x+2y4zandfz(x,y,z)=3x4y+2z,sof(x,y,z)=fx(x,y,z)i+fy(x,y,z)j+fz(x,y,z)k=(10x2y+3z)i+(−2x+2y4z)j+(3x-4y+2z)k.fx(x,y,z)=10x2y+3z,fy(x,y,z)=−2x+2y4zandfz(x,y,z)=3x4y+2z,sof(x,y,z)=fx(x,y,z)i+fy(x,y,z)j+fz(x,y,z)k=(10x2y+3z)i+(−2x+2y4z)j+(3x-4y+2z)k.

  2. fx(x,y,z)=−2e−2zcos2xcos2y,fy(x,y,z)=−2e−2zsin2xsin2yandfz(x,y,z)=−2e−2zsin2xcos2y,sof(x,y,z)=fx(x,y,z)i+fy(x,y,z)j+fz(x,y,z)k=(2e−2zcos2xcos2y)i+(-2e-2zsin2xsin2y)j+(2e-2zsin2xcos2y)k=2e−2z(cos2xcos2yisin2xsin2yjsin2xcos2yk).fx(x,y,z)=−2e−2zcos2xcos2y,fy(x,y,z)=−2e−2zsin2xsin2yandfz(x,y,z)=−2e−2zsin2xcos2y,sof(x,y,z)=fx(x,y,z)i+fy(x,y,z)j+fz(x,y,z)k=(2e−2zcos2xcos2y)i+(-2e-2zsin2xsin2y)j+(2e-2zsin2xcos2y)k=2e−2z(cos2xcos2yisin2xsin2yjsin2xcos2yk).

Checkpoint 4.32

Find the gradient f(x,y,z)f(x,y,z) of f(x,y,z)=x23y2+z22x+y4z.f(x,y,z)=x23y2+z22x+y4z.

The directional derivative can also be generalized to functions of three variables. To determine a direction in three dimensions, a vector with three components is needed. This vector is a unit vector, and the components of the unit vector are called directional cosines. Given a three-dimensional unit vector uu in standard form (i.e., the initial point is at the origin), this vector forms three different angles with the positive x,y,x,y, and z-axes. Let’s call these angles α,β,α,β, and γ.γ. Then the directional cosines are given by cosα,cosβ,cosα,cosβ, and cosγ.cosγ. These are the components of the unit vector u;u; since uu is a unit vector, it is true that cos2α+cos2β+cos2γ=1.cos2α+cos2β+cos2γ=1.

Definition

Suppose w=f(x,y,z)w=f(x,y,z) is a function of three variables with a domain of D.D. Let (x0,y0,z0)D(x0,y0,z0)D and let u=cosαi+cosβj+cosγku=cosαi+cosβj+cosγk be a unit vector. Then, the directional derivative of ff in the direction of uu is given by

Duf(x0,y0,z0)=limt0f(x0+tcosα,y0+tcosβ,z0+tcosγ)f(x0,y0,z0)t,Duf(x0,y0,z0)=limt0f(x0+tcosα,y0+tcosβ,z0+tcosγ)f(x0,y0,z0)t,

(4.41)

provided the limit exists.

We can calculate the directional derivative of a function of three variables by using the gradient, leading to a formula that is analogous to Equation 4.38.

Theorem 4.15

Directional Derivative of a Function of Three Variables

Let f(x,y,z)f(x,y,z) be a differentiable function of three variables and let u=cosαi+cosβj+cosγku=cosαi+cosβj+cosγk be a unit vector. Then, the directional derivative of ff in the direction of uu is given by

Duf(x,y,z)=f(x,y,z)·u=fx(x,y,z)cosα+fy(x,y,z)cosβ+fz(x,y,z)cosγ.Duf(x,y,z)=f(x,y,z)·u=fx(x,y,z)cosα+fy(x,y,z)cosβ+fz(x,y,z)cosγ.

(4.42)

The three angles α,β,andγα,β,andγ determine the unit vector u.u. In practice, we can use an arbitrary (nonunit) vector, then divide by its magnitude to obtain a unit vector in the desired direction.

Example 4.37

Finding a Directional Derivative in Three Dimensions

Calculate Duf(1,−2,3)Duf(1,−2,3) in the direction of v=i+2j+2kv=i+2j+2k for the function

f(x,y,z)=5x22xy+y24yz+z2+3xz.f(x,y,z)=5x22xy+y24yz+z2+3xz.

Solution

First, we find the magnitude of v:v:

v = ( −1 ) 2 + ( 2 ) 2 + ( 2 ) 2 = 3 . v = ( −1 ) 2 + ( 2 ) 2 + ( 2 ) 2 = 3 .

Therefore, vv=i+2j+2k3=13i+23j+23kvv=i+2j+2k3=13i+23j+23k is a unit vector in the direction of v,v, so cosα=13,cosβ=23,andcosγ=23.cosα=13,cosβ=23,andcosγ=23. Next, we calculate the partial derivatives of f:f:

f x ( x , y , z ) = 10 x 2 y + 3 z f y ( x , y , z ) = −2 x + 2 y 4 z f z ( x , y , z ) = −4 y + 2 z + 3 x , f x ( x , y , z ) = 10 x 2 y + 3 z f y ( x , y , z ) = −2 x + 2 y 4 z f z ( x , y , z ) = −4 y + 2 z + 3 x ,

then substitute them into Equation 4.42:

D u f ( x , y , z ) = f x ( x , y , z ) cos α + f y ( x , y , z ) cos β + f z ( x , y , z ) cos γ = ( 10 x 2 y + 3 z ) ( 1 3 ) + ( −2 x + 2 y 4 z ) ( 2 3 ) + ( −4 y + 2 z + 3 x ) ( 2 3 ) = 10 x 3 + 2 y 3 3 z 3 4 x 3 + 4 y 3 8 z 3 8 y 3 + 4 z 3 + 6 x 3 = 8 x 3 2 y 3 7 z 3 . D u f ( x , y , z ) = f x ( x , y , z ) cos α + f y ( x , y , z ) cos β + f z ( x , y , z ) cos γ = ( 10 x 2 y + 3 z ) ( 1 3 ) + ( −2 x + 2 y 4 z ) ( 2 3 ) + ( −4 y + 2 z + 3 x ) ( 2 3 ) = 10 x 3 + 2 y 3 3 z 3 4 x 3 + 4 y 3 8 z 3 8 y 3 + 4 z 3 + 6 x 3 = 8 x 3 2 y 3 7 z 3 .

Last, to find Duf(1,−2,3),Duf(1,−2,3), we substitute x=1,y=−2,andz=3:x=1,y=−2,andz=3:

D u f ( 1 , −2 , 3 ) = 8 ( 1 ) 3 2 ( −2 ) 3 7 ( 3 ) 3 = 8 3 + 4 3 21 3 = 25 3 . D u f ( 1 , −2 , 3 ) = 8 ( 1 ) 3 2 ( −2 ) 3 7 ( 3 ) 3 = 8 3 + 4 3 21 3 = 25 3 .

Checkpoint 4.33

Calculate Duf(x,y,z)Duf(x,y,z) and Duf(0,−2,5)Duf(0,−2,5) in the direction of v=−3i+12j4kv=−3i+12j4k for the function f(x,y,z)=3x2+xy2y2+4yzz2+2xz.f(x,y,z)=3x2+xy2y2+4yzz2+2xz.

Section 4.6 Exercises

For the following exercises, find the directional derivative using the limit definition only.

260.

f(x,y)=52x212y2f(x,y)=52x212y2 at point P(3,4)P(3,4) in the direction of u=(cosπ4)i+(sinπ4)ju=(cosπ4)i+(sinπ4)j

261.

f(x,y)=y2cos(2x)f(x,y)=y2cos(2x) at point P(π3,2)P(π3,2) in the direction of u=(cosπ4)i+(sinπ4)ju=(cosπ4)i+(sinπ4)j

262.

Find the directional derivative of f(x,y)=y2sin(2x)f(x,y)=y2sin(2x) at point P(π4,2)P(π4,2) in the direction of u=5i+12j.u=5i+12j.

For the following exercises, find the directional derivative of the function at point PP in the direction of uu or vv as appropriate.

263.

f(x,y)=xy,f(x,y)=xy, P(0,−2),P(0,−2), v=12i+32jv=12i+32j

264.

h ( x , y ) = e x sin y , P ( 1 , π 2 ) , v = i h ( x , y ) = e x sin y , P ( 1 , π 2 ) , v = i

265.

h ( x , y , z ) = x y z , P ( 2 , 1 , 1 ) , v = 2 i + j k h ( x , y , z ) = x y z , P ( 2 , 1 , 1 ) , v = 2 i + j k

266.

f ( x , y ) = x y , P ( 1 , 1 ) , u = 2 2 , 2 2 f ( x , y ) = x y , P ( 1 , 1 ) , u = 2 2 , 2 2

267.

f ( x , y ) = x 2 y 2 , u = 3 2 , 1 2 , P ( 1 , 0 ) f ( x , y ) = x 2 y 2 , u = 3 2 , 1 2 , P ( 1 , 0 )

268.

f ( x , y ) = 3 x + 4 y + 7 , u = 3 5 , 4 5 , P ( 0 , π 2 ) f ( x , y ) = 3 x + 4 y + 7 , u = 3 5 , 4 5 , P ( 0 , π 2 )

269.

f ( x , y ) = e x cos y , u = 0 , 1 , P = ( 0 , π 2 ) f ( x , y ) = e x cos y , u = 0 , 1 , P = ( 0 , π 2 )

270.

f ( x , y ) = y 10 , u = 0 , −1 , P = ( 1 , −1 ) f ( x , y ) = y 10 , u = 0 , −1 , P = ( 1 , −1 )

271.

f ( x , y ) = ln ( x 2 + y 2 ) , u = 3 5 , 4 5 , P ( 1 , 2 ) f ( x , y ) = ln ( x 2 + y 2 ) , u = 3 5 , 4 5 , P ( 1 , 2 )

272.

f ( x , y ) = x 2 y , P ( −5 , 5 ) , v = 3 i 4 j f ( x , y ) = x 2 y , P ( −5 , 5 ) , v = 3 i 4 j

273.

f ( x , y , z ) = y 2 + x z , P ( 1 , 2 , 2 ) , v = 2 , −1 , 2 f ( x , y , z ) = y 2 + x z , P ( 1 , 2 , 2 ) , v = 2 , −1 , 2

For the following exercises, find the directional derivative of the function in the direction of the unit vector u=cosθi+sinθj.u=cosθi+sinθj.

274.

f ( x , y ) = x 2 + 2 y 2 , θ = π 6 f ( x , y ) = x 2 + 2 y 2 , θ = π 6

275.

f ( x , y ) = y x + 2 y , θ = π 4 f ( x , y ) = y x + 2 y , θ = π 4

276.

f ( x , y ) = cos ( 3 x + y ) , θ = π 4 f ( x , y ) = cos ( 3 x + y ) , θ = π 4

277.

w ( x , y ) = y e x , θ = π 3 w ( x , y ) = y e x , θ = π 3

278.

f ( x , y ) = x arctan ( y ) , θ = π 2 f ( x , y ) = x arctan ( y ) , θ = π 2

279.

f ( x , y ) = ln ( x + 2 y ) , θ = π 3 f ( x , y ) = ln ( x + 2 y ) , θ = π 3

For the following exercises, find the gradient.

280.

Find the gradient of f(x,y)=14x2y23.f(x,y)=14x2y23. Then, find the gradient at point P(1,2).P(1,2).

281.

Find the gradient of f(x,y,z)=xy+yz+xzf(x,y,z)=xy+yz+xz at point P(1,2,3).P(1,2,3).

282.

Find the gradient of f(x,y,z)f(x,y,z) at PP and the directional derivative in the direction of u:u: f(x,y,z)=ln(x2+2y2+3z2),P(2,1,4),u=−313i413j1213k.f(x,y,z)=ln(x2+2y2+3z2),P(2,1,4),u=−313i413j1213k.

283.

f ( x , y , z ) = 4 x 5 y 2 z 3 , P ( 2 , −1 , 1 ) , u = 1 3 i + 2 3 j 2 3 k f ( x , y , z ) = 4 x 5 y 2 z 3 , P ( 2 , −1 , 1 ) , u = 1 3 i + 2 3 j 2 3 k

For the following exercises, find the directional derivative of the function at point PP in the direction of Q.Q.

284.

f ( x , y ) = x 2 + 3 y 2 , P ( 1 , 1 ) , Q ( 4 , 5 ) f ( x , y ) = x 2 + 3 y 2 , P ( 1 , 1 ) , Q ( 4 , 5 )

285.

f ( x , y , z ) = y x + z , P ( 2 , 1 , −1 ) , Q ( −1 , 2 , 0 ) f ( x , y , z ) = y x + z , P ( 2 , 1 , −1 ) , Q ( −1 , 2 , 0 )

For the following exercises, find the derivative of the function at PP in the direction of u.u.

286.

f ( x , y ) = −7 x + 2 y , P ( 2 , −4 ) , u = 4 i 3 j f ( x , y ) = −7 x + 2 y , P ( 2 , −4 ) , u = 4 i 3 j

287.

f ( x , y ) = ln ( 5 x + 4 y ) , P ( 3 , 9 ) , u = 6 i + 8 j f ( x , y ) = ln ( 5 x + 4 y ) , P ( 3 , 9 ) , u = 6 i + 8 j

288.

[T] Use technology to sketch the level curve of f(x,y)=4x2y+3f(x,y)=4x2y+3 that passes through P(1,2)P(1,2) and draw the gradient vector at P.P.

289.

[T] Use technology to sketch the level curve of f(x,y)=x2+4y2f(x,y)=x2+4y2 that passes through P(−2,0)P(−2,0) and draw the gradient vector at P.P.

For the following exercises, find the gradient vector at the indicated point.

290.

f ( x , y ) = x y 2 y x 2 , P ( −1 , 1 ) f ( x , y ) = x y 2 y x 2 , P ( −1 , 1 )

291.

f ( x , y ) = x e y ln ( x ) , P ( −3 , 0 ) f ( x , y ) = x e y ln ( x ) , P ( −3 , 0 )

292.

f ( x , y , z ) = x y ln ( z ) , P ( 2 , −2 , 2 ) f ( x , y , z ) = x y ln ( z ) , P ( 2 , −2 , 2 )

293.

f ( x , y , z ) = x y 2 + z 2 , P ( −2 , −1 , −1 ) f ( x , y , z ) = x y 2 + z 2 , P ( −2 , −1 , −1 )

For the following exercises, find the derivative of the function.

294.

f(x,y)=x2+xy+y2f(x,y)=x2+xy+y2 at point (−5,−4)(−5,−4) in the direction the function increases most rapidly

295.

f(x,y)=exyf(x,y)=exy at point (6,7)(6,7) in the direction the function increases most rapidly

296.

f(x,y)=arctan(yx)f(x,y)=arctan(yx) at point (−9,9)(−9,9) in the direction the function increases most rapidly

297.

f(x,y,z)=ln(xy+yz+zx)f(x,y,z)=ln(xy+yz+zx) at point (−9,−18,−27)(−9,−18,−27) in the direction the function increases most rapidly

298.

f(x,y,z)=xy+yz+zxf(x,y,z)=xy+yz+zx at point (5,−5,5)(5,−5,5) in the direction the function increases most rapidly

For the following exercises, find the maximum rate of change of ff at the given point and the direction in which it occurs.

299.

f(x,y)=xey,f(x,y)=xey, (1,0)(1,0)

300.

f(x,y)=x2+2y,f(x,y)=x2+2y, (4,10)(4,10)

301.

f ( x , y ) = cos ( 3 x + 2 y ) , ( π 6 , π 8 ) f ( x , y ) = cos ( 3 x + 2 y ) , ( π 6 , π 8 )

For the following exercises, find equations of

  1. the tangent plane and
  2. the normal line to the given surface at the given point.

302.

The level surface f(x,y,z)=12f(x,y,z)=12 for f(x,y,z)=4x22y2+z2f(x,y,z)=4x22y2+z2 at point (2,2,2).(2,2,2).

303.

f(x,y,z)=xy+yz+xz=3f(x,y,z)=xy+yz+xz=3 at point (1,1,1)(1,1,1)

304.

f(x,y,z)=xyz=6f(x,y,z)=xyz=6 at point (1,2,3)(1,2,3)

305.

f(x,y,z)=xeycoszz=1f(x,y,z)=xeycoszz=1 at point (1,0,0)(1,0,0)

For the following exercises, solve the problem.

306.

The temperature TT in a metal sphere is inversely proportional to the distance from the center of the sphere (the origin: (0,0,0)).(0,0,0)). The temperature at point (1,2,2)(1,2,2) is 120°C.120°C.

  1. Find the rate of change of the temperature at point (1,2,2)(1,2,2) in the direction toward point (2,1,3).(2,1,3).
  2. Show that, at any point in the sphere, the direction of greatest increase in temperature is given by a vector that points toward the origin.

307.

The electrical potential (voltage) in a certain region of space is given by the function V(x,y,z)=5x23xy+xyz.V(x,y,z)=5x23xy+xyz.

  1. Find the rate of change of the voltage at point (3,4,5)(3,4,5) in the direction of the vector 1,1,−1.1,1,−1.
  2. In which direction does the voltage change most rapidly at point (3,4,5)?(3,4,5)?
  3. What is the maximum rate of change of the voltage at point (3,4,5)?(3,4,5)?

308.

If the electric potential at a point (x,y)(x,y) in the xy-plane is V(x,y)=e−2xcos(2y),V(x,y)=e−2xcos(2y), then the electric intensity vector at (x,y)(x,y) is E=V(x,y).E=V(x,y).

  1. Find the electric intensity vector at (π4,0).(π4,0).
  2. Show that, at each point in the plane, the electric potential decreases most rapidly in the direction of the vector E.E.

309.

In two dimensions, the motion of an ideal fluid is governed by a velocity potential φ.φ. The velocity components of the fluid uu in the x-direction and vv in the y-direction, are given by u,v=φ.u,v=φ. Find the velocity components associated with the velocity potential φ(x,y)=sinπxsin2πy.φ(x,y)=sinπxsin2πy.

4.6 Directional Derivatives and the Gradient - Calculus Volume 3 | OpenStax (2024)

References

Top Articles
Latest Posts
Article information

Author: Aron Pacocha

Last Updated:

Views: 5646

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Aron Pacocha

Birthday: 1999-08-12

Address: 3808 Moen Corner, Gorczanyport, FL 67364-2074

Phone: +393457723392

Job: Retail Consultant

Hobby: Jewelry making, Cooking, Gaming, Reading, Juggling, Cabaret, Origami

Introduction: My name is Aron Pacocha, I am a happy, tasty, innocent, proud, talented, courageous, magnificent person who loves writing and wants to share my knowledge and understanding with you.