Skip to Content
OpenStax Logo
Calculus Volume 3

4.6 Directional Derivatives and the Gradient

Calculus Volume 34.6 Directional Derivatives and the Gradient
Buy book
  1. Preface
  2. 1 Parametric Equations and Polar Coordinates
    1. Introduction
    2. 1.1 Parametric Equations
    3. 1.2 Calculus of Parametric Curves
    4. 1.3 Polar Coordinates
    5. 1.4 Area and Arc Length in Polar Coordinates
    6. 1.5 Conic Sections
    7. Key Terms
    8. Key Equations
    9. Key Concepts
    10. Chapter Review Exercises
  3. 2 Vectors in Space
    1. Introduction
    2. 2.1 Vectors in the Plane
    3. 2.2 Vectors in Three Dimensions
    4. 2.3 The Dot Product
    5. 2.4 The Cross Product
    6. 2.5 Equations of Lines and Planes in Space
    7. 2.6 Quadric Surfaces
    8. 2.7 Cylindrical and Spherical Coordinates
    9. Key Terms
    10. Key Equations
    11. Key Concepts
    12. Chapter Review Exercises
  4. 3 Vector-Valued Functions
    1. Introduction
    2. 3.1 Vector-Valued Functions and Space Curves
    3. 3.2 Calculus of Vector-Valued Functions
    4. 3.3 Arc Length and Curvature
    5. 3.4 Motion in Space
    6. Key Terms
    7. Key Equations
    8. Key Concepts
    9. Chapter Review Exercises
  5. 4 Differentiation of Functions of Several Variables
    1. Introduction
    2. 4.1 Functions of Several Variables
    3. 4.2 Limits and Continuity
    4. 4.3 Partial Derivatives
    5. 4.4 Tangent Planes and Linear Approximations
    6. 4.5 The Chain Rule
    7. 4.6 Directional Derivatives and the Gradient
    8. 4.7 Maxima/Minima Problems
    9. 4.8 Lagrange Multipliers
    10. Key Terms
    11. Key Equations
    12. Key Concepts
    13. Chapter Review Exercises
  6. 5 Multiple Integration
    1. Introduction
    2. 5.1 Double Integrals over Rectangular Regions
    3. 5.2 Double Integrals over General Regions
    4. 5.3 Double Integrals in Polar Coordinates
    5. 5.4 Triple Integrals
    6. 5.5 Triple Integrals in Cylindrical and Spherical Coordinates
    7. 5.6 Calculating Centers of Mass and Moments of Inertia
    8. 5.7 Change of Variables in Multiple Integrals
    9. Key Terms
    10. Key Equations
    11. Key Concepts
    12. Chapter Review Exercises
  7. 6 Vector Calculus
    1. Introduction
    2. 6.1 Vector Fields
    3. 6.2 Line Integrals
    4. 6.3 Conservative Vector Fields
    5. 6.4 Green’s Theorem
    6. 6.5 Divergence and Curl
    7. 6.6 Surface Integrals
    8. 6.7 Stokes’ Theorem
    9. 6.8 The Divergence Theorem
    10. Key Terms
    11. Key Equations
    12. Key Concepts
    13. Chapter Review Exercises
  8. 7 Second-Order Differential Equations
    1. Introduction
    2. 7.1 Second-Order Linear Equations
    3. 7.2 Nonhomogeneous Linear Equations
    4. 7.3 Applications
    5. 7.4 Series Solutions of Differential Equations
    6. Key Terms
    7. Key Equations
    8. Key Concepts
    9. Chapter Review Exercises
  9. A | Table of Integrals
  10. B | Table of Derivatives
  11. C | Review of Pre-Calculus
  12. Answer Key
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
  13. Index

Learning Objectives

  • 4.6.1. Determine the directional derivative in a given direction for a function of two variables.
  • 4.6.2. Determine the gradient vector of a given real-valued function.
  • 4.6.3. Explain the significance of the gradient vector with regard to direction of change along a surface.
  • 4.6.4. Use the gradient to find the tangent to a level curve of a given function.
  • 4.6.5. Calculate 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θ).

A shape in xyz space with point (a, b, f(a, b)). From the point, there is an arrow that represents the directional derivative. On the xy plane, the point (a, b) is marked and an angle of size θ is made between the projection of the directional derivative onto the plane and a line parallel to the x axis.
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 black 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(35)2=1625=45.sinθ=1(35)2=1625=45.

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+hcosθ,y+hsinθ)=(x+hcosθ)2(x+hcosθ)(y+hsinθ)+3(y+hsinθ)2=x2+2xhcosθ+h2cos2θxyxhsinθyhcosθ−h2sinθcosθ+3y2+6yhsinθ+3h2sin2θ=x2+2xh(35)+9h225xy4xh53yh512h225+3y2+6yh(45)+3h2(1625)=x2xy+3y2+2xh5+9h25+21yh5.f(x+hcosθ,y+hsinθ)=(x+hcosθ)2(x+hcosθ)(y+hsinθ)+3(y+hsinθ)2=x2+2xhcosθ+h2cos2θxyxhsinθyhcosθ−h2sinθcosθ+3y2+6yhsinθ+3h2sin2θ=x2+2xh(35)+9h225xy4xh53yh512h225+3y2+6yh(45)+3h2(1625)=x2xy+3y2+2xh5+9h25+21yh5.

