Multivariable Functions (and Their Level Curves)

Direct Knowlege Contributor David A. Smith
  • By David A. Smith, Founder & CEO, Direct Knowledge
  • David Smith has a B.S. and M.S. in Mathematics and has enjoyed teaching calculus, linear algebra, and number theory at both Tarrant County College and the University of Texas at Arlington. David is the Founder and current CEO of Direct Knowledge.

A real-valued function of several real variables is a function that takes as input real numbers (represented by variables) and produces another real number, the value of the function. We discuss the basic of multivariable functions such as find the domain and range for a given formula. Also we consider level curves and sketching the graph of a function in two variables.

Functions of Several Variables

A polynomial function of two variables is a sum of terms of the form $cx^m y^n$, where $c$ is a real number and both $m$ and $n$ are nonnegative integers. For example the function $$ f(x,y)=3x^3 y^5-3x^2 y^4-x y +7 $$ is a polynomial function with terms $3x^3y^5$, $-3x^2 y^4$, $-xy$, and $7.$ A rational function of two variables is a ratio of polynomial functions. For example the function \begin{equation} f(x,y)=\frac{3x^3 y^5-3x^2 y^4-x y +7}{x^3-y^2} \end{equation} is a rational function with numerator $3x^3 y^5-3x^2 y^4-x y +7$ and denominator $x^3-y^2.$

A function of three variables is a rule that assigns to each ordered pair $\left(x, y, z\right)$ in a set $D$ a unique number $f\left(x, y, z\right).$ The set $D$ is called the domain of the function and is a subset of $\mathbb{R}^3.$ The collection of corresponding values $f\left(x,y,z\right)$ constitutes the range which is a subset of $\mathbb{R}.$

Example. Let $$ f(x,y,z)=x^2-2xy z+2 y z-x. $$ Find the domain of $f$ and evaluate $f(1,2,3)$, $f(t,2t,3t)$, $f(x+y, x-y, 0)$, and \begin{equation} \frac{f(x+h,y,z)-f(x,y,z)}{h}, \quad \frac{f(x,y+h,z)-f(x,y,z)}{h}, \quad \end{equation} and \begin{equation} \frac{f(x,y,z+h)-f(x,y,z)}{h}. \end{equation} where $h$ is an unknown quantity.

Solution. Substitution into the function yields the following: $f(1,2,3)=0$, \begin{align} & f(t,2t,3t)=-t+13 t^2-12 t^3 \\ & f(x+y,x-y,0)=-x-y+(x+y)^2 \\ & \frac{f(x+h,y,z)-f(x,y,z)}{h} = \frac{-h-x^2+(h+x)^2+2 x y z-2 (h+x) y z}{h} \\ & \frac{f(x,y+h,z)-f(x,y,z)}{h} = \frac{-h-x^2+(h+x)^2+2 x y z-2 (h+x) y z}{h} \\ & \frac{f(x,y,z+h)-f(x,y,z)}{h} = \frac{2 y z-2 x y z-2 y (h+z)+2 x y (h+z)}{h} \end{align} The domain of $f$ is not all real numbers, but rather $\mathbb{R}^3.$

Definition. A function of $n$ variables is a rule that assigns to each ordered pair $\left(x_1, x_2, \ldots , x_n\right)$ in a set $D$ a unique number $f\left(x_1, x_2, \ldots , x_n\right).$ The set $D$ is called the domain of the function and the set of corresponding values $f\left(x_1, x_2, \ldots , x_n\right)$ is called the range.

The graph of a function of several variables $f\left(x_1,\ldots,x_n\right)$ is the collection of all ordered $(n+1)$-tuples $\left(x_1,\ldots,x_n,x_{n+1}\right)$ such that $\left(x_1,\ldots,x_n\right)$ is in the domain of $f$ and $x_{n+1} = f\left(x_1,\ldots,x_n\right).$ Sketching by hand the graph of a function with several variables can be challenging. Let’s look at a few particular functions.

For example the function $f$ defined by \begin{equation} \label{polyfunc} f(x,y,z)=2x^3+4y^4+9z^6 \end{equation} is a three variable polynomial function with domain $\mathbb{R}^3$ and range $(-\infty, +\infty).$ As another example consider the function $g$ defined by \begin{equation} \label{trigfunc} g(w,x,y,z)=z^2+\sin w x+\cos w y. \end{equation} The function $g$ is a four variable function with domain $\mathbb{R}^4$ and range $[-2,+\infty).$ Let $h$ be the function defined by \begin{equation} \label{expfunc} h(x,y,z) = e^{xy}+z^4\sqrt[6]{x^2-4}. \end{equation} Then $h$ is a three variable function with domain all ordered triples $(x,y,z)$ with the requirement $x^2-4\geq 0.$ The range of $h$ is the set of all real numbers greater than 0.

