Gradient Vectors, Contour Diagrams, and the Path of Steepest Ascent

Figures 14.42-45, Example 4: Exploring the relationship between a gradient vector of a function of two variables and the path of steepest ascent from a given point.  The relationships between the gradient vector and the contour diagram and between the gradient vector and a vector tangent to the path of steepest ascent, pointing uphill, are also explored.
Overview:

This applet allows you to explore properties of the gradient vector of two functions of two variables,  f (x, y) =  4 - x2 - 2y2  and  f (x, y) =  4 - x2. The contour diagram is shown in the smaller 2D plot to the left of the larger 3D surface plot of the graph of the selected function of two variables.  The contours are also displayed on the surface plot in 3D in order to show their vertical position in space (above or below the xy-plane).

If you click (or click and drag) the input point with the right mouse button, the path of steepest ascent is drawn from that point to the summit (nearest local maximum) on both the 2D and the 3D plots.

As you move the input point (x, y) around in the 2D plot of the xy-plane on the left, the gradient vector is displayed at the point on the 2D plot and also on the 3D plot.  On the 3D plot, a vector tangent to the path of steepest ascent from the current point, facing uphill, is also shown.

Formulas for the gradient vector and the tangent vector are shown at the top left of the 3D plot along with the current input point.

Instructions:

If you click and drag on the small 2D grid to the left of the 3D plot you, a trace point moves around on the surface corresponding to the point (x, y) on the 2D plot.  The gradient and tangent vectors at this point on the surface are also shown, with the gradient vector shown in the xy-plane at the input point in the 3D plot.

At any time, you can use the scrollbar to move the trace point and tangent vector along the current path of steepest ascent.  (As described above, you can move this path using the right mouse button.)  This helps you to consider the way the gradient vectors consistently point in the compass direction you should move in to ascend the surface most steeply.

There are also several useful menu options.  In addition to the Select 3D View menu (described below), there is an Options menu and a Help menu.  Using the Options menu, you can choose the scale factor to use to shorten the appearance of the gradient vector and the tangent vector, dividing by a value from 1 to 10.  The default is 3 for the first function in this applet, since the vectors lengths are otherwise quite long.  (It is 1 for the other function.)  This means that the vectors are displayed at 1/3 their normal length to make them easier to view.  To see them actual size, simply set the scale factor to 1.

At any time, you can rotate the 3D graph to get a better perspective by using the mouse to click on the 3D plot and then using the left and right arrow keys to rotate the 3D graph about the z-axis. You can also click and drag anywhere on the 3D plot to rotate it about the origin in the direction you drag the mouse.

There is a button to adjust the viewing region for the first function, f (x, y) =  4 - x2 - 2y2.  This allows you to adjust how much of the surface is drawn so that you can more easily see the gradient vector underneath the surface.  (This button is only enabled for this surface.)  There is also a button for making the surfaces semi-transparent.  This gives another useful way to view the gradient vector in the 3D plot, although it is slower to rotate, and it makes the 3D effect less clear when used with 3D glasses (described in the next paragraph).

A feature that you may find helpful is the Select 3D View menu.  On this menu, you can select from a list of 3D viewing options.  Most require 3D glasses of one kind or another (red-cyan/red-blue, red-green, or amber-blue), but there are two 3D viewing options that do not require 3D glasses, but still can give a truer 3D experience.  These options are Stereo Pair and Cross-eyed.  Both of these require some practice, but give a full color 3D view.  See the 3D View Help for more details on all of these options.

Activities & Questions:  Try the following activities, in the order listed below.  Open Applet.
  1. First, with the input point still at the default location of (1, 1) in the xy-plane, consider the corresponding trace point on the 3D plot.  [If you have done other things in the applet first, simply reload the applet to refresh the view or hit the HOME key and move the input point to (1, 1) in the contour diagram.]  What is the z-coordinate of this point?  Use the function to check that this value is correct.

  2. Note the blue path of steepest ascent that is displayed on both graphs.  Use the scrollbar to move the input point and the corresponding trace point along this path.  Watch the gradient vector in the 2D contour diagram and the tangent vector (and gradient vector) in the 3D plot. 

  3. What is always true about the gradient vector in the 2D contour diagram?  (Hint:  It is what allows us to trace out this path of steepest ascent.)  To explore this property of the gradient further, try clicking and dragging the input point around on the 2D contour diagram.  What do you notice?

  4. Why do the gradient vectors get shorter as they approach the summit?

  5. Why does the path bend (and not simply go straight to the summit) for the first function?

  6. Use the mouse to right-click and drag this path of steepest ascent around on the contour plot and surface.  Where on the surface do you in fact get a path of steepest ascent that does ascend straight up the surface to the summit, that is, where is it a straight line segment on the 2D contour diagram?

  7. Explain why the tangent vector on the surface plot is not the gradient vector and explain the relationship between the gradient vector and the corresponding tangent vector (at each point).

  8. Now use the drop-down function menu to switch to the other function/surface.  Repeat Step 1 above (but use the default location (-1, -1) for this function, as in the textbook.

  9. Repeat Steps 2 -4 above for the second function/surface.

  10. Why does the path not bend this time, that is, why is it always a straight line segment in the 2D contour diagram?  What is different from the first function?

Additional Help & Features:
Some control keys you may find useful:

Hit Ctrl-i:                  To Zoom In.
Hit Ctrl-o:                 To Zoom Out.

Hit Home:                 To restore the view to its standard viewpoint.
Hit Ctrl-Home:          To view the solid from above the xy-plane.

Hit the e key:            To turn the black edges in the grid on and back off.
Hit the f key:             To turn the solid faces in the framework that forms the solid on and off.
 (When the faces are off and the edges are on, this looks like a wire mesh.)

Hit left-arrow:           To rotate the view about the z-axis clockwise.
Hit right-arrow:         To rotate the view about the z-axis counterclockwise.
 

(Note: You may have to click on the 3D plot before these control keys will work.)

Link to the applet:  Figures 14.42-45, Example 4


This applet was created for Hughes-Hallett Calculus, published by John Wiley & Sons,
by Paul Seeburger, Assistant Professor of Mathematics
at Monroe Community College in Rochester, NY.

If you have comments or suggestions, please send me an email at:
pseeburger@monroecc.edu