Laboratory 8
Directional Derivatives
Introduction
In this laboratory, we shall discuss the directional derivatives of a function. The directional derivative can be used to find the directions in which a function is increasing or decreasing most rapidly, as well as to find the directions in which a function remains constant.
Example 8.1, Introduction to Directional Derivatives
Consider the function
We know from our study of partial derivatives that if we hold
constant, say
, and consider the function
, then the derivative of this function at the point
is the partial derivative
. We can interpret this as the derivative of the function
at the point
in the direction of the
-axis, or equivalently in the direction of the unit vector
. On the other hand, if we want the derivative of the function in the direction of the
-axis, or equivalently in the direction of the unit vector
, we can find that by calculating the partial derivative
.
Now suppose that we want to find the derivative of the function
in some other direction, say
. For simplicity, we require that the vector
be a unit vector so that
. If we start out at the point
and move in the direction
, then we would be following the parametric curve
.
The function
on this curve would then be a function of
given by
![]()
and we would like to know what the derivative of this function is with respect to
at the time when
. We can find this derivative by using the chain rule;
.
From the definition of
, we can then calculate
and
to see that
.
We can rewrite this expression with the aid of the gradient vector
as
.
Let us see how this works in the context of our original example. Suppose that we want to find the derivative of
at the point
in the direction towards the point
. First, we let
be the vector from
to
.
Because
does not have unit length, we let
, which has length 1, and still points in the same direction as
. To do this, we use the fact that
.
Set
which gives us the parametric form of a line starting at
and heading in the direction
. We then calculate
when
. For simplicity, we shall write
. Remember that, in this problem we want the derivative at the point
so that
.
We then calculate
We claim that the derivative of
at
in the direction towards
is
.
To understand what this means graphically, let us graph the function
, and compare it to the graph of
where the vertical plane through
and
is shown.
We shall do so with the aid of a module called Slice that we define below. The first input to Slice
is the function itself; the next two pairs of inputs are the coordinates of two points in the
-plane; the module returns a graph of
and the vertical plane that contains these two points. The last inputs are the
-range,
-range and
-range of the graph.
We ignore the warning; we are not interested in Mathematica's built in command Splice. We execute the module Slice where the x-range and the y-range are chosen so that the points of interest
and
are on opposite corners of a rectangle, and the
-range is chosen to give a good picture.
Let us also plot the graph of the function
. Recall that we have chosen the function
so that one unit of distance in the three dimensional graph corresponds to one unit of distance for the independent variable
. Because the distance from
to
is
, we plot the graph of
for
.
We can see that the graph of
agrees with the portion of the graph of
that lies on the vertical plane containing
and
. As a consequence, we see that the derivative of
at
in the direction towards
is the same as the derivative of
when
, namely
.
We saw above however, that there is another method we could use to calculate this directional derivative; we could calculate the gradient of
, and then find
. We know that the gradient vector is given by
.
We can then calculate
Substitute
and
to obtain
which agrees with our original answer.
We remark that Mathematica has a command Grad which is part of the Calculus`VectorAnalysis` package, but we shall not discuss it.
Experiment 8.1
Find the directional derivative of
at the indicated point in the direction toward the second indicated point. Calculate the derivative in two ways, as
and as
, and include graphs of the function
as well as a graph of the function
together with the vertical plane containing the starting point and ending point.
1.
at
towards
.
2.
at
towards
.
3.
at
towards
.
4.
at
towards
.
5.
at
towards
Example 8.2 Direction of Fastest Change; Level Surfaces
Consider once again the function
In the previous example, we learned how to find the derivative of this function in any direction; in particular if
is a vector of length 1, then the derivative of
at the point
in the direction of
is exactly
.
Now suppose that we wanted to know in which direction the function increases most rapidly. Because the directional derivative of
is
, we conclude that the directional derivative is largest when
points in the same direction as
; in particular, the function increases most rapidly when
. Similarly, the function decreases most rapidly when
points in the direction opposite to
, so that
.
For example, to find the direction in which
increases most rapidly at the point
, we proceed as follows.
The function
increases most rapidly in the direction
, and decreases most rapidly in the direction
.
Next, note that if
is perpendicular to
, then the directional derivative of
in the direction of
is identically zero. In two dimensions, we can find a vector perpendicular to a given vector
by setting
. Thus, given a function
, we know that
is constant in the direction
as well as in the direction
. In the case of our example function
, if we want to find in which directions
remains constant at the point
, we can proceed as follows.
Thus we see that the function remains constant in the direction
and
at the point
.
To better understand the relationship between the gradient and the function, let us take a look at the gradient vector field superimposed on the contour graph of the function. To do so, we shall use the module ContourVectorPlot that is defined below. It takes as input a function
as well as a viewing box.
The gradient vector at each point is represented by an arrow of the same length and direction starting at that point. At points where the length of the gradient vector is small, all that is seen is simply the head of the vector.
From the contour graph overlaid by the gradient vector field, we can see that the gradient vectors are always perpendicular to the level curves of the surface, and moreover that they point in the direction in which the function is increasing most rapidly.
Experiment 8.2
For each of the following functions at the indicated points, find the direction in which the function increases most rapidly, and the directions along which the function is constant. Include a graph of the function as well as a graph of the gradient field overlaid on the contour graph. On the printout of the graph of the gradient field overlaid on the contour graph, draw in by hand the direction vectors that you found, and label them.
1.
at
.
2.
at
.
3.
at
.
4.
at
.
5.
at
.
Credits
These laboratories were created by Raouf Boules, Geoff Goodson, Ohoe Kim and Mike O'Leary for use in the Calculus courses of Towson University. Commercial use is prohibited without permission of the authors. Non-commercial use is permitted, provided this credit section is retained.
Created by Mathematica (August 20, 2004)