Level sets

Graphing functions

In earlier courses, you’ve had plenty of practice graphing scalar-valued functions of a single variable, such as f(x) = x2. Now, we will investigate scalar-valued functions of several variables. First, we focus on scalar-valued functions of two variables. We can denote such a function by f : R2 R (see this reading if you want to read more about such function notation). We frequently write a scalar-valued function of two variables as f(x,y).

We can visualize a scalar-valued function of two variables by its graph, analogous to a graph of a function of a single variable. The graph of a function f(x,y) is the set of all the points (x,y,z) where z = f(x,y). (Sometimes we write the points as (x,y,f(x,y)), in order to be more succinct.)

As an example, we’ll graph the function f(x,y) = -x2 - 2y2 using the domain defined by -2 x 2 and -2 y 2. The graph of all points (x,y,f(x,y)) with (x,y) in this domain is shown in the following figure.

Level curves

Three-dimensional plots, such as the above figure, are more difficult to draw and visualize than two-dimensional plots. For this reason, it is frequently useful to collapse the graph of a scalar-valued function of two variables into a two-dimensional plot. One way to accomplish this is through level curves.

A level curve of a function f(x,y) is the curve of points (x,y) where f(x,y) is some constant value. A level curve is simply a cross section of the graph of z = f(x,y) taken at a constant value, say z = c. A function has many level curves, as one obtains a different level curve for each value of c in the range of f(x,y). We can plot the level curves for a bunch of different constants c together in a level curve plot, which is sometimes called a contour plot.

We return to the above example function f(x,y) = -x2 - 2y2. For some constant c, the level curve f(x,y) = c is the graph of c = -x2 - 2y2. As long as c < 0, this graph is an ellipse, as one can rewrite the equation for the level curve as

 2
x--
- c +   2
-y---
- c∕2 = 1.
(If c is negative, then both denominators are positive.) For example, if c = -1, the level curve is the graph of x2 + 2y2 = 1. In the level curve plot of f(x,y) shown below, the smallest ellipse in the center is when c = -1. Working outward, the level curves are for c = -2,-3,,-10.

PIC

To illustrate the relationship between the level curves and the graph, the below CVT includes the graph of the function f(x,y) = -x2 - 2y2 along with a level curve plot hovering above the graph. Drag the blue dot up and down to change the value of c. The level curve f(x,y) = c is shown in red in the level curve plot. The level curve is where the plane z = c intersects the graph z = f(x,y).

Level surfaces

For a scalar-valued functions of three variables, f : R3 R, we would need four dimensions to draw its graph. Since we now are comfortable vectors in higher dimensions, the idea of a set of points (x,y,z,w) with w = f(x,y,z) shouldn’t be completely foreign. However, unless your mind is better at abstract visualization than mine, you may have a hard time visualizing what this graph in four dimensions would look like.

Instead, we can look at the level sets where the function is constant. For a function of two variables, above, we saw that a level set was a curve in two dimensions that we called a level curve. For a function of three variables, a level set is a surface in three-dimensional space that we will call a level surface. For a constant value c in the range of f(x,y,z), the graph of c = f(x,y,z) is a level surface of f.

To emphasize that level curves and level surfaces are similar concepts, I have redone the CVT for level curves to put it in the format that we will use for level surfaces. Below is a CVT of the level curves of the same function f(x,y) = -x2 - 2y2 demonstrated above. This time, I am showing only the two-dimensional plot of the the curves. I also show only one level curve c = f(x,y) at a time. You can drag the slider to change c and hence the level curve being displayed. Here, I did not restrict the level curves to the domain -2 x 2, -2 y 2, so you see an entire ellipse for each value of c.

Now, we look at the function f(x,y,z) = 10e-9x2-4y2-z2. Even though we can’t plot the graph of f(x,y,z) (without using four dimensions), we can still visualize the behavior of the function by plotting its level surfaces. We simply plot f(x,y,z) = c for c between 0 and 10. (Note that f(x,y,z) always lies between 0 and 10. The argument of the exponential is always negative or zero, so the value of the exponential is always between zero and one.) The behavior of these level surfaces is illustrated in the following CVT. You can drag the blue point on the slider to change c, and hence the level surface being displayed.

The significance of the level surfaces may become clearer if you think of f(x,y,z) as giving the temperature at the point (x,y,z). Then, the level surface f(x,y,z) = 2 is the surface of points where the temperature is 2. In this example, the temperature at the origin is 10 and every other point has a lower temperature. Hence, the level surface f(x,y,z) = c shrinks to a point around the origin as c increases to 10.

As one moves away from the origin, the temperature decreases. The temperature decreases toward zero as you get far from the origin. The level surface f(x,y,z) = 0 doesn’t exist because f(x,y,z) never reaches zero. But, if c is a small positive number, the level surface f(x,y,z) = c is a large ellipsoid. (The CVT won’t let c get all the way down to 0; the lowest c goes is about 0.00001.)

You can look at a couple more examples here.