Maxima and Minima of Functions

Purpose
The purpose of this lab is to acquaint you with techniques for finding and classifying local (or relative) and absolute extreme values of functions of two variables, especially within a closed domain of the xy-plane.

Background/Examples
Many applications of calculus involve finding the maximum and minimum values of functions. For example, suppose that there is a network of electrical power generating stations, each with its own cost for producing power, with the cost per unit of power at each station changing with the amount of power it generates. An important problem for the network operators is to determine how much power each station should generate to minimize the total cost of generating a given amount of power.

A crucial first step in solving such problems is being able to find and classify local extreme points of a function. What we mean by the term local extreme values is contained in the following definition.

 Definition 1 Let f be a function defined at a point (xo, yo). Then f(xo, yo) is a local maximum if f(xo, yo) f(x, y) for all (x, y) in an open disk containing (xo, yo) and f(xo, yo) is a local minimum if f(xo, yo) f(x, y) for all (x, y) in an open disk containing (xo, yo). If f(xo, yo) is a local maximum or a local minimum, we say that it is a local extreme value.

In single-variable calculus, we found that the first derivative vanished at a local extreme value. For functions of two variables, both first-order partial derivatives vanish as described by the following theorem.

 Theorem 1 If a function f has a local extreme value at a point (xo, yo) and the partial derivatives of f both exist at (xo, yo), then

Notice that having both first order partial derivatives vanish means that the tangent plane is horizontal. Following the terminology we used for functions of a single variable, we call points where the partial derivatives fx and fy vanish critical points. Note carefully that the theorem does not say that a point where the partial derivatives vanish must be a local extreme point. Rather, it says that critical points are candidates for local extrema. Just as was the case for functions of a single variable, there can be critical points that are not extrema. For example, the saddle surface f(x, y) = x2 - y2 has a critical point at the origin, but it is not a local extrema.

Finding and classifying the local extreme values of a function f(x, y) requires several steps. First, the partial derivatives must be computed. Then, the critical points must be solved for, which is not always a simple task. Finally, each critical point must be classified as a local maximum, local minimum, or neither. The following examples are intended to help you learn how to use Maple to simplify these tasks.

To compute partial derivatives in Maple, it is probably simplest to use the diff command. It is possible to use the D command for partial derivatives, but it is more complicated. The following examples show how to compute (in order) the partial derivatives fx, fy, fxx, fxy, and fyy of the function f(x, y) = exp(-x2) cos y.

> f := (x,y) -> exp(-x^2)*cos(y);

> diff(f(x,y),x);

> diff(f(x,y),y);

> diff(f(x,y),x,x);

> diff(f(x,y),x,y);

> diff(f(x,y),y,y);

Finding critical points can often be accomplished by using the solve command, as shown below.

> solve({diff(f(x,y),x) = 0, diff(f(x,y),y) = 0}, {x,y});

Notice that you have to give the solve command the set of equations to be solved and the set of variables to be solved for and that both sets have to be enclosed in curly braces.

The solve command doesn't always do the job. For example, it only reported one critical point above. It turns out, however, that the function has an infinite number of critical points of the form x = 0, y = n, where n is any integer. Having an infinite number of critical points often happens when trig functions are involved, so you need to watch out for it.

The solve command attempts to solve equations analytically. Unfortunately, there are some equations that just can't be solved analytically. When Maple can't solve a set of equations analytically, it gives no output from the solve commands.

If the solve command doesn't give the results you desire, there are alternatives. One possibility is to try to solve one of the equations for one of the variables in terms of the other, and then substitute into the other equation. This can work very well if it is easy to solve for one of the variables. Another, more general method is to solve the equations numerically using the fsolve command. The main drawbacks are that the fsolve command only finds one solution at a time and that you usually have to have an idea of where the solution is. For example, if you attempt to use the fsolve command on our example without specifying where to look for the solution, Maple can't solve the equation, as shown below.

> fsolve({diff(f(x,y),x) = 0, diff(f(x,y),y) = 0}, {x,y});
Error, (in fsolve/gensys) did not converge

On the other hand, we can solve for the critical point at x = 0, y = 2 if we specify ranges for x and y containing the desired critical point as follows

> fsolve({diff(f(x,y),x) = 0, diff(f(x,y),y) = 0}, {x,y}, {x=-1..1, y=3.5..7});

Locating (if you have to use fsolve) and classifying critical points is probably best done with the plot3d command. By changing the plot ranges and using contours, you should be able to do this fairly easily.

Exercises

1. For each of the following functions,
1. Print out a plot of the level curves
2. Calculate the partial derivatives fx and fy at several points (at least 4) on these plots and for each point, build the gradient vector

f(x, y) = fx(x, y) i + fy(x, y) j

3. Graphically (by hand) place arrows showing the direction of f at every selected point and label the directions of increase and decrease for each function
4. What types of critical points do these functions have at their origins (0, 0)? Classify each critical point as a local minimum, local maximum, or saddle point.

1. f(x, y) = 2x2 + 3y2
2. f(x, y) = xy
3. f(x, y) = exp(-3x2 - y2)

2. The bottom of the sea is described at a certain location by the function

f(x, y) = x3 - y3 - 2xy + 6.

To construct an offshore oil platform within the square domain -1 x 1, -1 y 1, it is necessary to find the point where f(x, y) attains its absolute maximum within the domain. Find this point and justify your answer.

3. A flat circular plate has the shape of the region x2 + y2 1. The plate, including the boundary where x2 + y2 = 1, is heated so that the temperature at the point (x, y) is given by

T(x, y) = x2 + 2y2 - x.

Find the temperature and coordinates of the hottest and coldest points of the plate.

Back to the top

Created by Henry Fink
Last updated: Monday, September 29, 1997