Differentiation of Functions of Several Variables

# 26 Directional Derivatives and the Gradient

### Learning Objectives

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

In Partial Derivatives we introduced the partial derivative. A function has two partial derivatives: and 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, represents the slope of a tangent line passing through a given point on the surface defined by assuming the tangent line is parallel to the x-axis. Similarly, represents the slope of the tangent line parallel to the 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 Given a point in the domain of 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)). The distance we travel is and the direction we travel is given by the unit vector Therefore, the z-coordinate of the second point on the graph is given by

Finding the directional derivative at a point on the graph of 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 by the length of the line segment connecting the two points in the domain. The length of the line segment is Therefore, the slope of the secant line is

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

Definition

Suppose is a function of two variables with a domain of Let and define Then the directional derivative of in the direction of is given by

provided the limit exists.

(Figure) provides a formal definition of the directional derivative that can be used in many cases to calculate a directional derivative.

Finding a Directional Derivative from the Definition

Let Find the directional derivative of in the direction of What is

First of all, since and is acute, this implies

Using we first calculate

We substitute this expression into (Figure):

To calculate we substitute and into this answer:

(See the following figure.)

Finding the directional derivative in a given direction at a given point on a surface. The plane is tangent to the surface at the given point

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

Directional Derivative of a Function of Two Variables

Let be a function of two variables and assume that and exist. Then the directional derivative of in the direction of is given by

#### Proof

(Figure) states that the directional derivative of f in the direction of is given by

Let and and define Since and both exist, we can use the chain rule for functions of two variables to calculate

If then and so

By the definition of it is also true that

Therefore,

Finding a Directional Derivative: Alternative Method

Let Find the directional derivative of in the direction of What is

First, we must calculate the partial derivatives of

Then we use (Figure) with

To calculate let and

This is the same answer obtained in (Figure).

Find the directional derivative of in the direction of using (Figure). What is

Hint

Calculate the partial derivatives and determine the value of

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 (Figure) in the direction of the vector we would first divide by its magnitude to get This gives us Then

The right-hand side of (Figure) is equal to which can be written as the dot product of two vectors. Define the first vector as and the second vector as Then the right-hand side of the equation can be written as the dot product of these two vectors:

The first vector in (Figure) has a special name: the gradient of the function The symbol is called nabla and the vector is read

Definition

Let be a function of such that and exist. The vector is called the gradient of and is defined as

The vector is also written as

Find the gradient of each of the following functions:

For both parts a. and b., we first calculate the partial derivatives and then use (Figure).

Hint

Calculate the partial derivatives, then use (Figure).

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 and is then Therefore, if the angle between and is we have

The disappears because is a unit vector. Therefore, the directional derivative is equal to the magnitude of the gradient evaluated at multiplied by Recall that ranges from to If then and and both point in the same direction. If then and and point in opposite directions. In the first case, the value of is maximized; in the second case, the value of is minimized. If then for any vector These three cases are outlined in the following theorem.

Suppose the function is differentiable at ((Figure)).

1. If then for any unit vector
2. If then is maximized when points in the same direction as The maximum value of is
3. If then is minimized when points in the opposite direction from The minimum value of is
The gradient indicates the maximum and minimum values of the directional derivative at a point.

Finding a Maximum Directional Derivative

Find the direction for which the directional derivative of at is a maximum. What is the maximum value?

The maximum value of the directional derivative occurs when and the unit vector point in the same direction. Therefore, we start by calculating

Next, we evaluate the gradient at

We need to find a unit vector that points in the same direction as so the next step is to divide by its magnitude, which is Therefore,

This is the unit vector that points in the same direction as To find the angle corresponding to this unit vector, we solve the equations

for Since cosine is negative and sine is positive, the angle must be in the second quadrant. Therefore,

The maximum value of the directional derivative at is (see the following figure).

The maximum value of the directional derivative at is in the direction of the gradient.

Find the direction for which the directional derivative of at is a maximum. What is the maximum value?

The gradient of at is The unit vector that points in the same direction as is which gives an angle of The maximum value of the directional derivative is

Hint

Evaluate the gradient of at point

