### Learning Objectives

- 4.1.1 Recognize a function of two variables and identify its domain and range.
- 4.1.2 Sketch a graph of a function of two variables.
- 4.1.3 Sketch several traces or level curves of a function of two variables.
- 4.1.4 Recognize a function of three or more variables and identify its level surfaces.

Our first step is to explain what a function of more than one variable is, starting with functions of two independent variables. This step includes identifying the domain and range of such functions and learning how to graph them. We also examine ways to relate the graphs of functions in three dimensions to graphs of more familiar planar functions.

### Functions of Two Variables

The definition of a function of two variables is very similar to the definition for a function of one variable. The main difference is that, instead of mapping values of one variable to values of another variable, we map ordered pairs of variables to another variable.

### Definition

A function of two variables $z=f\left(x,y\right)$ maps each ordered pair $\left(x,y\right)$ in a subset $D$ of the real plane ${\mathbb{R}}^{2}$ to a unique real number $z.$ The set $D$ is called the *domain* of the function. The *range* of $f$ is the set of all real numbers $z$ that has at least one ordered pair $\left(x,y\right)\in D$ such that $f\left(x,y\right)=z$ as shown in the following figure.

Determining the domain of a function of two variables involves taking into account any domain restrictions that may exist. Let’s take a look.

### Example 4.1

#### Domains and Ranges for Functions of Two Variables

Find the domain and range of each of the following functions:

- $f\left(x,y\right)=3x+5y+2$
- $g\left(x,y\right)=\sqrt{9-{x}^{2}-{y}^{2}}$

#### Solution

- This is an example of a linear function in two variables. There are no values or combinations of $x$ and $y$ that cause $f\left(x,y\right)$ to be undefined, so the domain of $f$ is ${\mathbb{R}}^{2}.$ To determine the range, first pick a value for $z.$ We need to find a solution to the equation $f\left(x,y\right)=z,$ or $3x+5y+2=z.$ One such solution can be obtained by first setting $y=0,$ which yields the equation $3x+2=z.$ The solution to this equation is $x=\frac{z-2}{3},$ which gives the ordered pair $\left(\frac{z-2}{3},0\right)$ as a solution to the equation $f\left(x,y\right)=z$ for any value of $z.$ Therefore, the range of the function is all real numbers, or $\mathbb{R}.$
- For the function $g\left(x,y\right)$ to have a real value, the quantity under the square root must be nonnegative:

$$9-{x}^{2}-{y}^{2}\ge 0.$$

This inequality can be written in the form

$${x}^{2}+{y}^{2}\le 9.$$

Therefore, the domain of $g\left(x,y\right)$ is $\left\{\left(x,y\right)\in {\mathbb{R}}^{2}|{x}^{2}+{y}^{2}\le 9\right\}.$ The graph of this set of points can be described as a disk of radius $3$ centered at the origin. The domain includes the boundary circle as shown in the following graph.

To determine the range of $g\left(x,y\right)=\sqrt{9-{x}^{2}-{y}^{2}}$ we start with a point $\left({x}_{0},{y}_{0}\right)$ on the boundary of the domain, which is defined by the relation ${x}^{2}+{y}^{2}=9.$ It follows that ${x}_{0}^{2}+{y}_{0}^{2}=9$ and

$$g\left({x}_{0},{y}_{0}\right)=\sqrt{9-{x}_{0}^{2}-{y}_{0}^{2}}=\sqrt{9-\left({x}_{0}^{2}+{y}_{0}^{2}\right)}=\sqrt{9-9}=0.$$

If ${x}_{0}^{2}+{y}_{0}^{2}=0$ (in other words, ${x}_{0}={y}_{0}=0),$ then

$$g\left({x}_{0},{y}_{0}\right)=\sqrt{9-{x}_{0}^{2}-{y}_{0}^{2}}=\sqrt{9-\left({x}_{0}^{2}+{y}_{0}^{2}\right)}=\sqrt{9-0}=3.$$

