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)$.

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.

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)*

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.