Skip to main content

Section 14.1 Functions of Two or More Variables

In single-variable calculus, we primarily studied functions of the form \(y = f(x)\text{,}\) where a single input determines a single output. These functions map real numbers to real numbers and are visualized as curves in a two-dimensional plane.
In this section, we extend our calculus toolkit to multivariable functions. We will begin by defining functions of two variables, \(z = f(x,y)\text{,}\) which map pairs of numbers to a single real number and are visualized as surfaces in three-dimensional space.

Subsection Functions of Two Variables

Functions of two variables are defined similarly to functions of one variable, except that the input consists of two variables rather than a single number \(x\text{.}\) Using function notation, we write \(z = f(x,y)\text{,}\) where \(z\) is the output value corresponding to the inputs (\(x\) and \(y\)). Hence, \(x\) and \(y\) are the independent variables, and \(z\) is the dependent variable.
A classic example of a function of two variables to consider is the area function for rectangles. We need two inputs, the length and the width of the rectangle, to determine its area. Thus, we can define the area function \(A = f(x, y)\text{,}\) where the inputs, \(x\) and \(y\) are the length and width respectively, and the output \(A\) is the area of the rectangle.

Example 14.1.1.

Consider a rectangle with length \(x\) and width \(y\text{.}\) The perimeter \(P\) of the rectangle can be defined using the following function
\begin{equation*} P = f(x,y) = 2x + 2y \end{equation*}
Find the perimeter of a rectangle with length \(5\) and width \(3\text{.}\)
Hint.
The task itself isn’t difficult... Make sure you are using the correct function notation to format your work!
Solution.
\begin{align*} P \amp= f(5,3) = 2(5) + 2(3) = 10 + 6 = 16 \end{align*}
From the example, we see that we evaluate functions of two variables the same way we do functions of one variable, by substituting the input values into the function formula.
Now that we have a new function type, we need to consider its domain and range. Since there are two inputs to consider, one way to organize it is to use the input pair \((x,y)\text{.}\) That is, the domain of a function of two variables is the set of all possible input pairs \((x,y)\) for which the function is defined, and the range is the set of all possible output values.
Figure 14.1.2. Domain of \(f\) is a set of ordered pairs and range is a set of output values.
Now that the domain is an subset of \(\R^2\text{,}\) we can find it by determining the restrictions on the input variables \(x\) and \(y\) that make the function defined.
The range can be a bit trickier to find, as it often requires more analysis of the function itself.

Example 14.1.3.

Find the domain and the range of the function \(f(x,y) = \sqrt{\lp x^2 + 1 \rp y}\text{.}\)
Hint.
Remember that the domain should consist of all input pairs \((x,y)\) for which the function is defined, and the range is the set of all possible output values.
This is essentially a square root function, so we can determine the domain by focusing on the possible inputs of a square root function and determine the range by focusing on the possible outputs of a square root function.
Solution.
Because \(f\) involves a square root, its domain consists of ordered pairs \((x,y)\) such that the expression inside the square root is nonnegative. That is,
\begin{equation*} \lp x^2 + 1 \rp y \geq 0 \end{equation*}
Hence, the domain of \(f\) is \(\left\{(x,y) \mid \lp x^2 + 1 \rp y \geq 0 \right\}\text{.}\)
Furthermore, since \(x^2 + 1 \geq 0 \gt 1\text{,}\) then the sign of \(\lp x^2 + 1 \rp y\) depends solely on the sign of \(y\text{.}\) That is, the radicand is nonnegative when \(y \geq 0\text{.}\) Hence, the domain can be expressed as \(\left\{(x,y) \mid y \geq 0 \right\}\text{.}\)
Again, because \(f\) involves a square root, its range consists of all nonnegative real numbers. Thus, the range of \(f\) is \(\left\{ z \mid z \geq 0 \right\}\text{.}\)

Subsection Traces

Recall that traces is a good tool to analyze and visualize surfaces defined in \(\R^3\text{,}\) as seen in SectionΒ 12.6. A trace is the curve obtained by intersecting the surface with a coordinate plane. Usually, traces of functions of two variables can be found by fixing one of the input variables, so the coordinate planes are parallel to either the \(xz\)-plane or the \(yz\)-plane.
  • If we fix \(x = a\text{,}\) then the trace is obtained by intersecting the graph with the vertical plane \(x = a\text{.}\) Each point on this trace is of the form \((a, y, f(a,y))\text{.}\)
  • If we fix \(y = b\text{,}\) then the trace is obtained by intersecting the graph with the vertical plane \(y = b\text{.}\) Each point on this trace is of the form \((x, b, f(x,b))\text{.}\)

