Artificial Intelligence 🤖
Graphing functions of several variables

Graphing functions of several variables

In studying single-variable functions, we have seen that plotting a graph often displays the important features of a function from which we can obtain useful information. Graphs are also useful for visualising functions of two variables. Consider a single-variable function, y=g(x)y=g(x) and a two-variable function, z=z= f(x,y)f(x, y). In the same way that an equation y=g(x)y=g(x) leads to plotting ordered pairs (x,y)(x, y) in the Cartesian plane (see Fig. [1.1), the equation, z=f(x,y)z=f(x, y) leads to plotting ordered triples (x,y,z)(x, y, z) in a three-dimensional space (see Fig. 1.2). We can extend this to functions of three variables, e.g. w=h(x,y,z)w=h(x, y, z) to represent four-dimensional surfaces.

Figure 1.1: Graph of y=g(x)y=g(x) for g(x)=x3g(x)=x^{3}.

Plotting functions of two variables by hand is often a tedious and difficult task; fortunately we rely on computer software (e.g. MATLAB) which allows us to explore functions graphically from different perspectives. Of course it is not possible to draw the graph of a function of more than two variables.

Before we move on, let us briefly discuss the domain, DD of functions of more than one variable. Recall for a single-variable function, say y=g(x)y=g(x), the domain consists of all the values of xx that we can plug into the function and get back a real number. This implies that the domain of a function of a single variable is an interval (or intervals) of values from the number line or one-dimensional space. For a two-variable function, say z=f(x,y)z=f(x, y), the domain is given by a two-dimensional space consisting of all the coordinate

Figure 1.2: Graph of z=f(x,y)z=f(x, y) for f(x,y)=cosx2+y2f(x, y)=\cos \sqrt{x^{2}+y^{2}}.

pairs, (x,y)(x, y) that we can plug into the function and get back a real number. If we are given a function f(x,y)f(x, y) and the domain is not specified, then it is understood that the domain of ff is the set of all pairs (x,y)(x, y) for which ff is a well-defined number.

Example 1.1 Find the domain of the following function and evaluate f(3,2)f(3,2) :

f(x,y)=x+y+1x1f(x, y)=\frac{\sqrt{x+y+1}}{x-1}

Solution The expression for ff gives a real number if the denominator is not 0 and if the quantity under the square root is nonnegative 1

The denominator is not equal to 0 if x1x \neq 1 and hence, the points on the line x=1x=1 must be excluded from the domain. For the numerator, since x+y+10x+y+1 \geq 0, then the inequality yx1y \geq-x-1 describes the points that lie on or above the line y=x1y=-x-1. The domain of ff is given by:

D={(x,y)x+y+10,x1}D=\{(x, y) \mid x+y+1 \geq 0, x \neq 1\}

Finally, to evaluate f(3,2)f(3,2), we plug in x=3x=3 and y=2y=2 in the expression for ff :

f(3,2)=3+2+131=62.f(3,2)=\frac{\sqrt{3+2+1}}{3-1}=\frac{\sqrt{6}}{2} .

1{ }^{1} note that the term nonnegative is used for a quantity which is either zero or positive, i.e, 0\geq 0. Next, in order to analyse graphs, we define and discuss traces and contour maps.

Traces

Traces are the curves which are obtained by intersecting the graph with planes parallel to a coordinate plane. We define three types of traces:

  1. Horizontal trace at height k\boldsymbol{k} : the intersection of the graph with the horizontal plane z=kz=k, consisting of points (x,y,k)(x, y, k) such that f(x,y)=kf(x, y)=k (see Fig. 1.31)
  2. Vertical trace in the plane x=ax=a : the intersection of the graph with the vertical plane at x=ax=a [see Fig. 1.4(a)
  3. Vertical trace in the plane y=b\boldsymbol{y}=\boldsymbol{b} : the intersection of the graph with the vertical plane at y=by=b [see Fig. 1.4(b)

Figure 1.3: Graph of z=f(x,y)z=f(x, y) intersecting with the horizontal plane at k=0.8k=0.8.

Contour maps

The level curve of a function, f(x,y)f(x, y) is defined as the curve in the xyx y-plane with equation f(x,y)=kf(x, y)=k, i.e. it shows where the graph of ff has height kk. A collection of such curves is called the contour diagram or contour map of the function f(x,y)f(x, y). It is useful to look at the relationship between level curves and horizontal traces. The level curves f(x,y)=kf(x, y)=k are the traces of the graph ff in the horizontal plane, z=kz=k projected down to the xyx y-plane. Figure 1.5 shows a number of horizontal traces and their projections on the xyx y-plane; as an example a horizontal plane is highlighted at z=22z=22 while the dotted,

Figure 1.4: Vertical traces parallel to (a) yzy z-plane with trace shown with a thick red line at x=15x=-15 (b) xzx z-plane with trace shown with a thick red line at y=17y=-17.

vertical lines show the ptojection of that trace to the k=22k=22 level curve on the xyx y-plane.

Figure 1.5: Horizontal traces and level curves f(x,y)=kf(x, y)=k at various values of kk. A horizontal plane and trace are highlighted at z=22z=22 with the projected level curve shown at k=22k=22 on the xyx y-plane. Example 1.2 Sketch the level curves for k=0,1,2k=0,1,2 of the function

f(x,y)=9x2y2.f(x, y)=\sqrt{9-x^{2}-y^{2}} .

Solution The level curves are given by f(x,y)=kf(x, y)=k or, equivalently,

9x2y2=k or x2+y2=9k2.\sqrt{9-x^{2}-y^{2}}=k \quad \text { or } \quad x^{2}+y^{2}=9-k^{2} .

These curves represent concentric circles with centre at (0,0)(0,0) and radius r=9k2r=\sqrt{9-k^{2}}. Figure 1.6 shows the level curves at k=0,1,2k=0,1,2 (labelled).

Figure 1.6: Contour map of f(x,y)=9x2y2f(x, y)=\sqrt{9-x^{2}-y^{2}} showing level curves for k=0,1,2k=0,1,2.