Definition. Let $f$ and $g$ be functions of the variables $x_1, x_2, \ldots,x_n.$ Then defined point-wise, the following functions are also functions of the variables $x_1, x_2, \ldots, x_n.$

$(1) \quad (f+g)\left(x_1, x_2, \ldots, x_n\right):= f\left(x_1, x_2, \ldots, x_n\right)+g\left(x_1, x_2, \ldots, x_n\right)$

$(2) \quad (f-g)\left(x_1, x_2, \ldots, x_n\right):= f\left(x_1, x_2, \ldots, x_n\right)-g\left(x_1, x_2, \ldots, x_n\right)$

$(3) \quad (f g)\left(x_1, x_2, \ldots, x_n\right):= f\left(x_1, x_2, \ldots, x_n\right)g\left(x_1, x_2, \ldots, x_n\right)$

$(4) \quad (f/g)\left(x_1, x_2, \ldots, x_n\right):=\dfrac{f\left(x_1, x_2, \ldots, x_n \right)}{g\left(x_1, x_2, \ldots, x_n\right)}$ if $g\left(x_1, x_2, \ldots, x_n\right)\neq 0$.

For example, considering the functions $f$ and $h$ defined in \eqref{polyfunc} and \eqref{expfunc}, respectively. Is $f+h$ defined as a function? Yes, and we have \begin{equation} (f+h)(x,y,z)= 2x^3+4y^4+9z^6+e^{xy}+z^4\sqrt[6]{x^2-4} \end{equation} and notice the domain of $f+h$ is all ordered triples $(x,y,z)$ with the requirement $x^2-4\geq 0$ and the range is $(-\infty,+\infty).$

Is $g+h$ defined as a function? If we use the functional rule defining $h$, namely $e^{xy}+z^4\sqrt[6]{x^2-4}$ then the function defined by \begin{equation} h_1(w,x,y,z)=e^{xy}+z^4\sqrt[6]{x^2-4} \end{equation} (defined as a four variable function), then the function $(g+h_1)$ is defined as a function by \begin{equation} (g+h_1)(w,x,y,z)=z^2+\sin w x+\cos w y+ e^{xy}+z^4\sqrt[6]{x^2-4}. \end{equation} Notice the domain of $g+h_1$ is $\mathbb{R}^4$ and the range is $[-2,+\infty).$

Functions of Two Variables

When working with functions $f$ of two variables $x$ and $y$, we write $z=f(x,y)$ where $x$ and $y$ are the independent variables and $z$ is the dependent variable. The domain is defined to be the largest set of points for which the functional formula is defined and real-valued.

Example. Find the domain and range for the function $$ f(x,y)=\dfrac{1}{\sqrt{x-y}}. $$

Solution. The domain is $$\{(x,y)\in \mathbb{R}^2 \mid y\neq x \}. $$ Notice the domain is a subset of $\mathbb{R}^2$ and the range is a subset of $\mathbb{R}.$

Example. Find the domain and range for the function $$ f(x,y)=\sqrt{\dfrac{x}{y}}. $$

Solution. The domain is $$ \{(x,y)\in \mathbb{R}^2\, \mid\, x y\geq 0 \text{ and } y\neq 0\} $$ because of the square root and the range is $$ \{z \in \mathbb{R} \, \mid \, z\geq 0\}. $$ Notice the domain is a subset of $\mathbb{R}^2$ and the range is a subset of $\mathbb{R}.$

In three dimensions, the graph of $z=f(x,y)$ is a surface in $\mathbb{R}^3$ whose projection onto the $x y$-plane is the domain $D.$ When the plane $z=C$ intersects the surface $$ z=f(x,y), $$ the result is the curve with the equation $f(x,y)=C$ and such an intersection is called the trace of the graph of $f$ in the plane $z=C.$ The set of points $(x,y)$ in the $x y$-plane that satisfies $$ f(x,y)=C $$ is called the level curve of $f$ at $C$ and an entire family of level curves is generated as $C$ varies over the range of $f.$ Level curves are obtained by projecting a trace onto the $x y$-plane. Because level curves are used to show the shape of a surface, they are sometimes called contour curves.

Definition. The curves $f(x,y)=C$ in the $xy$-plane are called the level curves of the function $f$ of two variables $x$ and $y$, where $C$ is a constant in the range of $f.$

