# 6.1: Functions of Several Variables

- Last updated

- Save as PDF

- Page ID
- 17547

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

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: function of two variables

A *function of two variables *\(z=(x,y)\) maps each ordered pair \((x,y)\) in a subset \(D\) of the real plane \(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 \((x,y)∈D\) such that \(f(x,y)=z\) as shown in Figure \(\PageIndex{1}\).

**Figure \(\PageIndex{1}\):** The domain of a function of two variables consists of ordered pairs \((x,y)\).

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 \(\PageIndex{1}\): Domains and Ranges for Functions of Two Variables

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

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

**Solution**

a. This is an example of a linear function in two variables. There are no values or combinations of \(x\) and \(y\) that cause \(f(x,y)\) to be undefined, so the domain of \(f\) is \(R^2\). To determine the range, first pick a value for *z*. We need to find a solution to the equation \(f(x,y)=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=\dfrac{z−2}{3}\), which gives the ordered pair \((\dfrac{z−2}{3},0)\) as a solution to the equation \(f(x,y)=z\) for any value of \(z\). Therefore, the range of the function is all real numbers, or \(R\).

b. For the function \(g(x,y)\) to have a real value, the quantity under the square root must be nonnegative:

\[ 9−x^2−y^2≥0. \nonumber\]

This inequality can be written in the form

\[ x^2+y^2≤9. \nonumber\]

Therefore, the domain of \(g(x,y)\) is \(\{(x,y)∈R^2∣x^2+y^2≤9\}\). 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.

**Figure \(\PageIndex{2}\):** The domain of the function \(g(x,y)=\sqrt{9−x^2−y^2}\) is a closed disk of radius 3.

To determine the range of \(g(x,y)=\sqrt{9−x^2−y^2}\) we start with a point \((x_0,y_0)\) on the boundary of the domain, which is defined by the relation \(x^2+y^2=9\). It follows that \(x^2_0+y^2_0=9\) and

\[ \begin{align*} g(x_0,y_0) &=\sqrt{9−x^2_0−y^2_0} \\[5pt]&=\sqrt{9−(x^2_0+y^2_0)}\\[5pt]&=\sqrt{9−9}\\[5pt]&=0. \end{align*}\]

If \(x^2_0+y^2_0=0\) (in other words, \(x_0=y_0=0)\), then

\[ \begin{align*} g(x_0,y_0)&=\sqrt{9−x^2_0−y^2_0}\\[5pt]&=\sqrt{9−(x^2_0+y^2_0)}\\[5pt]&=\sqrt{9−0}=3. \end{align*}\]

This is the maximum value of the function. Given any value c between \(0\) and \(3\), we can find an entire set of points inside the domain of \(g\) such that \(g(x,y)=c:\)

\[\begin{align*} \sqrt{9−x^2−y^2}&=c \\[5pt] 9−x^2−y^2&=c^2 \\[5pt] x^2+y^2&=9−c^2. \end{align*}\]

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(x,y)=c\). Therefore, the range of this function can be written in interval notation as \([0,3].\)

Exercise \(\PageIndex{1}\)

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

**Hint**-
Determine the set of ordered pairs that do not make the radicand negative.

**Solution**-
The domain is \(\{(x, y) | x^2+y^2≤4 \}\) the shaded circle defined by the inequality \(x^2+y^2≤4\), which has a circle of radius \(2\) as its boundary. The range is \([0,6].\)

### Graphing Functions of Two Variables

Suppose we wish to graph the function \(z=(x,y).\) This function has two independent variables (\(x\) and \(y\)) and one dependent variable \((z)\). When graphing a function \(y=f(x)\) of one variable, we use the Cartesian plane. We are able to graph any ordered pair \((x,y)\) in the plane, and every point in the plane has an ordered pair \((x,y)\) associated with it. With a function of two variables, each ordered pair \((x,y)\) in the domain of the function is mapped to a real number \(z\). Therefore, the graph of the function \(f\) consists of ordered triples \((x,y,z)\). The graph of a function \(z=(x,y)\) 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 \((x,y)\) coordinate system laying flat. Then, every point in the domain of the function f has a unique *z*-value associated with it. If *z* is positive, then the graphed point is located above the *xy*-plane, if *z* is negative, then the graphed point is located below the *xy*-plane. The set of all the graphed points becomes the two-dimensional surface that is the graph of the function \(f\).

