# 9.1: Functions of Several Variables and Three Dimensional Space

- Page ID
- 107854

- What is a function of several variables? What do we mean by the domain of a function of several variables?
- How do we find the distance between two points in \(\mathbb{R}^3\text{?}\) What is the equation of a sphere in \(\mathbb{R}^3\text{?}\)
- What is a trace of a function of two variables? What does a trace tell us about a function?
- What is a level curve of a function of two variables? What does a level curve tell us about a function?

Throughout our mathematical careers we have studied functions of a single variable. We define a function of one variable as a rule that assigns exactly one output to each input. We analyze these functions by looking at their graphs, calculating limits, differentiating, integrating, and more. Functions of several variables will be the main focus of Chapters 10 and 11, where we will analyze these functions by looking at their graphs, calculating limits, differentiating, integrating, and more. We will see that many of the ideas from single variable calculus translate well to functions of several variables, but we will have to make some adjustments as well. In this chapter we introduce functions of several variables and then discuss some of the tools (vectors and vector-valued functions) that will help us understand and analyze functions of several variables.

Suppose you invest money in an account that pays 5% interest compounded continuously. If you invest \(P\) dollars in the account, the amount \(A\) of money in the account after \(t\) years is given by

\[ A = Pe^{0.05t}. \nonumber \]

The variables \(P\) and \(t\) are independent of each other, so using functional notation we write

- Find the amount of money in the account after 7 years if you originally invest 1000 dollars.
- Evaluate \(A(5000,8)\text{.}\) Explain in words what this calculation represents.
- Now consider only the situation where the amount invested is fixed at 1000 dollars. Calculate the amount of money in the account after \(t\) years as indicated in Table \(\PageIndex{1}\). Round payments to the nearest penny.
Table \(\PageIndex{1}\). Amount of money in an account with an initial investment of 1000 dollars.

Duration (in years) 2 3 4 5 6 Amount (dollars) - Now consider the situation where we want to know the amount of money in the account after 10 years given various initial investments. Calculate the amount of money in the account as indicated in Table \(\PageIndex{2}\). Round payments to the nearest penny.
Table \(\PageIndex{2}\). Amount of money in an account after 10 years.

Initial investment (dollars) 500 1000 5000 7500 10000 Amount (dollars) - Describe as best you can the combinations of initial investments and time that result in an account containing $10,000.

## Functions of Several Variables

Up to this point we have been concerned with functions of a single variable. What defined such a function is that every input in the domain produced a unique output in the range. We saw similar behavior in Preview Activity \(\PageIndex{1}\), where each pair \((P,t)\) of inputs produces a unique output \(A(P,t)\text{.}\) Additionally, the two variables \(P\) and \(t\) had no real relation to each other. That is, we could choose any value of \(P\) without considering what value \(t\) might have, and we could select any value of \(t\) to use without regard to what value \(P\) might have. For that reason we say that the variables \(t\) and \(P\) are *independent* of each other. Thus, we call \(A = A(P,t)\) a function of the two independent variables \(P\) and \(t\text{.}\) This is the key idea in defining a function of two independent variables.

A **function** \(f\) **of two independent variables** is a rule that assigns to each ordered pair \((x,y)\) in some set \(D\) exactly one real number \(f(x,y)\text{.}\)

There is, of course, no reason to restrict ourselves to functions of only two variables—we can use any number of variables we like. For example,

defines \(f\) as a function of the three variables \(x\text{,}\) \(y\text{,}\) and \(z\text{.}\) In general, a function of \(n\) independent variables is a rule that assigns to an ordered \(n\)-tuple \((x_1, x_2, \ldots, x_n)\) in some set \(D\) exactly one real number.

As with functions of a single variable, it is important to understand the set of inputs for which the function is defined.

The **domain** of a function \(f\) is the set of all inputs at which the function is defined.

Identify the domain of each of the following functions. Draw a picture of each domain in the \(xy\)-plane.

- \(\displaystyle f(x,y) = x^2+y^2\)
- \(\displaystyle f(x,y) = \sqrt{x^2+y^2}\)
- \(\displaystyle Q(x,y) = \frac{x+y}{x^2-y^2}\)
- \(\displaystyle s(x,y) = \frac{1}{\sqrt{1-xy^2}}\)

## Representing Functions of Two Variables