This is the maximum value of the function. Given any value*c*between $0\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}3,$ we can find an entire set of points inside the domain of $g$ such that $g\left(x,y\right)=c\text{:}$

$$\begin{array}{ccc}\hfill \sqrt{9-{x}^{2}-{y}^{2}}& =\hfill & c\hfill \\ \hfill 9-{x}^{2}-{y}^{2}& =\hfill & {c}^{2}\hfill \\ \hfill {x}^{2}+{y}^{2}& =\hfill & 9-{c}^{2}.\hfill \end{array}$$

Since $9-{c}^{2}>0,$ this describes a circle of radius $\sqrt{9-{c}^{2}}$ centered at the origin. Any point on this circle satisfies the equation $g\left(x,y\right)=c.$ Therefore, the range of this function can be written in interval notation as $\left[0,3\right].$

### Checkpoint 4.1

Find the domain and range of the function $f\left(x,y\right)=\sqrt{36-9{x}^{2}-9{y}^{2}}.$

### Graphing Functions of Two Variables

Suppose we wish to graph the function $z=\left(x,y\right).$ This function has two independent variables $\left(x\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}y\right)$ and one dependent variable $\left(z\right).$ When graphing a function $y=f\left(x\right)$ of one variable, we use the Cartesian plane. We are able to graph any ordered pair $\left(x,y\right)$ in the plane, and every point in the plane has an ordered pair $\left(x,y\right)$ associated with it. With a function of two variables, each ordered pair $\left(x,y\right)$ in the domain of the function is mapped to a real number $z.$ Therefore, the graph of the function $f$ consists of ordered triples $\left(x,y,z\right).$ The graph of a function $z=\left(x,y\right)$ of two variables is called a surface.

To understand more completely the concept of plotting a set of ordered triples to obtain a surface in three-dimensional space, imagine the $\left(x,y\right)$ coordinate system laying flat. Then, every point in the domain of the function $f$ has a unique $z\text{-value}$ associated with it. If $z$ is positive, then the graphed point is located above the $\mathit{\text{xy}}\text{-plane,}$ if $z$ is negative, then the graphed point is located below the $\mathit{\text{xy}}\text{-plane}.$ The set of all the graphed points becomes the two-dimensional surface that is the graph of the function $f.$

### Example 4.2

#### Graphing Functions of Two Variables

Create a graph of each of the following functions:

- $g\left(x,y\right)=\sqrt{9-{x}^{2}-{y}^{2}}$
- $f\left(x,y\right)={x}^{2}+{y}^{2}$

#### Solution

- In Example 4.1, we determined that the domain of $g\left(x,y\right)=\sqrt{9-{x}^{2}-{y}^{2}}$ is $\left\{\left(x,y\right)\in {\mathbb{R}}^{2}|{x}^{2}+{y}^{2}\le 9\right\}$ and the range is $\left\{z\in {\mathbb{R}}^{2}|0\le z\le 3\right\}.$ When ${x}^{2}+{y}^{2}=9$ we have $g\left(x,y\right)=0.$ Therefore any point on the circle of radius $3$ centered at the origin in the $x,y\text{-plane}$ maps to $z=0$ in ${\mathbb{R}}^{3}.$ If ${x}^{2}+{y}^{2}=8,$ then $g\left(x,y\right)=1,$ so any point on the circle of radius $2\sqrt{2}$ centered at the origin in the $x,y\text{-plane}$ maps to $z=1$ in ${\mathbb{R}}^{3}.$ As ${x}^{2}+{y}^{2}$ gets closer to zero, the value of
*z*approaches 3. When ${x}^{2}+{y}^{2}=0,$ then $g\left(x,y\right)=3.$ This is the origin in the $x,y\text{-plane}.$ If ${x}^{2}+{y}^{2}$ is equal to any other value between $0\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}9,$ then $g\left(x,y\right)$ equals some other constant between $0\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}3.$ The surface described by this function is a hemisphere centered at the origin with radius $3$ as shown in the following graph.