We substitute this expression into Equation 4.36:

Duf(a,b)=limh0f(a+hcosθ,b+hsinθ)f(a,b)h=limh0(x2xy+3y2+2xh5+9h25+21yh5)(x2xy+3y2)h=limh02xh5+9h25+21yh5h=limh02x5+9h5+21y5=2x+21y5.Duf(a,b)=limh0f(a+hcosθ,b+hsinθ)f(a,b)h=limh0(x2xy+3y2+2xh5+9h25+21yh5)(x2xy+3y2)h=limh02xh5+9h25+21yh5h=limh02x5+9h5+21y5=2x+21y5.

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

Duf(−1,2)=2(−1)+21(2)5=−2+425=8.Duf(−1,2)=2(−1)+21(2)5=−2+425=8.

(See the following figure.)

The shape f(x, y) = x2 – xy + 3y2 in xyz space with tangent plane at point (–1, 2, 15). There are two arrows from the point, one seemingly along the surface of the shape and the other in a direction on the plane. The one that corresponds to the plane is marked u = 3/5 i + 4/5 j.
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. 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, 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=x0x=x0 and y=y0,y=y0, 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:

fx=2xyfy=x+6y,fx=2xyfy=x+6y,

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

Duf(x,y)=fx(x,y)cosθ+fy(x,y)sinθ=(2xy)35+(x+6y)45=6x53y54x5+24y5=2x+21y5.Duf(x,y)=fx(x,y)cosθ+fy(x,y)sinθ=(2xy)35+(x+6y)45=6x53y54x5+24y5=2x+21y5.

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

Duf(−1,2)=2(−1)+21(2)5=−2+425=8.Duf(−1,2)=2(−1)+21(2)5=−2+425=8.

This is the same answer obtained in Example 4.31.

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.

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.”

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,so f(x,y)=fx(x,y)i+fy(x,y)j=(3cos3xcos3y)i(3sin3xsin3y)j.fx(x,y)=3cos3xcos3yandfy(x,y)=−3sin3xsin3y,so f(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).
An upward facing paraboloid in xyz space with point P0 (x0, y0, z0). From this point, there are arrows going up, down, and around the paraboloid. On the xy plane, the point (x0, y0) is marked, and the corresponding arrows are drawn onto the plane: the down arrow corresponds to −∇f (most rapid decrease in f), the up arrow corresponds to ∇f (most rapid increase in f), and the arrows around correspond to no change in f. The up/down arrows are perpendicular to the around arrows in their projection on the plane.
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):

fx(x,y)=6x4yandfy(x,y)=−4x+4y,sof(x,y)=fx(x,y)i+fy(x,y)j=(6x4y)i+(−4x+4y)j.fx(x,y)=6x4yandfy(x,y)=−4x+4y,sof(x,y)=fx(x,y)i+fy(x,y)j=(6x4y)i+(−4x+4y)j.

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

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

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)=−24461i+20461j=−66161i+56161j.f(−2,3)f(−2,3)=−24461i+20461j=−66161i+56161j.

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θ=−66161andsinθ=56161cosθ=−66161andsinθ=56161

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).

An upward facing paraboloid f(x, y) = 3x2 – 4xy + 2y2 with tangent plane at the point (–2, 3, 54). The tangent plane has equation z = –24x + 20y – 54.
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.

An surface in xyz space with point at f(a, b). There is an arrow in the direction of greatest descent.
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.

Two crossing dashed lines that pass through the origin and a series of curved lines approaching the crosses dashed lines as if they are asymptotes.
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):

fx(x,y)=4x3y+2andfy=−3x+16y4sof(x,y)=(4x3y+2)i+(−3x+16y4)j.fx(x,y)=4x3y+2andfy=−3x+16y4sof(x,y)=(4x3y+2)i+(−3x+16y4)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=−9i+18j.f(−2,1)=(4(−2)3(1)+2)i+(−3(−2)+16(1)4)j=−9i+18j.

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).