One of the techniques we use to study functions of one variable is to create a table of values. We can do the same for functions of two variables, except that our tables will have to allow us to keep track of both input variables. We can do this with a 2-dimensional table, where we list the \(x\)-values down the first column and the \(y\)-values across the first row. As an example, suppose we launch a projectile, using a golf club, a cannon, or some other device, from ground level. Under ideal conditions (ignoring wind resistance, spin, or any other forces except the force of gravity) the horizontal distance the object will travel depends on the initial velocity \(x\) the object is given, and the angle \(y\) at which it is launched. If we let \(f\) represent the horizontal distance the object travels, then \(f\) is a function of the two variables \(x\) and \(y\text{,}\) and we represent \(f\) in functional notation by

where \(g\) is the acceleration due to gravity. (Note that \(g\) is constant, 32 feet per second squared. We will derive this equation in a later section.) To create a table of values for \(f\text{,}\) we list the \(x\)-values down the first column and the \(y\)-values across the first row. The value \(f(x,y)\) is then displayed in the location where the \(x\) row intersects the \(y\) column, as shown in Table \(\PageIndex{3}\) (where we measure \(x\) in feet per second and \(y\) in radians).

\(x\backslash y\) | \(0.2\) | \(0.4\) | \(0.6\) | \(0.8\) | \(1.0\) | \(1.2\) | \(1.4\) |
---|---|---|---|---|---|---|---|

25 | 7.6 | 14.0 | 18.2 | 19.5 | 17.8 | 13.2 | 6.5 |

50 | 30.4 | 56.0 | 72.8 | 78.1 | 71.0 | 26.2 | |

75 | 68.4 | 163.8 | 175.7 | 159.8 | 118.7 | 58.9 | |

100 | 121.7 | 224.2 | 291.3 | 312.4 | 284.2 | 211.1 | 104.7 |

125 | 190.1 | 350.3 | 455.1 | 444.0 | 329.8 | 163.6 | |

150 | 273.8 | 504.4 | 655.3 | 702.8 | 639.3 | 474.9 | 235.5 |

175 | 372.7 | 686.5 | 892.0 | 956.6 | 870.2 | 646.4 | |

200 | 486.8 | 896.7 | 1165.0 | 1249.5 | 1136.6 | 844.3 | 418.7 |

225 | 616.2 | 1134.9 | 1474.5 | 1581.4 | 1438.5 | 1068.6 | 530.0 |

250 | 760.6 | 1401.1 | 1952.3 | 1776.0 | 1319.3 | 654.3 |

Complete Table \(\PageIndex{3}\) by filling in the missing values of the function \(f\text{.}\) Round entries to the nearest tenth.

If \(f\) is a function of a single variable \(x\text{,}\) then we define the graph of \(f\) to be the set of points of the form \((x,f(x))\text{,}\) where \(x\) is in the domain of \(f\text{.}\) We then plot these points using the coordinate axes in order to visualize the graph. We can do a similar thing with functions of several variables. Table \(\PageIndex{5}\) identifies points of the form \((x,y,f(x,y))\text{,}\) and we define the graph of \(f\) to be the set of these points.

The **graph** of a function \(f = f(x,y)\) is the set of points of the form \((x,y,f(x,y))\text{,}\) where the point \((x,y)\) is in the domain of \(f\text{.}\)

We also often refer to the graph of a function \(f\) of two variables as the *surface* generated by \(f\text{.}\) Points in the form \((x,\, y,\, f(x,y))\) are in three dimensions, so plotting these points takes a bit more work than graphs of functions in two dimensions. To plot these three-dimensional points, we need to set up a coordinate system with three mutually perpendicular axes — the \(x\)-axis, the \(y\)-axis, and the \(z\)-axis (called the *coordinate axes*). There are essentially two different ways we could set up a 3D coordinate system, as shown in Figure \(\PageIndex{1}\); thus, before we can proceed, we need to establish a convention.

The distinction between these two figures is subtle, but important. In the coordinate system shown at left in Figure \(\PageIndex{7}\), imagine that you are sitting on the positive \(z\)-axis next to the label “\(z\text{.}\)” Looking down at the \(x\)- and \(y\)-axes, you see that the \(y\)-axis is obtained by rotating the \(x\)-axis by 90\(^\circ\) in the *clockwise* direction. Again sitting on the positive \(z\)-axis in the coordinate system at right in Figure \(\PageIndex{7}\), you see that the \(y\)-axis is obtained by rotating the \(x\)-axis by 90\(^\circ\) in the *counterclockwise* direction.

