Recall that a function $f$ from a set $U$ to a set $V$ is a rule that assigns, to each $x\in U$, one and only one element $y\in V$. We call $x$ the independent variable and $y$ the dependent variable. We express it by writing  $y=f(x)$. The sets $U$ and $V$ are called the domain and co-domain of $f$, respectively. To mention that $f$ is a function with the domain $U$ and the co-domain $V$, we write $f:U\to V$. In the calculus of a single variable, $U$ and $V$ are subsets of $\mathbb{R}$. In this chapter, we deal with functions where $U$ is a subset of $\mathbb{R}^n$.

Definition: A function $f:U\to\mathbb{R}$ where $U\subseteq \mathbb{R}^n$ is a rule that assigns one and only one real number to each point ${\mathbf x}=(x_1,\cdots,x_n)$ of $U$.

In a concise fashion, we may also write $f:U\subseteq\mathbb{R}^n\to\mathbb{R}$. When $n>1$, the function $f$ is called a real-valued function of a vector variable or simply a scalar field. In most of the examples in this chapter, $n$ is 2 or 3. When $n=2$, the independent variables are often denoted by $x$ and $y$ (or sometimes by $x_1$ and $x_2$), the dependent variable by $z$, and we write $z=f(x,y)$. When $n=3$, the independent variables are denoted by $x$, $y$ and $z$ (or by $x_1$, $x_2$ and $x_3$) and the dependent variable by another letter from the end of the alphabets like $u$ or $w$. In the most general case, we write $y=f(x_1,x_2,\cdots,x_n)$ or $y=f({\mathbf x})$; here $y$ is the dependent variable.

Elementary examples of multivariable functions

Polynomials are the simplest type of functions. A polynomial function of two variables $x$ and $y$ is the sum of a finite number of terms $c x^m y^n$ (called monomials), where $m$ and $n$ are nonnegative integers and $c$ is a real number. The degree of the monomial $c x^m y^n$ is $m+n$ providing $c\neq 0$. The degree of the monomial of three variables $cx^m y^n z^p$ is $m+n+p$ provided $c\neq 0$. The degree of a polynomial is the highest degree of its constituting monomials. Hence, the function defined by
\[z=-4 x^3 y^2+4 x^4+3 x y^2+7,\] is a polynomial of degree 5.

Rational functions are the second simplest type of functions. A rational function is the quotient of one polynomial by another. Therefore, the general form of a rational function of two variables is
\[R(x,y)=\frac{P(x,y)}{Q(x,y)}\] where $P(x,y)$ and $Q(x,y)$ are polynomials.

The functions that are generated by a finite number of operations addition, subtraction, multiplication, division, and raising to a fractional power are called algebraic functions, for example,
\[z=\sqrt[5]{\frac{x^3-y}{x^2 y^2+y}}+\sqrt[3]{\frac{x+\sqrt{xy}}{x+y^3}}.\]

When the domain of a function $y=f(x_1,x_2,\cdots,x_n)$ is not specified explicitly, we assume its domain is the set of all possible points in $\mathbb{R}^n$ at which $f$ produces real values. This set is called the natural domain or simply the domain of the function. The set of all possible outputs of the function is called the range of the function.

Example 1

Let $f(x,y)=\frac{1}{\sqrt{x^2-y^2}}$. Find the natural domain of $f$.

Solution

The expression under the square root cannot be negative, and because it appears in the denominator it cannot be zero. Thus the domain consists of all points $(x,y)$ such that $x^2-y^2>0$; that is,
\[y^2<x^2,\quad \text{or}\quad -|x|<y<|x|.\] The domain of $f$ is shaded in the following figure. The dashed lines in this figure are not included in the domain.

Example 2

Let $f(x,y)=\ln(xy-1)$. Find the natural domain of $f$.

Solution
The function $f$ produces real values if the argument of the logarithmic function, which is here $xy-1$, is positive. Hence, the domain of $f$ consists of all points $(x,y)$ such that $xy>1$, which is equivalent to
\[\begin{cases}
y>\frac{1}{x} & \text{if } x>0\\
\\
y<\frac{1}{x} & \text{ if } x<0
\end{cases}\]
The domain of $f$ is shaded in the following figure.

Example 3

Let $f(x,y)=\arcsin(x+y)$. Find the natural domain of $f$.

Solution

Because $-1\leq \sin x\leq 1$, $\arcsin u$ is defined when $-1\leq u\leq 1$. Therefore, we must have
\[-1\leq x+y\leq 1\quad\text{or}\quad -1-x\leq y\leq 1-x;\] that is, $y$ must be between the two lines $y=-x+1$ and $y=-x-1$. The domain of $f$ is the shaded area between the two lines in the following figure.

Example 4

Let $f(x,y,z)=\sqrt{9-x^2-y^2-z^2}$. Find the natural domain of $f$.

Solution

The expression under the square root must be non-negative; that is, $9-x^2-y^2-z^2\geq 0$ or $x^2+y^2+z^2\leq 9$. Notice that $x^2+y^2+z^2=9$ is the equation of a sphere of radius 3 centered at the origin. Therefore, the domain of $f$ consists of all points on or within this sphere (See the following figure).

 

   Composition of functions

