Download the original Maple Worksheet (very large file)

Graphs 

A very common problem in Multivariable calculus courses is that people do not really understand what they're doing when they graph functions and solutions to equations.  One fundamental problem lies at not really understanding the different kinds of graphs, as in the end they all look the same.  For example, why doesn't the vertical line test apply to the graph of x2+y2=1?  What is the difference between xy=1 and f(x,y)=xy?  The purpose of this page is to make clear the different kinds of graphs, how to read them, and how to draw them in Maple. 

Graphs of Functions 

You've graphed functions of a single variable ever since algebra in high school. For example, the graph of y=4x2-3 is the graph of the function f(x)=4x2-3.  A graph of such a function is constructed by considering different values for x, plugging them into f(x), and then marking the value of f.  These marks can blend together to form a curve (if your function is nice enough).  Use the plot command to graph functions of a single variable. 

plot(4*x^2-3, x = -1.5 .. 1.5, style = point); 1 

 

Plot 

 

plot(4*x^2-3, x = -1.5 .. 1.5, style = line); 1 

 

Plot 

 

Introduced in 14.1, functions of two variables have three-dimensional graphs, just as functions of one variable have two dimensional graphs.  For example, consider f(x,y)=x2+y2.  To draw these, you consider each point (x,y) in the xy-plane (well, not all of them since that will take a long time), plug those values into f(x,y), and mark the height.  Make enough marks and they meld into a surface (if your function is nice enough).  To draw these in Maple, you'll use the plot3d command. 

plot3d(x^2+y^2, x = -1 .. 1, y = -1 .. 1, axes = normal, style = point, numpoints = 200); 1
plot3d(x^2+y^2, x = -1 .. 1, y = -1 .. 1, axes = normal, style = point, numpoints = 200); 1
 

 

Plot 

 

plot3d(x^2+y^2, x = -1 .. 1, y = -1 .. 1, axes = normal); 1 

 

Plot 

 

Whether the functions are of one or two variables, graphs of functions always obey the vertical line test.  If you take an up-down (the y direction for y=f(x) or the z direction for z=f(x,y)) line and move it around, you will only ever hit at most one point of the curve/surface at a time. 

Graphs of Equations 

What about the graph of something like x^2+y^2 = 1?  Well, here you are graphing the solution set of an equation.  So you go through all points (x,y) in the plane, and check if they are a solution to your equation (you can check this by plugging in the values for x and y and seeing if the equality holds).  For example (3/5,4/5) is a solution to x^2+y^2 = 1, but (1/2,1/2) is not (check them yourself).  If the point is a solution (that is, the equality holds), you make a mark.  All the marks can blend into a curve or set of curves (if your equation is nice).  To plot solutions to equations in two variables, use the implicitplot command.  This can be found in the plots package, which is loaded using the with(plots) command. 

with(plots); -1 

implicitplot(x^2+y^2 = 1, x = -1 .. 1, y = -1 .. 1, style = point, numpoints = 60, scaling = constrained); 1
implicitplot(x^2+y^2 = 1, x = -1 .. 1, y = -1 .. 1, style = point, numpoints = 60, scaling = constrained); 1
 

 

Plot 

 

implicitplot(x^2+y^2 = 1, x = -1 .. 1, y = -1 .. 1, scaling = constrained); 1 

 

Plot 

 

These are what you are drawing when you draw level curves.  You start with a function z=f(x,y) and then plot the solutions to several equations, such as f(x,y)=-2, f(x,y)=-1, f(x,y)=0, f(x,y)=1, f(x,y)=2, and so on (of course, depending on f, level curves at other heights might be desirable).  For example, consider the function f(x,y)=x3-y2.  We will plot the level curves at height -2,1,0,1, and 2, by plotting the solutions to the equations x^3-y^2 = -2, x^3-y^2 = -1, x^3-y^2 = 0, x^3-y^2 = 1, x^3-y^2 = 2. 

implicitplot([x^3-y^2 = -2, x^3-y^2 = -1, x^3-y^2 = 0, x^3-y^2 = 1, x^3-y^2 = 2], x = -4 .. 4, y = -4 .. 4, numpoints = 1000, color = [pink, orange, green, blue, magenta]); 1
implicitplot([x^3-y^2 = -2, x^3-y^2 = -1, x^3-y^2 = 0, x^3-y^2 = 1, x^3-y^2 = 2], x = -4 .. 4, y = -4 .. 4, numpoints = 1000, color = [pink, orange, green, blue, magenta]); 1
implicitplot([x^3-y^2 = -2, x^3-y^2 = -1, x^3-y^2 = 0, x^3-y^2 = 1, x^3-y^2 = 2], x = -4 .. 4, y = -4 .. 4, numpoints = 1000, color = [pink, orange, green, blue, magenta]); 1
 

 

