Critical Points of Functions of two variables
Department of Mathematics, Statistics and Computer Science
University of Illinois at Chicago
by Paul Brown, Heidi Burgiel, Marc Culler, Heather Dye and John Wood
Copyright © 1999, The University of Illinois at Chicago
Maple is a registered trademark of Waterloo Maple Software
Introduction
In this lab we practice identifying critical points -- maxima, minima, and saddle points -- using contour plots. We use Maple to display examples of many of the different forms critical points can come in.
As you know, a common use of calculus is to determine maximum values or minimum costs. In single variable calculus, one finds maxima and minima of functions by examining points at which the tangent line to the graph of the function is horizontal, i.e. where the derivative is equal to zero. Functions of two variables behave similarly; their maxima and minima are often found at points where the tangent plane to the graph of the function is horizontal, i.e. where the gradient is zero.
Let's look at a simple example:
> f := (x,y) -> x^2 + y^2;
> plot3d(f(x,y), x=-1..1, y=-1..1, axes=BOX, shading=ZHUE, style=PATCHCONTOUR, scaling=CONSTRAINED);
We see that the graph of f has a critical point, a minimum, at (0,0). We can see from the definition of f , or by zooming out, that the graph of f goes upward in all directions away from this minimum and never decreases again. Use Maple to draw the graph of f for yourself. View the graph from the side and from the top. Zoom out to see that f has no other critical points. Zoom in on (0,0) and see how the graph of f becomes more and more like a horizontal plane.
Shown below is a plot of the graph of f near (0,0), drawn with the option scaling=CONSTRAINED . We see from this that the tangent plane to f at (0,0) is horizontal.
> plot3d(f(x,y), x=-0.01..0.01, y=-0.01..0.01, axes=BOX, scaling=CONSTRAINED, style=PATCHCONTOUR);
Another way to study functions of two variables is by looking at their contour plots. Here is the contour plot of f :
> with(plots):
> contourplot(f(x,y), x=-1..1, y=-1..1);
The contours are concentric circles about the critical point. This is not surprising -- f increases uniformly as it moves away from its minimum value, so its contours should be circles around the point at which it takes on that minimum. In general, you should look for a minimum or maximum critical point wherever you see concentric rings of contour lines.
The contour plot above doesn't give much detail inside the square of width 1 centered at the origin. Functions can have very complicated clusters of critical points, so it's a good idea to zoom in on areas where you expect to find a critical point.
> contourplot(f(x,y), x=-0.1..0.1, y=-0.1..0.1);
However far we zoom in on the contour plot of f , we will always see concentric circles. We conclude from this that f does indeed have a single, minimum, critical point at (0,0).
Exercise 1
Use Maple to plot the function f1(x,y) = x^2 + 4*x + 4 + y^2 and its contours. Give the coordinates of the single critical point of this function and state whether it is a maximum or minimum. You may need to zoom in or out to locate the critical point.
Saddle Points
In the last section, we studied a simple minimum of a function. Maxima of functions behave very similarly to minima. After maxima and minima, the next simplest type of critical point is a saddle point. A saddle point is like a critical point of inflection of a function of one variable -- at a saddle point, the function "levels out" but around the point it increases in some directions and decreases in others.
> plot(x^3, x=-1..1, title="Critical Point of Inflection", scaling=CONSTRAINED);
> g := (x,y) -> x^2 - y^2;
> plot3d(g(x,y), x=-1..1, y=-1..1, shading=ZHUE, axes=BOX, scaling=CONSTRAINED, style=PATCHCONTOUR);
The function g(x,y) = x^2 - y^2 plotted above has a saddle point at (0,0). As you move away from (0,0) in the x direction, the function increases. As you move away in the y direction, g decreases. We can see by zooming in that the tangent plane to the graph of g is horizontal at (0,0), so (0,0) must be a critical point of g which is neither a maximum or minimum.
> plot3d(g(x,y), x=-0.01..0.01, y=-0.01..0.01, shading=ZHUE, axes=BOX, scaling=CONSTRAINED, style=PATCHCONTOUR);
Near the maxima and minima of a function, the contour plot looks like a set of concentric rings. What does the contour plot of a saddle point look like?
> contourplot(g(x,y), x=-1..1, y=-1..1, scaling=CONSTRAINED);
The contour lines of g are the hyperbolae x^2 - y^2 = c , for different constants c . At the saddle point (0,0), two contour lines cross. This is typical of saddle points.
Exercise 2
The gradient vector of a function is perpendicular to its contour lines. At a saddle point, two contour lines cross and the gradient vector must be perpendicular to both these lines at the crossing point. What is the gradient vector's value at the point where the two contour lines cross?
NOTE: Although it is true that some pair of contour lines will cross at a saddle point, Maple will not always choose to draw exactly that pair of lines. Below is a contour plot of the function g in which the crossing contour lines are not shown. There is still a cross shape at the center of the region, which is enough to identify the saddle point.
> contourplot(g(x,y), x=-1..1, y=-1..1, contours=13, scaling=CONSTRAINED);
A Fancy Example
More exotic functions can have more than one critical point. The function h defined below has two maxima, a minimum, and two saddle points.
> h := (x,y) -> (2*x^2 + y^2) * exp(-x^2-y^2);
> plot3d(h(x,y),x=-2.5..2.5,y=-2.5..2.5, axes=BOX,style=PATCHCONTOUR, shading=ZHUE);
Exercise 3
Use Maple or the contour plot of h shown below to give approximate coordinates of the maxima, minimum, and saddle points of the function h(x,y) . Label each point as a maximum, a minimum, or a saddle point.
> contourplot(h(x,y), x=-2..2, y=-2..2, scaling=CONSTRAINED, grid=[50,50], contours=12);
Exercise 4
Use Maple's plot3d and contourplot functions to identify the maxima, minima and saddle points of the functions listed below. Give approximate coordinates for each critical point. NOTE: You should zoom in and zoom out on each graph to be sure you have found all the critical points.
a) f2(x,y) = x*y/sqrt(x^2+y^2)
b) f3(x,y) = x^3 - x^2 + y^2
c) f4(x,y) = (y-2)*(y^2-3*x^2)*exp(-(x^2+y^2)/3)
Exotic Examples
Most critical points you will encounter will be maxima, minima or saddle points. However, functions of multiple variables can and do behave in strange ways. Below we use Maple to illustrate some of the more exotic critical points and arrangements of critical points that can occur.
First, a function which has a saddle point but which increases in both the x and y directions:
> g1 := (x,y) -> x^2 + 3* x*y + y^2;
> plot3d(g1(x,y), x=-2..2, y=-2..2, axes=BOX, shading=ZHUE, style=PATCHCONTOUR);
Generally, we expect to find saddle points at a "pass" between two "peaks"; we expect to find maxima and/or minima (or a simple slope upward to infinity) wherever we find saddle points. The next function shows the falacy of this assumption; it has two saddle points but no maxima or minima. If you have trouble finding the saddle points in the graph, look at the contour plot below.
> g2 := (x,y) -> x + x*y - x^2 * y;
> plot3d(g2(x,y), x=-1..1.5, y=-2..2, axes=BOX, shading=ZHUE, style=PATCHCONTOUR);
> contourplot(g3(x,y), x=-1..1.5, y=-2..2, contours=16, axes=BOX);
This next function has four maxima, one minimum, and four saddle points. Can you think of an example of a function with infinitely many maxima and saddle points? Can you think of a function with no maxima or minima but infinitely many saddle points?
> g4 := (x,y) -> (x^4+y^4) * exp(-(x^2+y^2)/3);
> plot3d(g4(x,y), x=-4..4, y=-4..4, axes=BOX, style=PATCHCONTOUR);
Here we see a function with an unusual critical point. It is not a minimum, but as you follow any straight line toward the origin, the function decreases to zero. Can you see where it's less than zero?
> g5 := (x,y) -> (y-x^2)*(y-0.5*x^2);
> plot3d(g5(x,y), x=-2..2, y=-2..4, axes=BOX, shading=ZHUE, style=PATCHCONTOUR, grid=[50,50], contours=10);
The critical point shown below is called a monkey saddle . As you move around a simple saddle point, the surface of the graph rises, falls, rises, and falls again. As you move around a monkey saddle the surface rises, falls, rises, falls, rises and falls. It is called a monkey saddle because a monkey could ride in it without hurting its tail.
> g6 := (x,y) -> x^3-3*x*y^2;
> plot3d(g6(x,y), x=-5..5,y=-5..5, axes=BOX, grid=[50,50], style=PATCHCONTOUR, shading=ZHUE);
The minimum values of the graph shown below aren't proper critical points at all. They lie on a complete circle about the origin. Functions like g8(x,y) = abs(x) have similar degenrate maxima and minima.
> g7 := (x,y) -> cos(sqrt(x^2+y^2));
> plot3d(g7(x,y), x=-5..5, y=-5..5, axes=BOX, shading=ZHUE);
Exercise 5
Fill in the blanks of the following sentence with words or sketches. If you get stuck, re-read the first two sections of the lab.
"Near local maxima and minima, contour lines of the function usually look like ____________. Near saddle points, they look like _____________."