A rotated ellipse with equation f(x, y) = 10. 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.
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.
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)=8f(x,y)=8 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)=5x22xy+y24yz+z2+3xzf(x,y)=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. fz(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+(−4x+3y+2z)k.fz(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+(−4x+3y+2z)k.

  2. fx(x,y,z)=−2e−2zcos2xcos2y,fy(x,y,z)=−2e−2zsin2xsin2yandfz(x,y,z)=−2e−2zsin2xcos2y,so f(x,y,z)=fx(x,y,z)i+fy(x,y,z)j+fz(x,y,z)k=(2e−2zcos2xcos2y)i+(−2e−2z)j+(−2e−2z)=2e−2z(cos2xcos2yisin2xsin2yjsin2xcos2yk).fx(x,y,z)=−2e−2zcos2xcos2y,fy(x,y,z)=−2e−2zsin2xsin2yandfz(x,y,z)=−2e−2zsin2xcos2y,so f(x,y,z)=fx(x,y,z)i+fy(x,y,z)j+fz(x,y,z)k=(2e−2zcos2xcos2y)i+(−2e−2z)j+(−2e−2z)=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=3.v=(−1)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:

fx(x,y,z)=10x2y+3zfy(x,y,z)=−2x+2y4zfz(x,y,z)=−4y+2z+3x,fx(x,y,z)=10x2y+3zfy(x,y,z)=−2x+2y4zfz(x,y,z)=−4y+2z+3x,

then substitute them into Equation 4.42:

Duf(x,y,z)=fx(x,y,z)cosα+fy(x,y,z)cosβ+fz(x,y,z)cosγ=(10x2y+3z)(13)+(−2x+2y4z)(23)+(−4y+2z+3x)(23)=10x3+2y33z34x3+4y38z38y3+4z3+6x3=8x32y37z3.Duf(x,y,z)=fx(x,y,z)cosα+fy(x,y,z)cosβ+fz(x,y,z)cosγ=(10x2y+3z)(13)+(−2x+2y4z)(23)+(−4y+2z+3x)(23)=10x3+2y33z34x3+4y38z38y3+4z3+6x3=8x32y37z3.

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:

Duf(1,−2,3)=8(1)32(−2)37(3)3=83+43213=253.Duf(1,−2,3)=8(1)32(−2)37(3)3=83+43213=253.
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 v.v.

263.

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

264.

h(x,y)=exsiny,P(1,π2),v=ih(x,y)=exsiny,P(1,π2),v=i

265.

h(x,y,z)=xyz,P(2,1,1),v=2i+jkh(x,y,z)=xyz,P(2,1,1),v=2i+jk

266.

f(x,y)=xy,P(1,1),u=22,22f(x,y)=xy,P(1,1),u=22,22

267.

f(x,y)=x2y2,u=32,12,P(1,0)f(x,y)=x2y2,u=32,12,P(1,0)

268.

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

269.

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

270.

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

271.

f(x,y)=ln(x2+y2),u=35,45,P(1,2)f(x,y)=ln(x2+y2),u=35,45,P(1,2)

272.

f(x,y)=x2y,P(−5,5),v=3i4jf(x,y)=x2y,P(−5,5),v=3i4j

273.

f(x,y)=y2+xz,P(1,2,2),v=2,−1,2f(x,y)=y2+xz,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)=x2+2y2,θ=π6f(x,y)=x2+2y2,θ=π6

275.

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

276.

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

277.

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

278.

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

279.

f(x,y)=ln(x+2y),θ=π3f(x,y)=ln(x+2y),θ=π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 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)=4x5y2z3,P(2,−1,1),u=13i+23j23kf(x,y,z)=4x5y2z3,P(2,−1,1),u=13i+23j23k

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

284.

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

285.

f(x,y,z)=yx+z,P(2,1,−1),Q(−1,2,0)f(x,y,z)=yx+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)=−7x+2y,P(2,−4),u=4i3jf(x,y)=−7x+2y,P(2,−4),u=4i3j

287.

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

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)=xy2yx2,P(−1,1)f(x,y)=xy2yx2,P(−1,1)

291.

f(x,y)=xeyln(x),P(−3,0)f(x,y)=xeyln(x),P(−3,0)

292.

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

293.

f(x,y,z)=xy2+z2,P(−2,−1,−1)f(x,y,z)=xy2+z2,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(3x+2y),(π6,π8)f(x,y)=cos(3x+2y),(π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 curve 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.

Citation/Attribution

Want to cite, share, or modify this book? This book is Creative Commons Attribution-NonCommercial-ShareAlike License 4.0 and you must attribute OpenStax.

Attribution information
  • If you are redistributing all or part of this book in a print format, then you must include on every physical page the following attribution:
    Access for free at https://openstax.org/books/calculus-volume-3/pages/1-introduction
  • If you are redistributing all or part of this book in a digital format, then you must include on every digital page view the following attribution:
    Access for free at https://openstax.org/books/calculus-volume-3/pages/1-introduction
Citation information

© Mar 30, 2016 OpenStax. Textbook content produced by OpenStax is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike License 4.0 license. The OpenStax name, OpenStax logo, OpenStax book covers, OpenStax CNX name, and OpenStax CNX logo are not subject to the Creative Commons license and may not be reproduced without the prior and express written consent of Rice University.