Plot 

 

The perceptive student may note that the graph of solutions to an equation such as 0=x3-y looks just the graph of a function (in this case, f(x)=x3).  This can happen when one of the variables can be moved to one side by itself to form y=f(x) (in this case, y=x3).  Little more can be said in this case, except that graphing solutions in case is a bit easier as we can use the techniques from graphing functions, namely trying various values for x and then marking their height f(x).   

We can also graph solutions of equations involving three variables, for example z2+1=x2+y2.  Now you consider all points (x,y,z), plug them each into the equation, and check if the equality holds.  For example, (1,-1,1) is a solution to z2+1=x2+y2 but (2,1,1) is not (check this yourself).  If the equality holds, make a mark at that point.  These marks blend together to make a surface (if the equation is nice).  To plot solutions to equations in three variables, use the implicitplot3d command (also found in the plots package). 

implicitplot3d(z^2+1 = x^2+y^2, x = -3 .. 3, y = -3 .. 3, z = -3 .. 3, style = point, orientation = [45, 75]); 1
implicitplot3d(z^2+1 = x^2+y^2, x = -3 .. 3, y = -3 .. 3, z = -3 .. 3, style = point, orientation = [45, 75]); 1
 

 

Plot 

 

implicitplot3d(z^2+1 = x^2+y^2, x = -3 .. 3, y = -3 .. 3, z = -3 .. 3, style = patchcontour, orientation = [45, 75]); 1
implicitplot3d(z^2+1 = x^2+y^2, x = -3 .. 3, y = -3 .. 3, z = -3 .. 3, style = patchcontour, orientation = [45, 75]); 1
implicitplot3d(z^2+1 = x^2+y^2, x = -3 .. 3, y = -3 .. 3, z = -3 .. 3, style = patchcontour, orientation = [45, 75]); 1
 

 

Plot 

 

When drawing level surfaces, these are what you are drawing.  For example, the level surfaces for the function f(x,y,z)=x2-y+z are in fact solutions to the equations x^2-y+z = kfor various values of k (for example, -2, 1, 0, 1, 2,...). 

 

implicitplot3d([x^2-y+z = -2, x^2-y+z = -1, x^2-y+z = 0, x^2-y+z = 1, x^2-y+z = 2], x = -2 .. 2, y = -2 .. 2, z = -2 .. 5, color = [pink, orange, green, blue, magenta], numpoints = 1000); 1
implicitplot3d([x^2-y+z = -2, x^2-y+z = -1, x^2-y+z = 0, x^2-y+z = 1, x^2-y+z = 2], x = -2 .. 2, y = -2 .. 2, z = -2 .. 5, color = [pink, orange, green, blue, magenta], numpoints = 1000); 1
implicitplot3d([x^2-y+z = -2, x^2-y+z = -1, x^2-y+z = 0, x^2-y+z = 1, x^2-y+z = 2], x = -2 .. 2, y = -2 .. 2, z = -2 .. 5, color = [pink, orange, green, blue, magenta], numpoints = 1000); 1
 

 

Plot 

 

But what about phrases like "the cylinder x2+y2=25" and the like?  We have an equation in two variables, which should have a two-dimensional graph of solutions, but a cylinder is a three-dimensional shape.  From context (e.g. the word "cylinder") we can see that we are supposed to understand x2+y2=25 as an equation in three variables, where the third variable is implied.  If it makes you feel better, consider the equation to be x2+y2+0z=25.  Notice that as we are testing points (x,y,z), really it's only the x and y that matter.  For example, (-3,4,0) is a solution (check this), but so are (-3,4,20), (-3,4,1000), and (-3,4,-100000000).  Thus we end up with a vertical cylinder. 

implicitplot3d(x^2+y^2 = 25, x = -8 .. 8, y = -8 .. 8, z = -10 .. 10, axes = normal); 1 

 

Plot 

 

Notice that if we look at the cross section in the xy plane, we get a circle of radius 5 centered at the origin - exactly the graph of the solutions of x2+y2=25 when taken as a function of two variables. 

Be aware that the term "cylinder" means more than just a circular cylinder as pictured above.  Whenever you plot the solutions of an equation in two variables in three dimensions, the result is called a cylinder.  For example, the solutions to 2-y^2 = z(see below for graph) make a cylinder running in the x direction, where each cross section parallel to the yz-plane looks like the graph of 2-y^2 = zwhen taken as an equation in two variables (or 2-x^2 = yif you insist in your two variables being x and y).   

