The graph of a function $f$ of a single variable is the set of all points $(x,y)$ in $\mathbb{R}^2$ such that $x$ is in the domain of $f$ and $y=f(x)$. The graph of a function $f$ of two variables is the set of all points $(x,y,z)$ in $\mathbb{R}^3$ such that $(x,y)$ is in the domain of $f$ and $z=f(x,y)$.

In general, the graph of a function $f$ of $n$ variables is the set of all points $(x_1,\cdots,x_n,u)$ in $\mathbb{R}^{n+1}$ such that $(x_1,\cdots,x_n)\in\mathbb{R}^n$ is in the domain of $f$ and $u=f(x_1,\cdots,x_n)\in \mathbb{R}$. The graph of a function of three and more variables cannot be geometrically visualized. In the next section, we will learn how to geometrically represent functions of three variables with what are called level surfaces. In this section we focus on the graph of functions of two variables.

It is often hard to draw the graph of a function $z=f(x,y)$ except for some special cases. One of these special cases is when one of the independent variables, say $y$, does not appear in the formula of the function, so $z$ depends on $x$ only $z=\phi(x)$. In this case, the graph of $z=f(x,y)$ in 3-space is a cylindrical surface formed by the motion of a line moving parallel to the $y$-axis and intersecting the curve $z=\phi(x)$.

Example 1

Sketch the graph of $z=f(x,y)=x^2$ in 3-space.

Solution

We can easily sketch the graph of $z=x^2$ in the $xz$-plane (See Figure 1 (a) below). If $(x_0,z_0)$ is on the parabola $z=x^2$ in the $xz$ plane, then $(x_0,y_0,z_0)$ is on the graph of $z=f(x,y)$ for any arbitrary value of $y_0$. The graph of $z=f(x,y)$ in 3-space is a parabolic cylinder (See Figure 1 (b) below).

Sometimes, we get an idea of the shape of the graph by paying attention to how the function behaves when one variable is fixed and the other one is allowed to change.

Example 2

Sketch the graph of $z=f(x,y)=x^2+2y$.

Solution

The graph of the function intersects the $xz$-plane (where $y=0$) in a parabola (Figure 1 (a)). The cross-section of the graph of $f$ by a plane $x=x_0$ is a straight line $z=x_0^2+2y$ of slope 2. This implies that the graph of $f$ is an oblique cylinder generated by a line traversing the parabola $z=x^2$ in the $xz$-plane and moving parallel to a fixed line (say $z=2y$ and $x=0$) (Figure 2).

Figure 2

There is another special case in which the sketch of the graph of a function of two variables reduces to that of a function of one variable. In some problems, if we substitute $x=r\cos\theta$ and $y=r\sin\theta$ [i.e. we use polar coordinates] in the formula of a function $z=f(x,y)$, now the dependent variable, $z$, becomes a function of $r$ alone, say $z=F(r)$. For example, if $z=x^2+y^2$, then in polar coordinates we have $z=r^2(\cos^2\theta+\sin^2\theta)$. In such cases, the value of the function at a point $(x,y)$ depends only on the distance between that point and the origin, $r$. This implies that we can simply sketch the graph of $F(r)$ in 2-space, which is a function of one variable, and then rotate it around the $z$ axis (because the value of $z$ is the same for all values of $\theta$) to get the graph of $z=f(x,y)$. For example, if we rotate the graph of $z=r^2$ (Figure 3 (a)), which is a parabola, around the $z$-axis, we get the graph of $z=x^2+y^2$ (Figure 3 (b)).

Figure 3(b)

Example 3

Given $z=f(x,y)=\sin\left(\sqrt{x^2+y^2}\right)/\sqrt{x^2+y^2}$, sketch the graph of $f$.

Solution

This function may look intimidating but if we use polar coordinates, we realize
$z=\frac{\sin r}{r}.$ If we recall the graph of $z=\frac{\sin x}{x}$ from the calculus of one variable (Figure 4 (a)), then we can simply rotate it around the $z$-axis to get the graph of $f$ (Figure 4 (b)).

Figure 4(b)

Nowadays computer programs provide a great opportunity to plot functions beautifully. Mathematica, MATLAB, and Maple are some commercial programs, and R, Octave, gnuplot and different libraries for the Python programming language are some free packages that you can use to plot functions.