- This function also contains the expression ${x}^{2}+{y}^{2}.$ Setting this expression equal to various values starting at zero, we obtain circles of increasing radius. The minimum value of $f(x,y)={x}^{2}+{y}^{2}$ is zero (attained when $x=y=0.).$ When $x=0,$ the function becomes $z={y}^{2},$ and when $y=0,$ then the function becomes $z={x}^{2}.$ These are cross-sections of the graph, and are parabolas. Recall from Introduction to Vectors in Space that the name of the graph of $f(x,y)={x}^{2}+{y}^{2}$ is a
*paraboloid*. The graph of $f$ appears in the following graph.

### Example 4.3

#### Nuts and Bolts

A profit function for a hardware manufacturer is given by

where $x$ is the number of nuts sold per month (measured in thousands) and $y$ represents the number of bolts sold per month (measured in thousands). Profit is measured in thousands of dollars. Sketch a graph of this function.

#### Solution

This function is a polynomial function in two variables. The domain of $f$ consists of $\left(x,y\right)$ coordinate pairs that yield a nonnegative profit:

This is a disk of radius $4$ centered at $\left(3,2\right).$ A further restriction is that both $x\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}y$ must be nonnegative. When $x=3$ and $y=2,$ $f\left(x,y\right)=16.$ Note that it is possible for either value to be a noninteger; for example, it is possible to sell $2.5$ thousand nuts in a month. The domain, therefore, contains thousands of points, so we can consider all points within the disk. For any $z<16,$ we can solve the equation $f\left(x,y\right)=z\text{:}$

Since $z<16,$ we know that $16-z>0,$ so the previous equation describes a circle with radius $\sqrt{16-z}$ centered at the point $\left(3,2\right).$ Therefore. the range of $f\left(x,y\right)$ is $\left\{z\in \mathbb{R}|z\le 16\right\}.$ The graph of $f\left(x,y\right)$ is also a paraboloid, and this paraboloid points downward as shown.

### Level Curves

If hikers walk along rugged trails, they might use a topographical map that shows how steeply the trails change. A topographical map contains curved lines called *contour lines*. Each contour line corresponds to the points on the map that have equal elevation (Figure 4.7). A level curve of a function of two variables $f\left(x,y\right)$ is completely analogous to a contour line on a topographical map.

### Definition

Given a function $f\left(x,y\right)$ and a number $c$ in the range of $f,\phantom{\rule{0.2em}{0ex}}\text{a}$ level curve of a function of two variables for the value $c$ is defined to be the set of points satisfying the equation $f\left(x,y\right)=c.$

Returning to the function $g\left(x,y\right)=\sqrt{9-{x}^{2}-{y}^{2}},$ we can determine the level curves of this function. The range of $g$ is the closed interval $\left[0,3\right].$ First, we choose any number in this closed interval—say, $c=2.$ The level curve corresponding to $c=2$ is described by the equation

To simplify, square both sides of this equation:

Now, multiply both sides of the equation by $\mathrm{-1}$ and add $9$ to each side:

This equation describes a circle centered at the origin with radius $\sqrt{5}.$ Using values of $c$ between $0\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}3$ yields other circles also centered at the origin. If $c=3,$ then the circle has radius $0,$ so it consists solely of the origin. Figure 4.8 is a graph of the level curves of this function corresponding to $c=0,1,2,\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}3.$ Note that in the previous derivation it may be possible that we introduced extra solutions by squaring both sides. This is not the case here because the range of the square root function is nonnegative.

A graph of the various level curves of a function is called a contour map.

### Example 4.4

#### Making a Contour Map

Given the function $f\left(x,y\right)=\sqrt{8+8x-4y-4{x}^{2}-{y}^{2}},$ find the level curve corresponding to $c=0.$ Then create a contour map for this function. What are the domain and range of $f?$

#### Solution

To find the level curve for $c=0,$ we set $f\left(x,y\right)=0$ and solve. This gives

We then square both sides and multiply both sides of the equation by $\mathrm{-1}\text{:}$