Cylinder := implicitplot3d(4-y^2 = z, x = -3 .. 3, y = -3 .. 3, z = 0 .. 5, axes = normal, color = turquoise, numpoints = 800, orientation = [28, 77]); -1; Plane := implicitplot3d(x = 0, x = -3 .. 3, ...
Cylinder := implicitplot3d(4-y^2 = z, x = -3 .. 3, y = -3 .. 3, z = 0 .. 5, axes = normal, color = turquoise, numpoints = 800, orientation = [28, 77]); -1; Plane := implicitplot3d(x = 0, x = -3 .. 3, ...
Cylinder := implicitplot3d(4-y^2 = z, x = -3 .. 3, y = -3 .. 3, z = 0 .. 5, axes = normal, color = turquoise, numpoints = 800, orientation = [28, 77]); -1; Plane := implicitplot3d(x = 0, x = -3 .. 3, ...
Cylinder := implicitplot3d(4-y^2 = z, x = -3 .. 3, y = -3 .. 3, z = 0 .. 5, axes = normal, color = turquoise, numpoints = 800, orientation = [28, 77]); -1; Plane := implicitplot3d(x = 0, x = -3 .. 3, ...
Cylinder := implicitplot3d(4-y^2 = z, x = -3 .. 3, y = -3 .. 3, z = 0 .. 5, axes = normal, color = turquoise, numpoints = 800, orientation = [28, 77]); -1; Plane := implicitplot3d(x = 0, x = -3 .. 3, ...
Cylinder := implicitplot3d(4-y^2 = z, x = -3 .. 3, y = -3 .. 3, z = 0 .. 5, axes = normal, color = turquoise, numpoints = 800, orientation = [28, 77]); -1; Plane := implicitplot3d(x = 0, x = -3 .. 3, ...
Cylinder := implicitplot3d(4-y^2 = z, x = -3 .. 3, y = -3 .. 3, z = 0 .. 5, axes = normal, color = turquoise, numpoints = 800, orientation = [28, 77]); -1; Plane := implicitplot3d(x = 0, x = -3 .. 3, ...
 

 

Plot 

 

Parametric Equations 

How do things like space curves and vector-valued functions fit it?  These are graphs of functions, except now the function outputs a vector or a point rather than a height. 

For parametric equations (more properly, parametric functions), say x(t)=4 cos(3t) and y(t)=sin(5t), you plug in various values for t and then mark the point (x(t),y(t)) that results.   Use a variant of the plot command to plot two-dimensional parametric equations. 

plot([4*cos(3*t), sin(5*t), t = 0 .. 2*Pi]); 1 

 

Plot 

 

For an example of a three-dimensional curve, consider r(t) = `<,>`(t, sin(t), cos(2*t)).  To plot r(t), plug in various values for t, and mark the (endpoint of the) vector that results.  Putting these marks together makes a curve.  Use the spacecurve command to plot three-dimensional vector-valued functions. 

spacecurve(`<,>`(t, sin(t), cos(2*t)), t = -2*Pi .. 2*Pi, color = black, thickness = 2, axes = boxed, orientation = [7, 48]); 1
spacecurve(`<,>`(t, sin(t), cos(2*t)), t = -2*Pi .. 2*Pi, color = black, thickness = 2, axes = boxed, orientation = [7, 48]); 1
 

 

Plot 

 

 

Conclusion 

Hopefully this has cleared up any confusions you may have had.  You should notice that there are two ways you can plot f(x,y).  You can either plot z=f(x,y) as a function, or you could plot the level curves.  Be sure you draw what is asked.  There are lots of other kinds of plots out there for you to explore.  For example, information on plotting in polar coordinates can be found in the help menu.   

 

To practice with the above material, try graphing the following functions/equations.  I tried to give interesting curves and surfaces, and I swear I did not make these names up (except the first one).  I have not given ranges for most of these curves/surfaces.  If you enter a plot command and end up with an empty plot (the window shows up, but nothing is plotted), try adjusting your ranges.  You might just be looking in the wrong place. 

1.  f(x,y)=ex cos(y) (what I call " the Sun Chip gone awry"). 

2. (x2-1)(x-1)2+(y2-1)2=0 (called the "bicuspid curve") 

3. `+`(x^4, y^4, z^4, -x^2-y^2-z^2) = 0 (called the "tooth surface") 

4. x = (a-b)*cos(t)+h*cos((a-b)*t/b), y = (a-b)*sin(t)-h*sin((a-b)*t/b)(try various values for a,b, and h to make your very own spirographs). 

5. r(t) = `<,>`((2+cos(1.5*t))*cos(t), (2+cos(1.5*t))*sint(t), sin(1.5*t))for t=0..2*Pi.  (this makes a trefoil knot. If you think of a piece of string in this configuration, you could not get it back to a simple loop without cutting it) 


Created by Andrew Baxter, October 2007.
Please send any corrections, comments, and suggestions to baxter[AT]math.rutgers.edu