Subsection Level Curves and Contour Maps

You may be wondering: why can’t we use horizontal traces to analyze functions of two variables by fixing the output \(z = c\text{?}\) We for sure can! In fact, the horizontal traces projected on the \(xy\)-plane are called level curves of the function.

Example 14.1.4.

Find and sketch several level curves of the function \(f(x,y) = e^{-x^2 - y^2}\text{.}\) You may want to graph the function using GeoGebra to visualize the level curves.
Solution.
The level curves satisfy the equation \(e^{-x^2 - y^2} = c\text{,}\) where \(c\) is a (positive) constant. Taking the natural logarithm of both sides, we have
\begin{equation*} x^2 + y^2 = -\ln(c) \end{equation*}
This describes circular level curves centered at the origin with radius \(r = \sqrt{-\ln(c)}\text{,}\) for \(0 \lt c \leq 1\text{.}\)
  • With \(c = 1\text{,}\) the level curve satisfies the equation
    \begin{equation*} x^2 + y^2 = -\ln(1) = 0 \end{equation*}
    This corresponds to the single point at the origin \((0,0)\text{.}\) The level curve of this point will be drawn on the \(xy\)-plane. To indicate that this point is obtained by setting \(z = 1\text{,}\) we can label it as \(z = 1\text{.}\)
  • With \(c = e^{-1} \approx 0.37\text{,}\) the level curve satisfies the equation
    \begin{equation*} x^2 + y^2 = -\ln(e^{-1}) = 1 \end{equation*}
    This corresponds to a circle of radius \(r = 1\) centered at the origin. We can label this level curve as \(z = e^{-1}\text{.}\)
You are more than welcome to keep on graphing more level curves for other values of \(c\text{.}\) Just make sure you label them accordingly!
A sketch of several level curves is shown below.
Figure 14.1.5.
If you draw several level curves of a function \(f(x,y) = c\) for equally spaced values of \(c\text{,}\) then you obtain a contour map of the function. The interval between the values of \(c\) is called the contour interval. When you move from one level curve to another in a contour map, the output value of the function changes by the contour interval.
Figure 14.1.6.
You may be able to make a quick observation about the contour map above. the steeper the graph, the closer the level curves are to each other on the contour map. That is because a small change moving along the level curve results in a large change in the height when the graph is steep.

Example 14.1.7.

Match the function with its graph (A-F) and with its contour map (I-VI) in the figure below.
  1. \(\displaystyle z = \sin(xy)\)
  2. \(\displaystyle z = e^x\cos(y)\)
  3. \(\displaystyle z = \sin(x - y)\)
  4. \(\displaystyle z = \sin(x) - \sin(y)\)
  5. \(\displaystyle z = \lp 1 - x^2 \rp\lp 1 - y^2 \rp\)
  6. \(\displaystyle z = \dfrac{x - y}{1 + x^2 + y^2}\)
Figure 14.1.8. The graphs.
Figure 14.1.9. The contour maps (the level curves are not labeled).

Subsection Functions of Three (or More) Variables

If we throw in more independent variables, we can define functions of three or more variables. As you can imagine, for every variable we add, we need another dimension to represent the variable. For example, if we have a function of three variables \(w = f(x,y,z)\text{,}\) then we need four dimensions to represent the graph of the function.
Since we cannot visualize four (or more) dimensions, we must rely on other methods to understand functions of three or more variables. The idea of the level curves can be extended here. By setting the output variable to be a constant, we will still have three variables left, which implies that the level curves become level surfaces in \(\R^3\text{.}\) This is also called the isotherms.
Richard will have you explore the idea of the level surface more in the assigned problems.

Worksheet Assigned Problems for Section 14.1

The problems listed below are assigned to be included in your problem set portfolio. Note that a specific selection of these problems will also form the written homework assignments. I recommend working through all of them to ensure a solid grasp of the material. Reach out to Richard for help if you get stuck or have any questions.
The solutions will be posted after the written homework due dates. If you have any questions about your work, talk to Richard and he is happy to discuss the process with you.

14.1.3.