Example \(\PageIndex{2}\): Graphing Functions of Two Variables

Create a graph of each of the following functions:

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

**Solution**

a. In Example \(\PageIndex{2}\), we determined that the domain of \(g(x,y)=\sqrt{9−x^2−y^2}\) is \(\{(x,y)∈R^2∣x^2+y^2≤9\}\) and the range is \(\{z∈R^2∣0≤z≤3\}\). When \(x^2+y^2=9\) we have \(g(x,y)=0\). Therefore any point on the circle of radius \(3\) centered at the origin in the \(xy\)-plane maps to \(z=0\) in \(R^3\). If \(x^2+y^2=8\), then \(g(x,y)=1,\) so any point on the circle of radius \(2\sqrt{2}\) centered at the origin in the \(xy\)-plane maps to \(z=1\) in \(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(x,y)=3\). This is the origin in the \(xy\)-plane If \(x^2+y^2\) is equal to any other value between \(0\) and \(9\), then \(g(x,y)\) equals some other constant between \(0\) and \(3\). The surface described by this function is a hemisphere centered at the origin with radius \(3\) as shown in the following graph.

**Figure \(\PageIndex{3}\): **Graph of the hemisphere represented by the given function of two variables.

b. 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.

**Figure \(\PageIndex{4}\):** A paraboloid is the graph of the given function of two variables.

Click here to PLOT

Example \(\PageIndex{3}\): Nuts and Bolts

A profit function for a hardware manufacturer is given by

\[f(x,y)=16−(x−3)^2−(y−2)^2, \nonumber\]

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 \((x,y)\) coordinate pairs that yield a nonnegative profit:

\[ \begin{align*} 16−(x−3)^2−(y−2)^2 &≥ 0 \\[5pt] (x−3)^2+(y−2)^2 &≤ 16. \end{align*}\]

This is a disk of radius \(4\) centered at \((3,2)\). A further restriction is that both \(x\) and \(y\) must be nonnegative. When \(x=3\) and \(y=2, f(x,y)=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(x,y)=16:\)

\[ \begin{align*} 16−(x−3)^2−(y−2)^2 &=z \\[5pt] (x−3)^2+(y−2)^2 &=16−z. \end{align*}\]

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 \((3,2)\). Therefore. the range of \(f(x,y)\) is \(\{z∈\mathbb{R}|z≤16\}.\) The graph of \(f(x,y)\) is also a paraboloid, and this paraboloid points downward as shown.

**Figure \(\PageIndex{5}\): **The graph of the given function of two variables is also a paraboloid.

### 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 \(\PageIndex{6}\)). A level curve of a function of two variables \(f(x,y)\) is completely analogous to a contour line on a topographical map.

**Figure \(\PageIndex{6}\): **(a) A topographical map of Devil’s Tower, Wyoming. Lines that are close together indicate very steep terrain. (b) A perspective photo of Devil’s Tower shows just how steep its sides are. Notice the top of the tower has the same shape as the center of the topographical map.

Definition: level curves

Given a function \(f(x,y)\) and a number \(c\) in the range of \(f\), 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(x,y)=c.\)

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

\[ \sqrt{9−x^2−y^2}=2.\]

To simplify, square both sides of this equation:

\[ 9−x^2−y^2=4.\]

Now, multiply both sides of the equation by \(−1\) and add \(9\)to each side:

\[ x^2+y^2=5.\]