If $g$ is a function of one variable and $f$ is a function of three variables, then the composition of $g$ and $f$, $g\circ f$, is the function of three variables defined by
\[g\circ f(x,y,z)=g(f(x,y,z)).\] The domain of $g\circ f$ consists of all points $(x,y,z)$ in the domain of $f$ such that $f(x,y,z)$ is in the domain of $g$. The extension of this to functions of several variables is easy. Let $f$ be a function of $n$ variables and $g$ be a function of a single variable, then
\[g\circ f (x_1,\cdots,x_n)=g(f(x_1,\cdots,x_n))\] and the domain of $g\circ f$ is the set of all points $(x_1,\cdots,x_n)$ in the domain of $f$ such that $f(x_1,\cdots,x_n)$ is in the domain of $g$.

Example 5

Given $g(t)=\ln(3-t)$ and $f(x,y,z)=\sqrt{x^2+y^2+z^2-16}$, evaluate $g\circ f(2,-2,3)$ and find the domain of $g\circ f$.

Solution
\begin{align*}
g\circ f(2,-2,3)&=g(f(2,-2,3))\\
&=g\left(\sqrt{2^2+(-2)^2+3^2-16}\right)\\
&=g(\sqrt{1})\\
&=\ln(3-1)=\ln 2
\end{align*}

The domain of $f$ is the set of all points $(x,y,z)$ in $\mathbb{R}^3$ such that $x^2+y^2+z^2-16\geq 0$, and the domain of $g$ is the set of all $t$ in $\mathbb{R}$ such that $3-t>0$; that is the domain of $g$ is the interval $(-\infty, 3)$. Therefore, the domain of $g\circ f$ is the set of all points $(x,y,z)$ in $\mathbb{R}^3$ such that
\[x^2+y^2+z^2\geq 16,\tag{i}\] \[\text{and}\quad \sqrt{x^2+y^2+z^2-16}<3.\tag{ii}\] We can simplify (ii)
\[\sqrt{x^2+y^2+z^2-16}<3\Rightarrow x^2+y^2+z^2-16<9\] or
\[x^2+y^2+z^2<25.\tag{iii}\] As (i) and (ii) must both hold, the domain of $g\circ f$ is the set of all $(x,y,z)$ such that
\[16\leq x^2+y^2+z^2 < 25,\] which is the set of all points between a sphere of radius 5 and a sphere of radius 4 both centered at the origin plus the points on the latter sphere.

In a similar way, if ${\mathbf r}:I\subseteq \mathbb{R}\to \mathbb{R}^n$ is a vector-valued function and $f:U\subseteq \mathbb{R}^n\to \mathbb{R}$, the composite function $f\circ{\mathbf r}$ is a function from $I\cap \{t|\ {\mathbf r}(t)\in U \}$ to $\mathbb{R}$, and is defined by $f\circ{\mathbf r}(t)=f({\mathbf r}(t))$.

Composite function $ f\circ{\mathbf r}(t)=f({\mathbf r}(t))$

 

 

Example 6

Noting that ${\mathbf r}(\theta)=(\cos \theta,\sin\theta)$ for $0\leq \theta<2\pi$ gives a circle of radius 1 and centered at the origin,
(a) find the distance from the points on that circle to the point $(2,2\sqrt{3})$
(b) find the closest point on that circle to the point $(2,2\sqrt{3})$.

Solution

(a) Distance from the point $(x,y)$ to the point $(2,2\sqrt{3})$ is given by
\[f(x,y)=\sqrt{(x-2)^2+(y-2\sqrt{3})^2};\] therefore, the distance of the points on the circle of radius 1 centered at the origin is
\[f({\mathbf r}(\theta))=\sqrt{(\cos \theta-2)^2+(\sin \theta -2\sqrt{3})^2}\]

(b) We want to minimize the function $h=f\circ{\mathbf r}$, which is a function of a single variable $\theta$. Thus, we can use the method of optimization for functions of one variable. In other words, $h$ has minimum either at its critical points, where $h'(\theta)=0$ or at the end points where $\theta=0$ and $\theta=2\pi$.

\[h'(\theta)=\frac{-2\sin\theta(\cos\theta-2)+2\cos\theta(\sin\theta-2\sqrt{3})}{2\sqrt{(\cos \theta-2)^2+(\sin \theta -2\sqrt{3})^2}}\]

\[h'(\theta)=0 \Rightarrow -2\sin\theta(\cos\theta-2)+2\cos\theta(\sin\theta-2\sqrt{3})=0\]

\[\text{or}\quad 4\sin \theta-4\sqrt{3} \cos\theta=0\]

[Note that it follows from $-1\leq\cos\theta\leq 1$ that $ (\cos\theta-2)^2>0$, so the denominator of $h'(\theta)$ is never zero and hence $h'(\theta)$ always exists. Similarly we can argue that $h$ is always differentiable because $(\sin\theta-2\sqrt{3})^2>0$.]

Obviously when $\theta=0$ or $\theta=\pi$ at which $\cos\theta=0$, we have $h'(\theta)\neq 0$. So we can assume $\cos\theta\neq 0$, and divide both sides of the above equation by $\cos\theta$:
\[ 4\sin \theta-4\sqrt{3} \cos\theta=0 \Rightarrow \tan\theta=\frac{1}{\sqrt{3}} \Rightarrow \theta=\frac{\pi}{6} \text{ or } \pi+\frac{\pi}{6}.\]

Therefore, we should check the points $\theta=\frac{\pi}{6},\ \pi+\frac{\pi}{6},\ 0,\ 2\pi$. You can verify that when $\theta=\frac{\pi}{6}$, the distance is minimum and the closest point on the circle is $\mathbf{r}(\frac{\pi}{6})=(\cos\frac{\pi}{6},\sin\frac{\pi}{6})=\left(\frac{\sqrt{3}}{2},\frac{1}{2}\right)$.