We call the coordinate system at right in Figure \(\PageIndex{7}\) a *right-hand system*; if we point the index finger of our *right* hand along the positive \(x\)-axis and our middle finger along the positive \(y\)-axis, then our thumb points in the direction of the positive \(z\)-axis. Following mathematical conventions, we choose to use a right-hand system throughout this book.

Now that we have established a convention for a right-hand system, we can draw a graph of the distance function defined by \(f(x,y) = \frac{x^2 \sin(2y)}{g}\text{.}\) Note that the function \(f\) is continuous in both variables, so when we plot these points in the right hand coordinate system, we can connect them all to form a surface in 3-space. The graph of the distance function \(f\) is shown in Figure \(\PageIndex{2}\).

There are many graphing tools available for drawing three-dimensional surfaces as indicated in the Preface (see Links to interactive graphics in Features of the Text). Since we will be able to visualize graphs of functions of two independent variables, but not functions of more than two variables, we will primarily deal with functions of two variables in this text. It is important to note, however, that the techniques we develop apply to functions of any number of variables.

*Notation:* We let \(\mathbb{R}^2\) denote the set of all ordered pairs of real numbers in the plane (two copies of the real number system) and let \(\mathbb{R}^3\) represent the set of all ordered triples of real numbers (which constitutes three-space).

## Some Standard Equations in Three-Space

In addition to graphing functions, we will also want to understand graphs of some simple equations in three dimensions. For example, in \(\mathbb{R}^2\text{,}\) the graphs of the equations \(x=a\) and \(y=b\text{,}\) where \(a\) and \(b\) are constants, are lines parallel to the coordinate axes. In the next activity we consider their three-dimensional analogs.

- Consider the set of points \((x,y,z)\) that satisfy the equation \(x=2\text{.}\) Describe this set as best you can.
- Consider the set of points \((x,y,z)\) that satisfy the equation \(y=-1\text{.}\) Describe this set as best you can.
- Consider the set of points \((x,y,z)\) that satisfy the equation \(z=0\text{.}\) Describe this set as best you can.

Activity \(\PageIndex{4}\) shows that the equations where one independent variable is constant lead to planes parallel to ones that result from a pair of the coordinate axes. When we make the constant 0, we get the *coordinate planes*. The \(xy\)-plane satisfies \(z=0\text{,}\) the \(xz\)-plane satisfies \(y=0\text{,}\) and the \(yz\)-plane satisfies \(x=0\) (see Figure \(\PageIndex{3}\)).

On a related note, we define a circle in \(\mathbb{R}^2\) as the set of all points equidistant from a fixed point. In \(\mathbb{R}^3\text{,}\) we call the set of all points equidistant from a fixed point a *sphere*. To find the equation of a sphere, we need to understand how to calculate the distance between two points in three-space, and we explore this idea in the next activity.

Let \(P=(x_0, y_0, z_0)\) and \(Q=(x_1, y_1, z_1)\) be two points in \(\mathbb{R}^3\text{.}\) These two points form opposite vertices of a rectangular box whose sides are planes parallel to the coordinate planes as illustrated in Figure \(\PageIndex{1}\)0, and the distance between \(P\) and \(Q\) is the length of the blue diagonal shown in Figure \(\PageIndex{4}\).

- Consider the right triangle \(PRS\) in the base of the box whose hypotenuse is shown as the red line in Figure \(\PageIndex{1}\)0. What are the coordinates of the vertices of this triangle? Since this right triangle lies in a plane, we can use the Pythagorean Theorem to find a formula for the length of the hypotenuse of this triangle. Find such a formula, which will be in terms of \(x_0\text{,}\) \(y_0\text{,}\) \(x_1\text{,}\) and \(y_1\text{.}\)
- Now notice that the triangle \(PRQ\) whose hypotenuse is the blue segment connecting the points \(P\) and \(Q\) with a leg as the hypotenuse \(PR\) of the triangle found in part (a) lies entirely in a plane, so we can again use the Pythagorean Theorem to find the length of its hypotenuse. Explain why the length of this hypotenuse, which is the distance between the points \(P\) and \(Q\text{,}\) is
\[ \sqrt{(x_1-x_0)^2 + (y_1-y_0)^2 + (z_1-z_0)^2}. \nonumber \]

The formula developed in Activity \(\PageIndex{5}\) is important to remember.

The distance between points \(P=(x_0, y_0, z_0)\) and \(Q=(x_1, y_1, z_1)\) (denoted as \(|PQ|\)) in \(\mathbb{R}^3\) is given by the formula

