# Plotting Planes as Surfaces in MathematicaCopyright © 1997, 2001 by James F. Hurley, University of Connecticut, Department of Mathematics, Unit 3009, Storrs CT 06269-3009.  All rights reserved.

1. Planes whose equations are solvable for z as a function of x and y. As the text mentions, if c ~= 0 it is easy to solve the equation ax + by + cz = d of a plane for z as a function of x and y: z = (d -- ax -- by)/d. Mathematica can easily plot such a plane, as the following routine illustrates for the plane with equation --12x + 9y + 11z = 9. Note that it passes through the point (2, 0, 3) and has normal vector n = (--12, 9, 11) = --12 i + 9 j + 11 k.To see the plot, hit the Enter key at the extreme lower right of the keyboard, or press the Shift and Return keys simultaneously.

(* Mathematica Routine to plot graph of a plane

ax + by + cz = d, where c is not 0 *)

a = -12;
b = 9;
c = 11;
x0 = 2;
y0 = 0;
z0 = 3;
F[x_, y_] := (a x0 + b y0 + c z0 - a x - b y)/c;
Plot3D[ F[x, y], {x, -2, 5}, {y, -2, 10},
AxesLabel -> {"x", "y", "z"} ]

The following more elaborate routine adds coordinate axes (in red).

(* Mathematica Routine to plot graph of a plane

ax + by + cz = d, where c is not 0, with red
coordinate axes *)

a = -12;
b = 9;
c = 11;
x0 = 2;
y0 = 0;
z0 = 3;
F[x_, y_] := (a x0 + b y0 + c z0 - a x - b y)/c;
planeplot = Graphics3D[
Plot3D[ F[x, y], {x, -2, 5}, {y, -2, 10},
AxesLabel -> {"x", "y", "z"} ]
];
coordaxes = Graphics3D[{
{RGBColor[1, 0, 0],
Line[{{-2, 0, 0}, {5, 0, 0}}],
Text["x", {6, 0, 0}]},
{RGBColor[1, 0, 0],
Line[{{0, -2, 0}, {0, 10, 0}}],
Text["y", {0, 11, 0}]},
{RGBColor[1, 0, 0],
Line[{{0, 0, -2}, {0, 0, 9}}],
Text["z", {0, 0, 11}]}
}];
Show[planeplot, coordaxes]

2. Plotting a vertical plane.  The equation of a plane perpendicular to the xy-plane has no z-term. Thus, it is not possible to plot such a plane as the graph of an equation z = F(x, y). However, the following simple parametric approach produces a Mathematica plot, and provides a preview of the important idea of parametric representation of surfaces. The plane has normal vector n = a i + b j + 0 k = (a, b, 0), so the normal-form equation of the plane is

(a i + b j) · [(x -- x i + (y -- y j + (z -- z k] = 0 ,

a(x -- x + b(y -- y = 0

ax + by  = a + b

(1)
ax + by = d ,                                        where d = n ·

In (1), not both a and b are zero, because the normal vector n is nonzero. Thus, one of them is expressible in terms of the other. Suppose that b is nonzero. Then y = d/b -- ax/b = (d -- ax)/b. Since the equation of the plane does not involve z, it can vary over all real numbers. The following triple of parametric equations thus describes the plane:

x = u, y = (d -- au)/b, z = v, where  u (-- ∞, +∞)  and  v (-- ∞, +∞).

Note that there are
two parameters, reflecting the fact that a plane has two dimensions, rather than the single dimension of lines and curves. The following Mathematica routine plots the plane through P(1, 3, 2) with normal vector n = 3 i -- j = (3, -- 1, 0).  Since d = n · for this plane d = (3, -- 1, 0) · (1, 3, 2) = 3 -- 3 = 0.  Execute the routine to see the graph of the plane!

``(* Mathematica Routine to plot graph of a plane      ax + by = d, where b is not 0 *)    a := 3; b := -1; c := 0; x0 := 1; y0 := 3; z0 := 2; d := Dot[{a, b, c}, {x0, y0, z0}] ParametricPlot3D[{u, (d - a u)/b, v}, {u, -4, 4},                  {v, -2, 8},AxesLabel -> {x, y, z} ]    ``

Converted by Mathematica      September 28, 2001