Now, we rearrange the terms, putting the $x$ terms together and the $y$ terms together, and add $8$ to each side:

Next, we group the pairs of terms containing the same variable in parentheses, and factor $4$ from the first pair:

Then we complete the square in each pair of parentheses and add the correct value to the right-hand side:

Next, we factor the left-hand side and simplify the right-hand side:

Last, we divide both sides by $16\text{:}$

This equation describes an ellipse centered at $\left(1,\mathrm{-2}\right).$ The graph of this ellipse appears in the following graph.

We can repeat the same derivation for values of $c$ less than $4.$ Then, Equation 4.1 becomes

for an arbitrary value of $c.$ Figure 4.10 shows a contour map for $f\left(x,y\right)$ using the values $c=0,1,2,\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}3.$ When $c=4,$ the level curve is the point $\left(\mathrm{-1},2\right).$

### Checkpoint 4.2

Find and graph the level curve of the function $g\left(x,y\right)={x}^{2}+{y}^{2}-6x+2y$ corresponding to $c=15.$

Another useful tool for understanding the graph of a function of two variables is called a vertical trace. Level curves are always graphed in the $xy\text{-plane,}$ but as their name implies, vertical traces are graphed in the $xz$- or $yz\text{-planes.}$

### Definition

Consider a function $z=f\left(x,y\right)$ with domain $D\subseteq {\mathbb{R}}^{2}.$ A vertical trace of the function can be either the set of points that solves the equation $f\left(a,y\right)=z$ for a given constant $x=a$ or $f\left(x,b\right)=z$ for a given constant $y=b.$

### Example 4.5

#### Finding Vertical Traces

Find vertical traces for the function $f\left(x,y\right)=\text{sin}\phantom{\rule{0.2em}{0ex}}x\phantom{\rule{0.2em}{0ex}}\text{cos}\phantom{\rule{0.2em}{0ex}}y$ corresponding to $x=-\frac{\pi}{4},0,\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}\frac{\pi}{4},$ and $y=-\frac{\pi}{4},0,\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}\frac{\pi}{4}.$

#### Solution

First set $x=-\frac{\pi}{4}$ in the equation $z=\text{sin}\phantom{\rule{0.2em}{0ex}}x\phantom{\rule{0.2em}{0ex}}\text{cos}\phantom{\rule{0.2em}{0ex}}y\text{:}$

This describes a cosine graph in the plane $x=-\frac{\pi}{4}.$ The other values of $z$ appear in the following table.

$c$ | Vertical Trace for $x=c$ |
---|---|

$-\frac{\pi}{4}$ | $z=-\frac{\sqrt{2}\phantom{\rule{0.2em}{0ex}}\text{cos}\phantom{\rule{0.2em}{0ex}}y}{2}$ |

$0$ | $z=0$ |

$\frac{\pi}{4}$ | $z=\frac{\sqrt{2}\phantom{\rule{0.2em}{0ex}}\text{cos}\phantom{\rule{0.2em}{0ex}}y}{2}$ |

In a similar fashion, we can substitute the $y\text{-values}$ in the equation $f(x,y)$ to obtain the traces in the $yz\text{-plane,}$ as listed in the following table.

$d$ | Vertical Trace for $y=d$ |
---|---|

$-\frac{\pi}{4}$ | $z=\frac{\sqrt{2}\phantom{\rule{0.2em}{0ex}}\text{sin}\phantom{\rule{0.2em}{0ex}}x}{2}$ |

$0$ | $z=\text{sin}\phantom{\rule{0.2em}{0ex}}x$ |

$\frac{\pi}{4}$ | $z=\frac{\sqrt{2}\phantom{\rule{0.2em}{0ex}}\text{sin}\phantom{\rule{0.2em}{0ex}}x}{2}$ |

The three traces in the $xz\text{-plane}$ are cosine functions; the three traces in the $yz\text{-plane}$ are sine functions. These curves appear in the intersections of the surface with the planes $x=-\frac{\pi}{4},x=0,x=\frac{\pi}{4}$ and $y=-\frac{\pi}{4},y=0,y=\frac{\pi}{4}$ as shown in the following figure.