\[ |PQ| = \sqrt{(x_1-x_0)^2 + (y_1-y_0)^2 + (z_1-z_0)^2}.\label{eq-9-1-Distance-3D}\tag{\(\PageIndex{1}\)} \]

Equation (\(\PageIndex{1}\)) can be used to derive the formula for a sphere centered at a point \((x_0,y_0,z_0)\) with radius \(r\text{.}\) Since the distance from any point \((x,y,z)\) on such a sphere to the point \((x_0,y_0,z_0)\) is \(r\text{,}\) the point \((x,y,z)\) will satisfy the equation

Squaring both sides, we come to the standard equation for a sphere.

The equation of a sphere with center \((x_0,y_0,z_0)\) and radius \(r\) is

\[ (x-x_0)^2 + (y-y_0)^2 + (z-z_0)^2 = r^2. \nonumber \]

This makes sense if we compare this equation to its two-dimensional analogue, the equation of a circle of radius \(r\) in the plane centered at \((x_0,y_0)\text{:}\)

## Traces

When we study functions of several variables we are often interested in how each individual variable affects the function in and of itself. In Preview Activity \(\PageIndex{1}\), we saw that the amount of money in an account depends on the amount initially invested and the duration of the investment. However, if we fix the initial investment, the amount of money in the account depends only on the duration of the investment, and if we set the duration of the investment constant, then the amount of money in the account depends only on the initial investment. This idea of keeping one variable constant while we allow the other to change will be an important tool for us when studying functions of several variables.

As another example, consider again the distance function \(f\) defined by

where \(x\) is the initial velocity of an object in feet per second, \(y\) is the launch angle in radians, and \(g\) is the acceleration due to gravity (32 feet per second squared). If we hold the launch angle constant at \(y=0.6\) radians, we can consider \(f\) a function of the initial velocity alone. In this case we have

We can plot this curve on the surface by tracing out the points on the surface when \(y = 0.6\text{,}\) as shown at left in Figure \(\PageIndex{1}\)1. The formula clearly shows that \(f\) is quadratic in the \(x\)-direction. More descriptively, as we increase the launch velocity while keeping the launch angle constant, the horizontal distance the object travels increases proportional to the square of the initial velocity.

Similarly, if we fix the initial velocity at 150 feet per second, we can consider the distance as a function of the launch angle only. In this case we have

We can again plot this curve on the surface by tracing out the points on the surface when \(x=150\text{,}\) as shown at right in Figure \(\PageIndex{5}\). The formula clearly show that \(f\) is sinusoidal in the \(y\)-direction. More descriptively, as we increase the launch angle while keeping the initial velocity constant, the horizontal distance traveled by the object is proportional to the sine of twice the launch angle.

The curves we define when we fix one of the independent variables in our two variable function are called *traces*.

A **trace** of a function \(f\) of two independent variables \(x\) and \(y\) in the \(x\) direction is a curve of the form \(z = f(x,c)\text{,}\) where \(c\) is a constant. Similarly, a ** trace** of a function \(f\) of two independent variables \(x\) and \(y\) in the \(y\) direction is a curve of the form \(z = f(c,y)\text{,}\) where \(c\) is a constant.

Understanding trends in the behavior of functions of two variables can be challenging, as can sketching their graphs; traces help us with each of these tasks.

In the following questions, we investigate the use of traces to better understand a function through both tables and graphs.

a. Identify the \(y = 0.6\) trace for the distance function \(f\) defined by \(f(x,y) = \frac{x^2 \sin(2y)}{g}\) by highlighting or circling the appropriate cells in Table \(\PageIndex{3}\). Write a sentence to describe the behavior of the function along this trace.

b. Identify the \(x = 150\) trace for the distance function by highlighting or circling the appropriate cells in Table \(\PageIndex{3}\). Write a sentence to describe the behavior of the function along this trace.

c. For the function \(g\) defined by \(g(x,y) = x^2 + y^2 + 1\text{,}\) explain the type of function that each trace in the \(x\) direction will be (keeping \(y\) constant). Plot the \(y=-4\text{,}\) \(y=-2\text{,}\) \(y=0\text{,}\) \(y=2\text{,}\) and \(y=4\) traces in 3-dimensional coordinate system provided in Figure \(\PageIndex{1}\)3.