Evaluate the function \(h(x,y) = \dfrac{\sqrt{x - y^2}}{x - y}\) at the given points \((20,2)\text{,}\) \((1,-2)\text{,}\) and \((1,1)\) (or indicate that the function is undefined there).
Solution.
For \((20,2)\text{:}\)
\begin{equation*} h(20,2) = \frac{\sqrt{20 - 2^2}}{20 - 2} = \frac{\sqrt{16}}{18} = \frac{4}{18} = \frac{2}{9} \end{equation*}
For \((1,-2)\text{:}\)
\begin{equation*} h(1,-2) = \frac{\sqrt{1 - (-2)^2}}{1 - (-2)} = \frac{\sqrt{1 - 4}}{3} = \frac{\sqrt{-3}}{3} \end{equation*}
The function is undefined at \((1,-2)\) because the term under the square root is negative.
For \((1,1)\text{:}\)
\begin{equation*} h(1,1) = \frac{\sqrt{1 - 1^2}}{1 - 1} = \frac{0}{0} \end{equation*}
The function is undefined at \((1,1)\) due to division by zero.

14.1.9.

Sketch the domain of the function \(f(x,y) = \ln \lp 4x^2 - y \rp\text{.}\)
Solution.
The function is defined if \(4x^2 - y \gt 0\text{.}\) That is, \(y \lt 4x^2\text{.}\) The domain is the region in the \(xy\)-plane that is below the parabola \(y = 4x^2\text{.}\)
Figure 14.1.10.

14.1.17.

Describe the domain and range of the function \(P(r,s,t) = \sqrt{16 - r^2s^2t^2}\text{.}\)
Solution.
The domain is the subset of \(\R^3\) where \(r^2s^2t^2 \lt 16\text{,}\) or \(|rst| \lt 4\text{.}\) The range is \(\left\{ w \mid 0 \leq w \leq 4 \right\}\) since the values of \(P\) clearly range from \(\sqrt{16 - 16} = 0\) to \(\sqrt{16 - 0} = 4\text{.}\)

14.1.19.

Match graphs (A) and (B) in the figure below with the functions
  1. \(\displaystyle f(x,y) = -x + y^2\)
  2. \(\displaystyle g(x,y) = x + y^2\)
Figure 14.1.11.
Solution.
  1. The vertical trace for \(f(x,y) = -x + y^2\) in the \(xz\)-plane (\(y = 0\)) is \(z = -x\text{.}\) This matches the graph shown in (B).
  2. The vertical trace for \(f(x,y) = x + y^2\) in the \(xz\)-plane (\(y = 0\)) is \(z = x\text{.}\) This matches the graph shown in (A).

14.1.21.

Match the functions (a)-(f) with their graphs (A)-(F) in the figure below.
  1. \(\displaystyle f(x,y) = |x| + |y|\)
  2. \(\displaystyle f(x,y) = \cos(x - y)\)
  3. \(\displaystyle f(x,y) = \dfrac{-1}{1 + 9x^2 + y^2}\)
  4. \(\displaystyle f(x,y) = \cos\lp y^2 \rp e^{-0.1\lp x^2 + y^2 \rp}\)
  5. \(\displaystyle f(x,y) = \frac{-1}{1 + 9x^2 + 9y^2}\)
  6. \(\displaystyle f(x,y) = \cos\lp x^2 + y^2 \rp e^{-0.1\lp x^2 + y^2 \rp}\)