### Checkpoint 4.3

Determine the equation of the vertical trace of the function $g\left(x,y\right)=\text{\u2212}{x}^{2}-{y}^{2}+2x+4y-1$ corresponding to $y=3,$ and describe its graph.

Functions of two variables can produce some striking-looking surfaces. The following figure shows two examples.

### Functions of More Than Two Variables

So far, we have examined only functions of two variables. However, it is useful to take a brief look at functions of more than two variables. Two such examples are

and

In the first function, $\left(x,y,z\right)$ represents a point in space, and the function $f$ maps each point in space to a fourth quantity, such as temperature or wind speed. In the second function, $\left(x,y\right)$ can represent a point in the plane, and $t$ can represent time. The function might map a point in the plane to a third quantity (for example, pressure) at a given time $t.$ The method for finding the domain of a function of more than two variables is analogous to the method for functions of one or two variables.

### Example 4.6

#### Domains for Functions of Three Variables

Find the domain of each of the following functions:

- $f\left(x,y,z\right)=\frac{3x-4y+2z}{\sqrt{9-{x}^{2}-{y}^{2}-{z}^{2}}}$
- $g\left(x,y,t\right)=\frac{\sqrt{2t-4}}{{x}^{2}-{y}^{2}}$

#### Solution

- For the function $f\left(x,y,z\right)=\frac{3x-4y+2z}{\sqrt{9-{x}^{2}-{y}^{2}-{z}^{2}}}$ to be defined (and be a real value), two conditions must hold:
- The denominator cannot be zero.
- The radicand cannot be negative.

$$9-{x}^{2}-{y}^{2}-{z}^{2}>0.$$

Moving the variables to the other side and reversing the inequality gives the domain as

$$\text{domain}\left(f\right)=\left\{\left(x,y,z\right)\in {\mathbb{R}}^{3}|{x}^{2}+{y}^{2}+{z}^{2}<9\right\},$$

which describes a ball of radius $3$ centered at the origin. (*Note*: The surface of the ball is not included in this domain.) - For the function $g\left(x,y,t\right)=\frac{\sqrt{2t-4}}{{x}^{2}-{y}^{2}}$ to be defined (and be a real value), two conditions must hold:
- The radicand cannot be negative.
- The denominator cannot be zero.

$$\text{domain}\left(g\right)=\{\left(x,y,t\right)|y\ne \text{\xb1}x,t\ge 2\}.$$

### Checkpoint 4.4

Find the domain of the function $h\left(x,y,t\right)=\left(3t-6\right)\sqrt{y-4{x}^{2}+4}.$

Functions of two variables have level curves, which are shown as curves in the $xy\text{-plane.}$ However, when the function has three variables, the curves become surfaces, so we can define level surfaces for functions of three variables.

### Definition

Given a function $f\left(x,y,z\right)$ and a number $c$ in the range of $f,$ a level surface of a function of three variables is defined to be the set of points satisfying the equation $f\left(x,y,z\right)=c.$

### Example 4.7

#### Finding a Level Surface

Find the level surface for the function $f\left(x,y,z\right)=4{x}^{2}+9{y}^{2}-{z}^{2}$ corresponding to $c=1.$

#### Solution

The level surface is defined by the equation $4{x}^{2}+9{y}^{2}-{z}^{2}=1.$ This equation describes a hyperboloid of one sheet as shown in the following figure.

### Checkpoint 4.5

Find the equation of the level surface of the function

corresponding to $c=2,$ and describe the surface, if possible.

### Section 4.1 Exercises

For the following exercises, evaluate each function at the indicated values.

$W(x,y)=4{x}^{2}+{y}^{2}.$ Find $W(2+h,3+h).$

The volume of a right circular cylinder is calculated by a function of two variables, $V(x,y)=\pi {x}^{2}y,$ where $x$ is the radius of the right circular cylinder and $y$ represents the height of the cylinder. Evaluate $V(2,5)$ and explain what this means.