This equation describes a circle centered at the origin with radius \(\sqrt{5}\). Using values of c between \(0\) and \(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 \(\PageIndex{7}\) is a graph of the level curves of this function corresponding to \(c=0,1,2,\) and \(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.

**Figure \(\PageIndex{7}\):** Level curves of the function \(g(x,y)=\sqrt{9−x^2−y^2}\), using \(c=0,1,2,\) and \(3 (c=3\) corresponds to the origin).

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

Example \(\PageIndex{4}\): Making a Contour Map

Given the function \(f(x,y)=\sqrt{8+8x−4y−4x^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(x,y)=0\) and solve. This gives

\(0=\sqrt{8+8x−4y−4x^2−y^2}\).

We then square both sides and multiply both sides of the equation by \(−1\):

\(4x^2+y^2−8x+4y−8=0.\)

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

\(4x^2−8x+y^2+4y=8.\)

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

\(4(x^2−2x)+(y^2+4y)=8.\)

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

\(4(x^2−2x+1)+(y^2+4y+4)=8+4(1)+4.\)

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

\(4(x−1)^2+(y+2)^2=16.\)

Last, we divide both sides by \(16:\)

\(\dfrac{(x−1)^2}{4}+\dfrac{(y+2)^2}{16}=1.\)

This equation describes an ellipse centered at \((1,−2).\) The graph of this ellipse appears in the following graph.

**Figure \(\PageIndex{8}\): **Level curve of the function \(f(x,y)=\sqrt{8+8x−4y−4x^2−y^2}\) corresponding to \(c=0\)

We can repeat the same derivation for values of c less than \(4.\) Then, Equation becomes

\(\dfrac{4(x−1)^2}{16−c^2}+\dfrac{(y+2)^2}{16−c^2}=1\)

for an arbitrary value of \(c\). Figure \(\PageIndex{9}\) shows a contour map for \(f(x,y)\) using the values \(c=0,1,2,\) and \(3\). When \(c=4,\) the level curve is the point \((−1,2)\).

**Figure \(\PageIndex{9}\): **Contour map for the function \(f(x,y)=\sqrt{8+8x−4y−4x^2−y^2}\) using the values \(c=0,1,2,3,\) and \(4\).

Exercise \(\PageIndex{4}\)

Find and graph the level curve of the function \(g(x,y)=x^2+y^2−6x+2y\) corresponding to \(c=15.\)

**Hint**-
First, set \(g(x,y)=15\) and then complete the square.

**Solution**-
The equation of the level curve can be written as \((x−3)^2+(y+1)^2=25,\) which is a circle with radius \(5\) centered at \((3,−1).\)

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-plane\), but as their name implies, vertical traces are graphed in the \(xz-\) or \(yz-\) planes.

Definition: vertical traces

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

Example \(\PageIndex{5}\): Finding Vertical Traces

Find vertical traces for the function \(f(x,y)=\sin x \cos y\) corresponding to \(x=−\dfrac{π}{4},0,\) and \(\dfrac{π}{4}\), and \(y=−\dfrac{π}{4},0\), and \(\dfrac{π}{4}\).

**Solution**

First set \(x=−\dfrac{π}{4}\) in the equation \(z=\sin x \cos y:\)

\(z=\sin(−\dfrac{π}{4})\cos y=−\dfrac{\sqrt{2}\cos y}{2}≈−0.7071\cos y.\)

This describes a cosine graph in the plane \(x=−\dfrac{π}{4}\). The other values of *z* appear in the following table.

\(c\) | Vertical Trace for \(x=c\) |
---|---|

\(−\dfrac{π}{4}\) | \(z=−\dfrac{\sqrt{2}\cos y}{2}\) |

0 | \(z=0\) |

\(\dfrac{π}{4}\) | \(z=\dfrac{\sqrt{2}\cos y}{2}\) |

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

\(d\) | Vertical Trace for \(y=d\) |
---|---|

\(\dfrac{π}{4}\) | \(z=\dfrac{\sqrt{2}\sin x}{2}\) |

0 | \(z=\sin x\) |

\(−\dfrac{π}{4}\) | \(z=\dfrac{\sqrt{2}\sin x}{2}\) |

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

**Figure \(\PageIndex{10}\):** Vertical traces of the function \(f(x,y)\) are cosine curves in the \(xz-planes\) (a) and sine curves in the \(yz-planes\) (b).

Exercise \(\PageIndex{5}\)

Determine the equation of the vertical trace of the function \(g(x,y)=−x^2−y^2+2x+4y−1\) corresponding to \(y=3\), and describe its graph.

**Hint**-
Set \(y=3\) in the equation \(z=−x^2−y^2+2x+4y−1\) and complete the square.

**Solution**-
\(z=3−(x−1)^2\). This function describes a parabola opening downward in the plane \(y=3\).

Functions of two variables can produce some striking-looking surfaces. Figure \(\PageIndex{11}\) shows two examples.

**Figure \(\PageIndex{11}\): **Examples of surfaces representing functions of two variables: (a) a combination of a power function and a sine function and (b) a combination of trigonometric, exponential, and logarithmic functions.

### 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

\[ \underbrace{f(x,y,z)=x^2−2xy+y^2+3yz−z^2+4x−2y+3x−6}_{\text{a polynomial in three variables}}\]

and

\[g(x,y,t)=(x^2−4xy+y^2)\sin t−(3x+5y)\cos t.\]

In the first function, \((x,y,z)\) 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, \((x,y)\) 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 \(\PageIndex{6}\): Domains for Functions of Three Variables

Find the domain of each of the following functions:

- \(f(x,y,z)=\dfrac{3x−4y+2z}{\sqrt{9−x^2−y^2−z^2}}\)
- \(g(x,y,t)=\dfrac{\sqrt{2t−4}}{x^2−y^2}\)

**Solution**:

a. For the function \(f(x,y,z)=\dfrac{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.

Combining these conditions leads to the inequality

\[9−x^2−y^2−z^2>0.\nonumber\]

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

\[domain(f)=\{(x,y,z)∈R^3∣x^2+y^2+z^2<9\},\nonumber\]

which describes a ball of radius \(3\) centered at the origin. (Note: The surface of the ball is not included in this domain.)

b. For the function \(g(x,y,t)=\dfrac{\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.

Since the radicand cannot be negative, this implies \(2t−4≥0\), and therefore that \(t≥2\). Since the denominator cannot be zero, \(x^2−y^2≠0\), or \(x^2≠y^2\), Which can be rewritten as \(y=±x\), which are the equations of two lines passing through the origin. Therefore, the domain of \(g\) is

\[ domain(g)=\{(x,y,t)|y≠±x,t≥2\}. \nonumber\]

Exercise \(\PageIndex{6}\)

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

**Hint**-
Check for values that make radicands negative or denominators equal to zero.

**Solution**-
\[domain(h)=\{(x,y,t)\in \mathbb{R}^3∣y≥4x^2−4\} \nonumber\]

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

Definition: level surface of a function of three variables

Given a function \(f(x,y,z)\) 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(x,y,z)=c.\)

Example \(\PageIndex{7}\): Finding a Level Surface

Find the level surface for the function \(f(x,y,z)=4x^2+9y^2−z^2\) corresponding to \(c=1\).

**Solution**

The level surface is defined by the equation \(4x^2+9y^2−z^2=1.\) This equation describes a hyperboloid of one sheet as shown in Figure \(\PageIndex{12}\).

**Figure \(\PageIndex{12}\): **A hyperboloid of one sheet with some of its level surfaces.

Exercise \(\PageIndex{5}\)

Find the equation of the level surface of the function

\[ g(x,y,z)=x^2+y^2+z^2−2x+4y−6z \nonumber\]

corresponding to \(c=2,\) and describe the surface, if possible.

**Hint**-
Set \(g(x,y,z)=c\) and complete the square.

**Solution**-
((x−1)^2+(y+2)^2+(z−3)^2=16\) describes a sphere of radius \(4\) centered at the point \((1,−2,3).\)

### Summary

- The graph of a function of two variables is a surface in \(\mathbb{R}^3\) and can be studied using level curves and vertical traces.
- A set of level curves is called a contour map.

### Key Equations

**Vertical trace**

\(f(a,y)=z\) for \(x=a\) or \(f(x,b)=z\) for \(y=b\)

**Level surface of a function of three variables**

\(f(x,y,z)=c\)

### Glossary

**contour map**- a plot of the various level curves of a given function \(f(x,y)\)

**function of two variables**- a function \(z=f(x,y)\) that maps each ordered pair \((x,y)\) in a subset \(D\) of \(R^2\) to a unique real number \(z\)

**graph of a function of two variables**- a set of ordered triples \((x,y,z)\) that satisfies the equation \(z=f(x,y)\) plotted in three-dimensional Cartesian space

**level curve of a function of two variables**- the set of points satisfying the equation \(f(x,y)=c\) for some real number \(c\) in the range of \(f\)

**level surface of a function of three variables**- the set of points satisfying the equation \(f(x,y,z)=c\) for some real number \(c\) in the range of \(f\)

**surface**- the graph of a function of two variables, \(z=f(x,y)\)

**vertical trace**- the set of ordered triples \((c,y,z)\) that solves the equation \(f(c,y)=z\) for a given constant \(x=c\) or the set of ordered triples \((x,d,z)\) that solves the equation \(f(x,d)=z\) for a given constant \(y=d\)

### Contributors

Gilbert Strang (MIT) and Edwin “Jed” Herman (Harvey Mudd) with many contributing authors. This content by OpenStax is licensed with a CC-BY-SA-NC 4.0 license. Download for free at http://cnx.org.