Figure 14.1.12.
Solution.
  1. \(f(x,y) = |x| + |y|\text{.}\) The level curves are \(|x| + |y| = c\text{,}\) \(y = c - |x|\text{,}\) or \(y = -c + |x|\text{.}\) The graph (D) corresponds to the function with these level curves.
  2. \(f(x,y) = \cos(x - y)\text{.}\) The vertical trace in the plane \(x = c\) is the curve \(z = \cos(c - y)\) in the plane \(x = c\text{.}\) These traces correspond to the graph (C).
  3. \(f(x,y) = \dfrac{-1}{1 + 9x^2 + y^2}\text{.}\) The level curves of this function is
    \begin{equation*} \frac{-1}{1 + 9x^2 + y^2} = c \qquad \implies \qquad 9x^2 + y^2 = -1 - \frac{1}{c} \end{equation*}
    For suitable values of \(c\text{,}\) the level curves of the function are ellipses. The graph (E) corresponds to the function with these level curves.
  4. \(f(x,y) = \cos\lp y^2 \rp e^{-0.1\lp x^2 + y^2 \rp}\text{.}\) The value of \(|z|\) is decreasing to \(0\) as \(x\) or \(y\) are decreasing, hence the possible graphs are (B) and (F). Function (f) matches with graph (F), so function (d) must match with graph (B).
  5. \(f(x,y) = \dfrac{-1}{1 + 9x^2 + 9y^2}\text{.}\) The level curves of this function is
    \begin{equation*} \frac{-1}{1 + 9x^2 + 9y^2} = c \qquad \implies \qquad x^2 + y^2 = - \frac{1 + c}{9c} \end{equation*}
    For suitable values of \(c\text{,}\) the level curves of the function are circles. The graph (A) corresponds to the function with these level curves.
  6. \(f(x,y) = \cos\lp x^2 + y^2 \rp e^{-0.1\lp x^2 + y^2 \rp}\text{.}\) The value of \(|z|\) is decreasing to \(0\) as \(x\) or \(y\) are decreasing, hence the possible graphs are (B) and (F).
    Furthermore, \(z\) is a constant whenever \(x^2 + y^2\) is a constant. That is, \(z\) is constant whenever \((x,y)\) varies on a circle. Hence, graph (F) corresponds to this function.

14.1.25.

Sketch the graph of \(f(x,y) = x^2 + 4y^2\) and draw several vertical and horizontal traces.
Solution.
The graph of the function is shown below.
Figure 14.1.13.
The horizontal traces at height \(c\) is the curve \(x^2 + 4y^2 = c\text{,}\) where \(c \geq 0\) (if \(c = 0\text{,}\) it is the origin). The horizontal traces are ellipses for \(c \gt 0\text{.}\)
Figure 14.1.14.
The vertical traces in the plane \(x = a\) is the parabola \(z = a^2 + 4y^2\text{,}\) and the vertical trace in the plane \(y = a\) is the parabola \(z = x^2 + 4a^2\text{.}\)
Figure 14.1.15.

14.1.33.

Draw a contour map of \(f(x,y) = \dfrac{y}{x}\) with an appropriate contour interval, showing at least six level curves.
Solution.
The level curves are defined by \(\frac{y}{x} = k\text{,}\) which implies \(y = kx\text{.}\) These are straight lines passing through the origin with slope \(k\) (excluding the origin itself, where the function is undefined).
Examples of level curves:
\begin{gather*} k = 0 \qquad \implies \qquad y = 0 \text{ (x-axis)} \\ k = 1 \qquad \implies \qquad y = x \\ k = -1 \qquad \implies \qquad y = -x \\ k = 2 \qquad \implies \qquad y = 2x \\ k = -2 \qquad \implies \qquad y = -2x \\ k = \frac{1}{2} \qquad \implies \qquad y = \frac{1}{2}x \end{gather*}
The contour map consists of a family of lines intersecting at the origin, shown in the figure below.
Figure 14.1.16.

14.1.47.

Let \(T(x,y,z) = x^2 - y^2 + z^2\) denote the temperature at each point in space. Draw level surfaces (also called isotherms) corresponding to the fixed temperatures \(T = 0,1,2,-1,-2\text{.}\)
Solution.
Each level surface of \(T\) is of the form \(x^2 - y^2 + z^2 = a\) for some constant \(a\text{,}\) so the level surfaces for \(a \gt 0\) are hyperboloids of one sheet;
For \(a \lt 0\text{,}\) they are hyperboloids of two sheets;
And for \(a = 0\) it is a elliptic cone.
Note that all of these surfaces are oriented along the \(y\)-axis.
Figure 14.1.18.

14.1.57.

Let temperature in 3-space be given by
\begin{equation*} T(x,y,z) = \frac{x^2}{4} + \frac{y^2}{9} + z^2 \end{equation*}
Draw isotherms corresponding to temperatures \(T = 0, 1, 2\text{.}\)
Solution.
Each level surface of \(T\) is of the form
\begin{equation*} \frac{x^2}{4} + \frac{y^2}{9} + z^2 = a \end{equation*}
for some constant \(a\text{,}\) so the level surfaces are ellipsoids for positive values of \(a\text{,}\) empty for negative values of \(a\text{,}\) and consist of the origin if \(a = 0\text{.}\) Plots of the various surfaces are shown below.
Figure 14.1.19.