An oxygen tank is constructed of a right cylinder of height $y$ and radius $x$ with two hemispheres of radius $x$ mounted on the top and bottom of the cylinder. Express the volume of the tank as a function of two variables, $x\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}y,$ find $V(10,2),$ and explain what this means.

For the following exercises, find the domain of the function.

$f(x,y)=\sqrt{{x}^{2}+{y}^{2}-4}$

$g(x,y)=\sqrt{16-4{x}^{2}-{y}^{2}}$

$f(x,y)=\frac{y+2}{{x}^{2}}$

Find the range of the functions.

$V(x,y)=4{x}^{2}+{y}^{2}$

For the following exercises, find the level curves of each function at the indicated value of $c$ to visualize the given function.

$z(x,y)={y}^{2}-{x}^{2},$ $c=1$

$g(x,y)={x}^{2}+{y}^{2};c=4,c=9$

$f(x,y)=xy;c=1;c=\mathrm{-1}$

$f(x,y)={x}^{2}-y;c=1,2$

$g(x,y)={x}^{3}-y;c=\mathrm{-1},0,2$

$f(x,y)={x}^{2};c=4,9$

$h(x,y)=\text{ln}({x}^{2}+{y}^{2});c=\mathrm{-1},0,1$

$z=f(x,y)=\sqrt{{x}^{2}+{y}^{2}},$ $c=3$

For the following exercises, find the vertical traces of the functions at the indicated values of $x$ and *y*, and plot the traces.

$z=4-x-y;x=2$

$z=\text{cos}\sqrt{{x}^{2}+{y}^{2}}$ $x=1$

Find the domain of the following functions.

$z=\text{ln}\left(x-{y}^{2}\right)$

$f(x,y,z)=\sqrt{49-{x}^{2}-{y}^{2}-{z}^{2}}$

$f(x,y)=\text{cos}\sqrt{{x}^{2}+{y}^{2}}$

For the following exercises, plot a graph of the function.

$z={x}^{2}+{y}^{2}$

Sketch the following by finding the level curves. Verify the graph using technology.

$f(x,y)=\sqrt{4-{x}^{2}-{y}^{2}}$

$z=1+{e}^{\text{\u2212}{x}^{2}-{y}^{2}}$

$z={y}^{2}-{x}^{2}$

Find the level surface for the functions of three variables and describe it.

$w(x,y,z)=x-2y+z,c=4$

$w(x,y,z)={x}^{2}+{y}^{2}-{z}^{2},c=\mathrm{-4}$

$w(x,y,z)=9{x}^{2}-4{y}^{2}+36{z}^{2},c=0$

For the following exercises, find an equation of the level curve of $f$ that contains the point $P.$

$g(x,y)={y}^{2}\text{arctan}\phantom{\rule{0.2em}{0ex}}x,P(1,2)$

The strength $E$ of an electric field at point $\left(x,y,z\right)$ resulting from an infinitely long charged wire lying along the $y\text{-axis}$ is given by $E(x,y,z)=k\text{/}\sqrt{{x}^{2}+{y}^{2}},$ where $k$ is a positive constant. For simplicity, let $k=1$ and find the equations of the level surfaces for $E=10\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}E=100.$

A thin plate made of iron is located in the $xy\text{-plane.}$ The temperature $T$ in degrees Celsius at a point $P\left(x,y\right)$ is inversely proportional to the square of its distance from the origin. Express $T$ as a function of $x\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}y.$

Refer to the preceding problem. Using the temperature function found there, determine the proportionality constant if the temperature at point $P\left(1,2\right)\phantom{\rule{0.2em}{0ex}}is\phantom{\rule{0.2em}{0ex}}50\text{\xb0}\text{C}.$ Use this constant to determine the temperature at point $Q\left(3,4\right).$

Refer to the preceding problem. Find the level curves for $T=40\text{\xb0}\text{C and}\phantom{\rule{0.2em}{0ex}}T=100\text{\xb0}\text{C},$ and describe what the level curves represent.