(Figure) shows a portion of the graph of the function Given a point in the domain of the maximum value of the gradient at that point is given by 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.

A typical surface in 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)). 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.

Contour map for the function using level values between and

Recall that if a curve is defined parametrically by the function pair then the vector is tangent to the curve for every value of in the domain. Now let’s assume is a differentiable function of and is in its domain. Let’s suppose further that and for some value of and consider the level curve Define and calculate on the level curve. By the chain Rule,

But because for all Therefore, on the one hand,

on the other hand,

Therefore,

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.

Gradient Is Normal to the Level Curve

Suppose the function has continuous first-order partial derivatives in an open disk centered at a point If then is normal to the level curve of at

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

Finding Tangents to Level Curves

For the function find a tangent vector to the level curve at point Graph the level curve corresponding to and draw in and a tangent vector.

First, we must calculate

Next, we evaluate at

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

Tangent and normal vectors to at point

For the function find the tangent to the level curve at point Draw the graph of the level curve corresponding to and draw and a tangent vector.

Tangent vector: or

Hint

### Three-Dimensional Gradients and Directional Derivatives

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

Definition

Let be a function of three variables such that exist. The vector is called the gradient of and is defined as

can also be written as

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 and and then we use (Figure).

Find the gradient of each of the following functions:

For both parts a. and b., we first calculate the partial derivatives and then use (Figure).

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 in standard form (i.e., the initial point is at the origin), this vector forms three different angles with the positive and z-axes. Let’s call these angles and Then the directional cosines are given by and These are the components of the unit vector since is a unit vector, it is true that

Definition

Suppose is a function of three variables with a domain of Let and let be a unit vector. Then, the directional derivative of in the direction of is given by

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

Directional Derivative of a Function of Three Variables

Let be a differentiable function of three variables and let be a unit vector. Then, the directional derivative of in the direction of is given by

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

Finding a Directional Derivative in Three Dimensions

Calculate in the direction of for the function

First, we find the magnitude of

Therefore, is a unit vector in the direction of so Next, we calculate the partial derivatives of

then substitute them into (Figure):

Last, to find we substitute

Calculate and in the direction of for the function

Hint

First, divide by its magnitude, calculate the partial derivatives of then use (Figure).

### Key Concepts

• A directional derivative represents a rate of change of a function in any given direction.
• The gradient can be used in a formula to calculate the directional derivative.
• The gradient indicates the direction of greatest change of a function of more than one variable.

### Key Equations

• directional derivative (two dimensions)

or
• directional derivative (three dimensions)

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

at point in the direction of

at point in the direction of

Find the directional derivative of at point in the direction of

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

For the following exercises, find the directional derivative of the function in the direction of the unit vector

For the following exercises, find the gradient.

Find the gradient of at point

Find the gradient of at and in the direction of

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

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

[T] Use technology to sketch the level curve of that passes through and draw the gradient vector at

[T] Use technology to sketch the level curve of that passes through and draw the gradient vector at

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

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

at point in the direction the function increases most rapidly

at point in the direction the function increases most rapidly

at point in the direction the function increases most rapidly

at point in the direction the function increases most rapidly

at point in the direction the function increases most rapidly

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

For the following exercises, find equations of

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

The level curve for at point

at point

a. b.

at point

at point

a. b.

For the following exercises, solve the problem.

The temperature in a metal sphere is inversely proportional to the distance from the center of the sphere (the origin: The temperature at point is

1. Find the rate of change of the temperature at point in the direction toward point
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.

The electrical potential (voltage) in a certain region of space is given by the function

1. Find the rate of change of the voltage at point in the direction of the vector
2. In which direction does the voltage change most rapidly at point
3. What is the maximum rate of change of the voltage at point

a. b. c.

If the electric potential at a point in the xy-plane is then the electric intensity vector at is

1. Find the electric intensity vector at
2. Show that, at each point in the plane, the electric potential decreases most rapidly in the direction of the vector

In two dimensions, the motion of an ideal fluid is governed by a velocity potential The velocity components of the fluid in the x-direction and in the y-direction, are given by Find the velocity components associated with the velocity potential

### Glossary

directional derivative
the derivative of a function in the direction of a given unit vector