d. For the function \(g\) defined by \(g(x,y) = x^2 + y^2 + 1\text{,}\) explain the type of function that each trace in the \(y\) direction will be (keeping \(x\) constant). Plot the \(x=-4\text{,}\) \(x=-2\text{,}\) \(x=0\text{,}\) \(x=2\text{,}\) and \(x=4\) traces in 3-dimensional coordinate system in Figure \(\PageIndex{6}\).

e. Describe the surface generated by the function \(g\text{.}\)

## Contour Maps and Level Curves

We have all seen topographic maps such as the one of the Porcupine Mountains in the upper peninsula of Michigan shown in Figure \(\PageIndex{7}\).^{ 1 } The curves on these maps show the regions of constant altitude. The contours also depict changes in altitude: contours that are close together signify steep ascents or descents, while contours that are far apart indicate only slight changes in elevation. Thus, contour maps tell us a lot about three-dimensional surfaces. Mathematically, if \(f(x,y)\) represents the altitude at the point \((x,y)\text{,}\) then each contour is the graph of an equation of the form \(f(x,y) = k\text{,}\) for some constant \(k\text{.}\)

On the topographical map of the Porcupine Mountains in Figure \(\PageIndex{7}\),

- identify the highest and lowest points you can find;
- from a point of your choice, determine a path of steepest ascent that leads to the highest point;
- from that same initial point, determine the least steep path that leads to the highest point.

Curves on a surface that describe points at the same height or level are called *level curves*.

A **level curve (or contour)** of a function \(f\) of two independent variables \(x\) and \(y\) is a curve of the form \(k = f(x,y)\text{,}\) where \(k\) is a constant.

Topographical maps can be used to create a three-dimensional surface from the two-dimensional contours or level curves. For example, level curves of the distance function defined by \(f(x,y) = \frac{x^2 \sin(2y)}{32}\) plotted in the \(xy\)-plane are shown at left in Figure \(\PageIndex{8}\). If we lift these contours and plot them at their respective heights, then we get a picture of the surface itself, as illustrated at right in Figure \(\PageIndex{8}\).

The use of level curves and traces can help us construct the graph of a function of two variables.

- Let \(f(x,y) = x^2+y^2\text{.}\) Draw the level curves \(f(x,y) = k\) for \(k=1\text{,}\) \(k=2\text{,}\) \(k=3\text{,}\) and \(k=4\) on the left set of axes given in Figure \(\PageIndex{1}\)7. (You decide on the scale of the axes.) Explain what the surface defined by \(f\) looks like.
- Let \(g(x,y) = \sqrt{x^2+y^2}\text{.}\) Draw the level curves \(g(x,y) = k\) for \(k=1\text{,}\) \(k=2\text{,}\) \(k=3\text{,}\) and \(k=4\) on the right set of axes given in Figure \(\PageIndex{1}\)7. (You decide on the scale of the axes.) Explain what the surface defined by \(g\) looks like.
- Compare and contrast the graphs of \(f\) and \(g\text{.}\) How are they alike? How are they different? Use traces for each function to help answer these questions.

The traces and level curves of a function of two variables are curves in space. In order to understand these traces and level curves better, we will first spend some time learning about vectors and vector-valued functions in the next few sections and return to our study of functions of several variables once we have those more mathematical tools to support their study.

## A gallery of functions

We end this section by considering a collection of functions and illustrating their graphs and some level curves.

## Summary

- A function \(f\) of several variables is a rule that assigns a unique number to an ordered collection of independent inputs. The domain of a function of several variables is the set of all inputs for which the function is defined.
- In \(\mathbb{R}^3\text{,}\) the distance between points \(P=(x_0, y_0, z_0)\) and \(Q=(x_1, y_1, z_1)\) (denoted as \(|PQ|\)) is given by the formula
\[ |PQ| = \sqrt{(x_1-x_0)^2 + (y_1-y_0)^2 + (z_1-z_0)^2}. \nonumber \]
and thus the equation of a sphere with center \((x_0,y_0,z_0)\) and radius \(r\) is

\[ (x-x_0)^2 + (y-y_0)^2 + (z-z_0)^2 = r^2. \nonumber \] - A trace of a function \(f\) of two independent variables \(x\) and \(y\) is a curve of the form \(z = f(c,y)\) or \(z = f(x,c)\text{,}\) where \(c\) is a constant. A trace tells us how the function depends on a single independent variable if we treat the other independent variable as a constant.
- A level curve of a function \(f\) of two independent variables \(x\) and \(y\) is a curve of the form \(k = f(x,y)\text{,}\) where \(k\) is a constant. A level curve describes the set of inputs that lead to a specific output of the function.