Example. Sketch a few level curves for the function $$ f(x,y)=2x-3y=C $$ with $C\geq 0.$

Multivariable Functions
Contour plot for the function in $f(x,y)=2x-3y$.

Solution. Graphing the lines \begin{equation} y=\frac{2}{3}x-\frac{C}{3} \end{equation} we have the family of level curves corresponding to $C=1,\ldots,10.$ The level curves show that the graph of the function $f$ is a plane in $\mathbb{R}^3.$

Example. Sketch a few level curves for the function $$ f(x,y)=x^2+\frac{y^2}{4}=C $$ with $C\geq 0.$

Multivariable Functions Contour plot for the function in
Contour plot for the function in $f(x,y)=x^2+\frac{y^2}{4}$.

Solution. Graphing the ellipses \begin{equation} \frac{x^2}{1^2}+\frac{y^2}{2^2}=C \end{equation} in $\mathbb{R}^2,$ we have the family of level curves corresponding to $C=1,\ldots,10.$ The level curves show that the graph of the function $f$ is a elliptic paraboloid in $\mathbb{R}^3.$

Example. Find the domain and range for the function $$ f(x,y)=\sqrt{\frac{y}{x-2}} $$ and sketch some level curves for $f(x,y)=C$ with $C=0,1,2,3,4.$

Contour plot for the function in Multivariable Functions
Contour plot for the function in $f(x,y)=\sqrt{\frac{y}{x-2}}$.

Solution. The domain of $f$ is \begin{equation} \left\{(x,y)\in \mathbb{R}^2 \mid \frac{y}{x-2}>0 \right\}. \end{equation} To sketch some level curves $$ \sqrt{\frac{y}{x-2}}=C $$ let’s square both sides $\frac{y}{x-2}=C^2$ and so $$ y=C^2(x-2). $$ The range of $f$ is ${z\in \mathbb{R} \mid z\geq 0}.$

Computer generated graphs of functions and their contour plots.

Exercises on Multivariable Functions

Exercise. Let $f(x,y,z)=x^2y e^{2x}+(x+y-z)^2.$ Find each of the following.

$(1) \quad \displaystyle f(0,0,0)$

$(2) \quad \displaystyle f(1,-1,1)$

$(3) \quad \displaystyle f(-1,1,-1)$

$(4) \quad \displaystyle \frac{d}{dx}\left[ f(x,x,x) \right]$

$(5) \quad \displaystyle \frac{d}{dy}\left[ f(1,y,1)\right] $

$(6) \quad \displaystyle \frac{d}{dz}\left[ f\left(1,1,z^2\right) \right] $

Exercise. Find the domain and range for the multivariate function.

$(1) \quad \displaystyle f(x,y)=\frac{1}{\sqrt{x-y}}$

$(2) \quad \displaystyle f(x,y)=\sqrt{\frac{y}{x}}.$

$(3) \quad \displaystyle f(u,v)=\sqrt{u \sin v}.$

$(4) \quad \displaystyle f(x,y)=e^{(x+1)/(y-2)}.$

$(5) \quad \displaystyle f(x,y)=\frac{1}{\sqrt{9-x^2-y^2}}.$

Exercise. Sketch some level curves of the function.

$(1) \quad \displaystyle f(x,y)=x^2-y^2=C$

$(2) \quad \displaystyle f(x,y)=\frac{x}{y}=C$

$(3) \quad \displaystyle f(x,y)=x^2-y=C$

$(4) \quad \displaystyle f(x,y)=x^2+\frac{y^2}{4}=C$

$(5) \quad \displaystyle f(x,y)=x^3-y=C$

$(6) \quad \displaystyle f(x,y)=1/\sqrt{x^2-y^2}$

$(7) \quad \displaystyle g(x,y)=\sqrt{x \sin y}$

$(8) \quad h(x,y)=\ln (y-x)$

Exercise. Describe the trace of the quadratic surface in each coordinate plane, then sketch the surface.

$(1) \quad \frac{x^2}{4}+y^2+\frac{z^2}{9}=1$

$(2) \quad \frac{x^2}{9}-y^2-z^2=1$

Exercise. Sketch the graph of the multivariate function.

$(1) \quad f(x,y)=x$

$(2) \quad f(x,y)=x^3-1$

$(3) \quad f(x,y)=x^2-y$

$(4) \quad f(x,y)=x^2-y^2$

$(5) \quad f(x,y)=\sqrt{x+y}$

$(6) \quad f(x,y)=1/\sqrt{x^2-y^2}$

$(7) \quad g(x,y)=\sqrt{x \sin y}$

$(8) \quad h(x,y)=\ln (y-x)$