Explicit and Implicit Equations
for
Lines and Planes

by
K. D.  Stroyan
University of Iowa

copyright 1997 by Academic Press, Inc. - All rights reserved.

Special Mathematica Functions used in this NoteBook

We told you not to look.  This horrible stuff sets various defaults and defines some functions needed to draw the geometric side of the lexicon.  Ignore the details here and go on to the lesson.

Off[General::spell];
Off[General::spell1];
Off[ParametricPlot3D::ppcom]
Needs["Graphics`Colors`"]

SetOptions[Graphics,Axes->False,AxesOrigin->{0,0},AspectRatio->Automatic];
SetOptions[Graphics3D,ViewPoint->{5,2,1},Boxed->False,AspectRatio->Automatic];
SetOptions[ParametricPlot3D,ViewPoint->{5,2,1},AspectRatio->Automatic];
SetOptions[Plot3D,ViewPoint->{5,2,1},AspectRatio->Automatic];
SetOptions[ParametricPlot,AspectRatio->Automatic];
SetOptions[Plot,AspectRatio->Automatic];

colorQ[a_]:=(Head[a]===RGBColor);
grayQ[a_]:=(Head[a]===GrayLevel);
thickQ[a_]:=(Head[a]===Thickness);
absthickQ[a_]:=(Head[a]===AbsoluteThickness);
notruleQ[u_] := !(Head[u]===Rule);
ruleQ[u_] := (Head[u]===Rule);

Norm::usage = "Norm[expr] returns the Euclidean length of the
		vector, 'expr'.";

Norm[a_?VectorQ] := Sqrt[a.a];

Angle[a_?VectorQ,b_?VectorQ] := ArcCos[(a.b)/(Norm[a] Norm[b])]

Proj[a_?VectorQ,b_?VectorQ] := ((a.b)/(b.b))b

tol = .5*10^-6;

OrthUp[a_?VectorQ] :=
	Module[{b,c,d,f},
		d = N[a/Norm[a]];
		If[Chop[d[[3]]^2 - 1,tol] == 0, b={1,0,0} ,
		b = {0,0,1} - d[[3]] d; b = b/Norm[b];];
	Return[b]];
	
OrthSet[a_?VectorQ] :=
	Module[{b,c,d},
		d = N[a/Norm[a]];
		If[Chop[d[[1]],tol]==0,b={1,0,0},
			 If[Chop[d[[2]],tol]==0,b={0,1,0},
			  b={-d[[2]],d[[1]],0}]];
			b=b/Norm[b];c = Cross[d,b];
	Return[{b,c/Norm[c],d}]];

				
Rotate[a_?VectorQ,theta_] :=
	Module[{u,v,r},
		u = OrthSet[a];
		v = Transpose[u];
		r = N[{{Cos[theta],-Sin[theta],0},{Sin[theta],Cos[theta],0},{0,0,1}}];
	Return[v.r.u]];

Vector2D[tail_,tip_,opts___]:=
	Module[{ntail,ntip,sopts,Punit,up,arrow},
	ntail = N[tail];
	ntip = N[tip];
	
	sopts = Join[Select[{opts},colorQ],Select[{opts},
				thickQ],Select[{opts},absthickQ],Select[{opts},grayQ]];

If[Chop[ntail.ntail+ntip.ntip,tol] == 0,
			(*too small to plot or not number*)
			Return[Graphics[Point[{0,0}]]];
	,						
If[Chop[(ntip-ntail).(ntip-ntail),tol] == 0,
		Return[Graphics[{Join[sopts,{Line[{ntail,ntip}]}]}]];
	,
	Punit = (.075 Norm[ntip-ntail]/Norm[ntip-ntail]) (ntip-ntail) ;
	up = 0.15 {-Punit[[2]],Punit[[1]]};
	arrow = Line[{ntail,ntip,ntip-Punit+up,ntip,ntip-Punit-up}];
	]];
Return[Graphics[{Join[{AbsoluteThickness[2]},Join[sopts,{arrow}]]}]];
];

Vector3D[tail_,tip_,opts___]:=
	Module[{ntail,ntip,sopts,Punit,up,u2,u3,u4,rotmat,arrow},
	ntail = N[tail];
	ntip = N[tip];
	
	sopts = Join[Select[{opts},colorQ],Select[{opts},
				thickQ],Select[{opts},absthickQ],Select[{opts},grayQ]];

If[Chop[ntail.ntail+ntip.ntip,tol] == 0,
			(*too small to plot or not number*)
			Return[Graphics3D[Point[{0,0,0}]]];					
	,		
If[Chop[(ntip-ntail).(ntip-ntail),tol] == 0,
		Return[Graphics3D[{Join[sopts,{Line[{ntail,ntip}]}]}]];
	,
	Punit = (ntip-ntail);
	rotmat = Rotate[Punit,N[Pi/2]];
	up = OrthUp[Punit];
	Punit = .075 Punit;
	up = .15 Norm[Punit] up;
	u2 = rotmat.up;
	u3 = rotmat.u2;
	u4 = rotmat.u3;
	arrow = Line[{ntail,ntip,
				ntip - Punit + up,ntip,
				ntip - Punit + u2,ntip,
				ntip - Punit + u3,ntip,
				ntip - Punit + u4}];
	]];
Return[Graphics3D[{Join[{AbsoluteThickness[2]},Join[sopts,{arrow}]]}]];
];

aRCtAN[y_,x_] := Module[{v},
	If[ Chop[N[x],tol] == 0 ,If[ N[y] < 0, v = -N[Pi/2], v = N[Pi/2]],
		v = N[ArcTan[y/x]];
		If[ x < 0 && y < 0, v = N[Pi -  v],v]];
	Return[v]];

Arc2D[X_,Y_,opts___] := Graphics[{opts,
		Disk[{0,0},1,{Min[
							aRCtAN[
						N[X[[2]]],N[X[[1]]]
								]
							,
							aRCtAN[
							N[Y[[2]]],N[Y[[1]]]
								]
						]
						,
					Max[
							aRCtAN[
						N[X[[2]]],N[X[[1]]]
								]
							,
							aRCtAN[
							N[Y[[2]]],N[Y[[1]]]
								]
						]}
				]}
				];
Arc3D[X_,Y_] := 
	Module[{t,U,V},
		U[V_]:= N[(1/Sqrt[V.V]) V];
		Return[Graphics3D[
		Polygon[Append[Table[U[t X + (1-t) Y],{t,0,1,0.1}],{0,0,0}]]
				]
		]
	];

(*Zero Arrow causes trouble. Put in Vector?*)

Vector[tail_,tip_,opts___]:=
	If[Length[N[tail]]==2,Return[Vector2D[tail,tip,opts]],
		Return[Vector3D[tail,tip,opts]]];
		
Arrow[vec_,opts___]:= 
	Module[{a,b},
				If[Length[N[vec]]==2,
				a=ToExpression["Tail"]/.Select[{opts},ruleQ]/.
					{ToExpression["Tail"]->{0,0}};
				Return[Vector2D[a,a+vec,opts]],
				a=ToExpression["Tail"]/.Select[{opts},ruleQ]/.
					{ToExpression["Tail"]->{0,0,0}};
				Return[Vector3D[a,a+vec,opts]]]
				];

Frame2D[delta_] := 
      Graphics[{
            {Green,Line[{{-delta/4,0},{delta,0}}]},
                    Text["x",{1.01 delta,0}],
            {Green,Line[{{0,-delta/4},{0,delta}}]},
                    Text["y",{0, 1.01 delta}]}];

Frame3D[delta_] := 
      Graphics3D[{
            {Green,Line[{{-delta/4,0,0},{delta,0,0}}]},
                    Text["x",{1.01 delta,0,0}],
            {Green,Line[{{0,-delta/4,0},{0,delta,0}}]},
                    Text["y",{0, 1.01 delta,0}],
            {Green,Line[{{0,0,-delta/4},{0,0,delta}}]},
                    Text["z",{0,0,1.01 delta}]}];

View2D[stuff_,opns___] := Show[stuff,Frame2D[1],opns];
View3D[stuff_,opns___] := Show[stuff,Frame3D[1],opns];

Notebook Overview

Explicit Linear Equations

This NoteBook examines the explicit and implicit equations of lines and planes.  An explicit linear equation has the form

z = m x + n y + b ,  in  3-D

y = m x  + b,  in  2-D,

for constants  m, n, b.  We want you to understand the geometric interpretations of these constants given below

Implicit Linear Equations

An implicit linear equation has the form

a x + b y + c z = k,  in  3-D

a x + b y = k,  in  2-D,

for constants  a, b, c, k.  Again, we want to be able to "read" the geometry from these constants.

A Preview of Chapter 18: Small Changes are Nearly Linear

The main idea of differential calculus is that small changes in smooth functions are approximately linear.  Microscopic views of smooth nonlinear graphs appear to be linear under high magnification.

The total differential is the linear approximation associated with the function, so if we start with an explicit function

z = f[x,y] ,  in  3-D

y = f[x],  in  2-D,

the linear approximation to  f[x+dx,y+dy] - f[x,y]  or  f[x+dx]-f[x] is given by the explicit linear equation

dz = m dx + n dy ,  in  3-D

dy = m dx,  in  2-D,

for constants given by the partial derivatives:  m = ∂f/∂x[x,y],  n = ∂f/∂y[x,y]  or  m = ∂f/∂x[x].

If we start with an implicit function

f[x,y,z] = k ,  in  3-D, k constant

f[x,y] = k,  in  2-D, k constant

the linear approximation is given by the implicit linear equation

a dx + b dy + c dz = 0,  in  3-D

a dx + b dy = 0,  in  2-D,

for constants given by the partial derivatives:  a = ∂f/∂x[x,y,z],  b = ∂f/∂y[x,y,z], c = ∂f/∂z[x,y,z]  or   a = ∂f/∂x[x,y],  b = ∂f/∂y[x,y] in 2-D.

Understanding the geometric role of the constants m, n, a, b, c in the linear problem above will allow us to solve similar geometric problems for the nonlinear problems simply by applying geometry to the total differential.

References to the Text

This NoteBook goes with Section 17.1 on explicit linear equations.

Explicit Lines

The most familiar equation from high school math is probably

y = m x + b

This is an explicit equation for a line called the point-slope form of a line.	The number  m  is the slope of the line, and the number  b  is the point on the y-axis where the line crosses.  We won't labor the point, just draw some examples to illustrate the geometric content of  m  and  b.

Clear[x, y, m, b]; y := m x + b; m = (3/2); b = (3/4); Plot[y, {x, -1, 3}, AxesLabel -> {"x", "y"}, 
      AspectRatio -> Automatic, PlotRange -> {-1, 3}, 
      PlotStyle -> {Red}];

z := n x + c; c = b; n = (2/3); Print["The lines y=", y, "and  y=", z]; Plot[{y, z}, {x, -1, 3}, AxesLabel -> {"x", "y"}, 
      AspectRatio -> Automatic, PlotRange -> {-1, 3}, 
      PlotStyle -> {Red, Blue}]; Print["Equal intercepts, different slopes."];

z := n x + c; m = n; c = (4/3); Print["The lines y=", y, "and  y=", z]; Plot[{y, z}, {x, -1, 3}, AxesLabel -> {"x", "y"}, 
      AspectRatio -> Automatic, PlotRange -> {-1, 3}, 
      PlotStyle -> {Red, Blue}]; Print["Equal slopes, different intercepts."];

Practice Exercise

1)  One line crosses the x-axis at  x = -3 and the y-axis at  y = 1.  Find its point-slope or explicit form.

2)  A second line crosses the y-axis at  y=1 and the x-axis at  x = 2.  Find its point-slope form.

3)  Draw both lines on the same graph.

Explicit Planes

The equation analogous to the point-slope form of a line in two independent variables is

z = m x + n y + b

for constants  m, n, and  b.  If  x = y = 0, then  z = b, so  b has the interpretation as the point where the graph crosses the  z-axis.  We will proceed to develop an interpretation of  m  and  n, first separately, and then as a pair or vector.  The vector  G = {m,n}, called the gradient, is the 2-D analog of the slope  m  in 1-D.  Slope of a plane should be a vector quantity because it has magnitude, given by the steepness, and direction, since the same steepness can point in several directions.

The x-slices and y-slices

If we begin with the equation

z = m x + n y + b

and let  y = 0, we are left with  z = m x + b, a point-slope form of a line in the plane  y = 0:

Clear[x, y, z, m, n, b]; z := m x + n y + b; m = -(1/2); n = -(1/3); b = 1; y = 0; xline0 = 
      ParametricPlot3D[{x, y, z}, {x, 0, 3}, BoxRatios -> Automatic, 
        PlotRange -> {{0, 3}, {0, 3}, {-1, 2}}]; Clear[y]; x = 0; yline0 = 
      ParametricPlot3D[{x, y, z}, {y, 0, 3}, BoxRatios -> Automatic, 
        PlotRange -> {{0, 3}, {0, 3}, {-1, 2}}]; Show[xline0, yline0];

Now suppose we set  y = 1 (or any other constant).  The equation  z = m x + n y + b  becomes the line  z = m x + B  where  B = b + n y = b + n.  This line has the same slope as the xline0 = the linear equation with  y = 0, but has a different  z-intercept.  It lies in the plane  y = 1 (or y = constant).

Similarly if we set  x = 1 (or a constant), z = m x + n y + b  becomes  z = n y + B with  B = b + m.  This line in the plane  x = 1  has the same slope as the  yline0 = the linear equation in the plane  x = 0, but has a different z-intercept and lies in the plane  x = 1.

Let's take a look:

Clear[x]; y = 1; xline1 = 
      ParametricPlot3D[{x, y, z}, {x, 0, 3}, BoxRatios -> Automatic, 
        PlotRange -> {{0, 3}, {0, 3}, {-1, 2}}]; Clear[y]; x = 1; yline1 = 
      ParametricPlot3D[{x, y, z}, {y, 0, 3}, BoxRatios -> Automatic, 
        PlotRange -> {{0, 3}, {0, 3}, {-1, 2}}]; Show[xline0, yline0, xline1, yline1];

Clear[x, y]; plane = 
      Plot3D[z, {x, 0, 3}, {y, 0, 3}, BoxRatios -> Automatic, 
        PlotRange -> {{0, 3}, {0, 3}, {-1, 2}}, 
        ClipFill -> None, DisplayFunction -> Identity]; Show[xline0, yline0, xline1, yline1, plane, 
      DisplayFunction -> $DisplayFunction];

Initial Interpretation of m, n, b

Here is a summary of our computations so far.  The constant  b  is the z-intercept.

The initial interpretation of the constants  m  and  n  is that they are the slopes of the line of intersection between the plane

z = m x + n y + b

and planes  y = constant or  x = constant respectvely.  This is OK, but not the best we can do.

Practice Exercise

Draw the x-lines and y-lines at  y = 0,1 and x = 0,1 as well as the explicit plot of the plane

z = m x + n y + b

for  m = -2/3, n = 1/3, b = 1/2.

Also see the NoteBook SurfSlices.

Table of Slices (Optional)

We could build a picture of a plane simply by making a big table of slices as follows:

Clear[x, y, z, m, n, b]; z[x_, y_] := m x + n y + b; m = -(1/2); n = -(1/3); b = 0; x = 1; ylines = 
      Table[Line[{{-x, y, z[-x, y]}, {x, y, z[x, y]}}], {y, -1, 
          2, 0.25}]; y = 1; xlines = 
      Table[Line[{{x, -y, z[x, -y]}, {x, y, z[x, y]}}], {x, -1, 
          2, 0.25}]; Clear[x, y]; xlines = Graphics3D[{AbsoluteThickness[3], Green, xlines}]; ylines = Graphics3D[{AbsoluteThickness[3], Yellow, ylines}]; grid = {xlines, ylines}; plot = 
      Plot3D[z[x, y], {x, -(2/3), (2/3)}, {y, -(2/3), (2/3)}, 
        BoxRatios -> Automatic, 
        PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, 
        DisplayFunction -> Identity]; Show[plot, grid, DisplayFunction -> $DisplayFunction];

The Gradient G = {m,n} as a Vector "Slope" in 3-D

Suppose we move along the plane  z = m x + n y + b  along any line, not necessarily one parallel to the x  or  y  axis.  Which of these lines has the steepest slope?  The 2-D vector  G = {m,n}  is the direction in the (x,y)-plane that we should move to make  z  increase at the fastest possible rate.  Furthermore, the norm of  G  is the slope of the steepest such  line.  This vector is called the gradient of the function

f[x,y] = m x + n y + b

Since we want to compute a slope, let's compare the value of  f[u,v]  to  f[0,0], where  U = {u,v} is a unit vector.  The change

f[u,v] - f[0,0] = m u + n v = {m,n}.{u,v} = G . U

is given by the dot product of the gradient 2-vector  G  and the arbitrary unit 2-vector  U.

First, we will show the plane as a transparent grid, so we can see above and below it.

Clear[x, y, z, m, n, b]; z[x_, y_] := m x + n y + b; m = -(1/2); n = -(1/3); b = 0; x = 1; ylines = 
      Table[Line[{{-x, y, z[-x, y]}, {x, y, z[x, y]}}], {y, -1, 
          1, 0.25}]; y = 1; xlines = 
      Table[Line[{{x, -y, z[x, -y]}, {x, y, z[x, y]}}], {x, -1, 
          1, 0.25}]; Clear[x, y]; xlines = Graphics3D[{AbsoluteThickness[1], Green, xlines}]; ylines = Graphics3D[{AbsoluteThickness[1], Yellow, ylines}]; grid = {xlines, ylines}; plot = 
      Plot3D[z[x, y], {x, -(1/6), (1/6)}, {y, -(1/6), (1/6)}, 
        BoxRatios -> Automatic, 
        PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, 
        Axes -> None, Boxed -> False, 
        DisplayFunction -> Identity]; grid = 
      Show[plot, grid, ViewPoint -> {5, 1, 1}, 
        DisplayFunction -> $DisplayFunction];

Now we plot a variety of Red unit-length 2-vectors U drawn horizontally in our 3-D view.  The corresponding change in  z  is shown as a Blue vertical vector.  Since the (x,y)-change has unit length, the length of the Blue vector is the absolute value of the slope of the line.

The gradient 2-vector and its negative are shown horizontally in Black and 2-vectors perpendicular to the gradient are shown horizontally in Brown.

Generate this and run the animation.  Notice that:

1) the largest upward Blue change vector occurs when the Red (x,y)-change is in the direction of the positive gradient vector   G,

2)  the longest downward Blue change vector occurs when the Red (x,y)-change is in the direction of the negative gradient vector   G,

3)  the Blue z-change is zero when the Red (x,y)-chage points perpendiculaar to the gradient vector  G.

u[t_] := Cos[t]v[t_] := Sin[t]Do[
      View3D[{grid, Arrow[{u[t], v[t], 0}, Tail -> {0, 0, b}, Red], 
          Arrow[{0, 0, m u[t] + n v[t]}, Tail -> {u[t], v[t], b}, 
            Blue], Arrow[{m, n, 0}, Tail -> {0, 0, b}], 
          Graphics3D[Text["G", 1.2 {m, n, 0}]], 
          Arrow[{-m, -n, 0}, Tail -> {0, 0, b}], 
          Arrow[{-n, m, 0}, Tail -> {0, 0, b}, Brown], 
          Arrow[{n, -m, 0}, Tail -> {0, 0, b}, Brown]}]; 
      , {t, 0, 2 π, (π/12)}];

Gradient Summary

The explicit plane

z = m x + n y + b

slopes upward by an amount  |G|  in the direction of the vector  G ={m,n}.

Proof: (Yup, proof, and you should understand this computation!)

The change in  z when  (x,y)  changes by the unit vector  U = {u,v}  is the length of the vertical Blue vector

G.U = m u + n v

The Cosine of the angle between  G  and  U  is

Cos[ α ] = G . (U/(| G | * | U | ))

so, since |U| = 1, the length of the vertical Blue vector satisfies

G.U = |G| Cos[ α ]

This is largest, Cos[ α ] = 1 and  the z-change = |G|, when  α = 0, or  G and U point in the same direction,

this is smallest, Cos[ α ] = -1 and  the z-change =- |G|, when  α = π, or  G and U point in the opposite direction,

this is 0, Cos[α ] = 0, when  α = 0, or  G and U are perpendicular, or  U is in the direction  {-n,m}  or  {n,-m}.

Practice Exercise

Modify the previous computation to show unit changes and slopes for the explicit plane:

z[x,y] = m x + n y + b

for  m = -2/3, n = 1/3, b = 1/2.

Implicit Lines in 2D

Two vectors  V  and  X  are perpendicular if and only if their dot product is zero,  V.X = 0.  If we know the vector  V = {-2,3}, say, and treat  X = {x,y}  as unknown, the equation

V . X = 0
	{-2,3}.{x,y} = 0
	-2 x +  3 y = 0

says, "The set of unknown position vectors  X  that are perpendicular to the given position vector  V."  In 2-D this is a line through the origin.

Clear[V, X, x, y]; V = {-2, 3}; X = {x, y}; Print["V.X=", V . X, " = 0"]; graph = 
      ContourPlot[V . X, {x, -5, 5}, {y, -5, 5}, 
        Contours -> {0}, AspectRatio -> Automatic, 
        ContourShading -> False, DisplayFunction -> Identity]; 
    line1 = 
      View2D[{graph, Arrow[V, Red], Graphics[Text["V", 1.1 V]]}, 
        DisplayFunction -> $DisplayFunction];

One particular  X  that lies on the line is  X = {3,2}.  (Check: V.X = {-2,3},{3,2} = -6 + 6 = 0.)

line1 = 
      View2D[{graph, Arrow[V, Red], Graphics[Text["V", 1.1 V]], 
          Arrow[{3, 2}, Blue]}, DisplayFunction -> $DisplayFunction];

Lines in 2-D Not through the Origin

Suppose we want the equation for the line perpendicular to  V = {-2,3}, but passing through the point  P = {1,2}.  Let  X = {x,y} be an unknown position vector pointing to the line (from the origin).  The displacement vector from the tip of  P  to the tip of  X  is perpendicular to  V.  The displacement is  (X - P)  and perpendicularity is the statement

V.(X - P) = 0
	{-2,3}.({x,y}-{1,2}) = 0
	{-2,3}.{x-1,y-2} = 0
	-2(x-1) + 3 (y-2) = 0
	-2 x + 3 y = 4

Clear[V, X, P, x, y, k]; V = {-2, 3}; P = {1, 2}; X = {x, y}; k = 4; Print["V.(X-P) =", V . (X - P), " = 0"]; Print["Or V.X = k, ", Simplify[V . (X - P)], " = 0"]; 
    graph = 
      ContourPlot[V . X, {x, -5, 5}, {y, -5, 5}, 
        Contours -> {k}, AspectRatio -> Automatic, 
        ContourShading -> False, DisplayFunction -> Identity]; 
    line2 = 
      View2D[{graph, Arrow[V, Tail -> P, Red], Arrow[P, Blue], 
          Graphics[Text["P", 1.1 P]]}, 
        DisplayFunction -> $DisplayFunction];

One particular  X = Q on this line (besides  P = {1,2})  is the vector  X = Q = {-2,0}.  Note that  Q  is NOT perpendicular to the Red  V, but that the Brown  (Q-P)  is perpendicular to V.  Take a look:

Q = {-2, 0}; line2 = 
      View2D[{graph, Arrow[V, Tail -> P, Red], 
          Graphics[Text["V",  .6 V + P]], Arrow[P, Blue], 
          Graphics[Text["P",  .6 P]], Arrow[Q, Blue], 
          Graphics[Text["Q",  .6 Q]], 
          Arrow[{-3, -2}, Tail -> {1, 2}, Brown], 
          Graphics[Text["Q-P",  .7 (P + Q)]]}, 
        DisplayFunction -> $DisplayFunction];

Show[line1, line2];

Geometric Summary of  a(x-x1) + b(y-y1) = 0

The implicit equation

a (x - x1) + b (y - y1) = 0

for given values of the constants  a, b, x1, y1, is the line through the point

P = {x1,y1}  perpendicular to the vector  V = {a,b}.

Practice Exercise

1)  Sketch the line in 2-D through the origin perpendicular to  {3,4}.  Do this by hand and then by computer.

2)  Sketch the line in 2-D through the point  {1,-2}  perpendicular to  {3,4}.  Do this by hand and then by computer.

Geometry of  k  in  a x + b y = k: Distance to the origin

The equation

a x + b y = k

when  k  is not  zero requires a little more effort to plot.  For example,

-2 x + 3 y = 4

is perpendicular to the vector  V = {-2,3}, but we need to find some point on the lint to plot it.  We can set  y = 0  and solve

-2 x + 0 = 4  =>  x = -2

showing us that  {-2,0}  lies on the line.  Now we draw  V  (in Red) with its tail at  P = {-2,0}  and sketch the perpendicular line:

Clear[V, X, P, x, y, k]; V = {-2, 3}; P = {-2, 0}; X = {x, y}; k = 4; Print["V.(X-P) =", V . (X - P), " = 0"]; Print["Or V.X = k, ", Simplify[V . (X - P)], " = 0"]; 
    graph = 
      ContourPlot[V . X, {x, -5, 5}, {y, -5, 5}, 
        Contours -> {k}, AspectRatio -> Automatic, 
        ContourShading -> False, DisplayFunction -> Identity]; 
    line3 = 
      View2D[{graph, Arrow[V, Tail -> P, Red], Arrow[P, Blue]}, 
        DisplayFunction -> $DisplayFunction];

We compute the distance from the origin to the line.  We need to measure perpendicular to the line.  This is the same as the length of the vector  U  from the origin to the line parallel to  V.  Since  U  is parallel to  V,  U = t V, for some scalar t.  Substitute and solve:

V.X = k
	 V.(t V) = k
	 t = (k/V) . V

|U| = |t V| = |k| ((| V | )/V) . V = ((| k | )/(| V | ))

U = ((k V)/V) . VNorm[U]Abs[k]/Norm[V]line3 = 
      View2D[{graph, Arrow[V, Tail -> P, Red], Arrow[P, Blue], 
          Arrow[U, Blue]}, DisplayFunction -> $DisplayFunction];

Geometric Summary of  a x + b y = k

The implicit equation

a x + b y = k

is the line perpendicular to the direction of  V = {a,b}  translated in the direction of  V  a distance

((| k | )/(| V | ))

from the origin.

Practice Exercise

Suppose we have an equation  V.(X-P) = 0  for a given  V  and  P.

1)  Show that  V.X = k  is the equivalent equation with  k = V.P.

2)  Show that the vector  U  pointing from the origin to the line parallel to  V is the projection of  P  onto  V. (HINT: Look up the projection formula and look at the previous plane.)

3)  How far from the origin is the line in 2-D given by  3 x + 4 y = -5.  Do this by hand and then by computer including a sketch.

Explicit Conversion in 2-D

We can convert an implicit equation  a x + b y = k  to the form  y = m x + c, as long as  b  is not zero.  Here is a computer version.

V = {-2, 3}; P = {1, 2}; Clear[X, x, y, z]; X = {x, y}; eq = V . (X - P) == 0Solve[eq, y]

explicitLine = 
      Plot[((2 (x + 2))/3), {x, -1, 4}, PlotRange -> {0, 5}];

vectorPlot = View2D[{Arrow[P, Red], Arrow[V, Tail -> P, Blue]}];

Show[explicitLine, vectorPlot];

Implicit Planes

Two vectors  V  and  X  are perpendicular if and only if their dot product is zero,  V.X = 0.  If we know the vector  V = {-2,3,4}, say, and treat  X = {x,y,z}  as unknown, the equation

V . X = 0
	{2,-3,4}.{x,y,z} = 0
	2 x -  3 y + 4 z = 0

says, "The set of unknown position vectors  X  that are perpendicular to the given position vector  V."  In 3-D this is a plane through the origin.  Mathematica doesn't have a built-in command to plot implicit equations in  3  variables.  (There is a package.)  We can convert to an explicit equation and graph

3-D Explicit Conversion

Clear[V, X, x, y, z]; V = {2, -3, 4}; X = {x, y, z}; eq = V . X == 0Solve[eq, z]

explicitPlane = 
      Plot3D[(1/4) (-2 x + 3 y), {x, -5, 5}, {y, -5, 5}, 
        AxesLabel -> {"x", "y", "z"}, 
        PlotRange -> {-5, 5}, BoxRatios -> Automatic, 
        Ticks -> None, DisplayFunction -> Identity]; plane1 = 
      View3D[{explicitPlane, Arrow[V, Red], 
          Graphics3D[Text["V", 1.1 V]]}, 
        DisplayFunction -> $DisplayFunction];

One particular  X  that lies on the line is  X = {4,0,-2}.  (Check: V.X = {2,-3,4},{4,0,-2} = 8 + 0 - 8 = 0.)

plane1 = 
      View3D[{plane1, Arrow[{4, 0, -2}]}, 
        DisplayFunction -> $DisplayFunction];

Planes in 3-D Not through the Origin

Suppose we want the equation for the line perpendicular to  V = {2,-3,4}, but passing through the point  P = {2,1,-3}.  Let  X = {x,y,z} be an unknown position vector pointing to the line (from the origin).  The displacement vector from the tip of  P  to the tip of  X  is perpendicular to  V.  The displacement is  (X - P)  and perpendicularity is the statement

V.(X - P) = 0
	{2,-3,4}.({x,y,z}-{2,1,-3}) = 0
	2(x-2) - 3 (y-1)+ 4(z+3) = 0

2 x - 3 y + 4 z = -1

OR explicitly:  z = (-11 - 2x + 3y)/4

Clear[P, V, X, x, y, z]; V = {2, -3, 4}; P = {2, 1, -3}; X = {x, y, z}; eq = V . (X - P) == 0Solve[eq, z]

explicitPlane = 
      Plot3D[(1/4) (-11 - 2 x + 3 y), {x, -5, 5}, {y, -5, 
          5}, AxesLabel -> {"x", "y", "z"}, 
        PlotRange -> {-5, 5}, BoxRatios -> Automatic, 
        Ticks -> None, DisplayFunction -> Identity]; plane2 = 
      View3D[{explicitPlane, Arrow[V, Tail -> P, Red], Arrow[P, Blue], 
          Graphics3D[Text["P",  .6 P]]}, 
        DisplayFunction -> $DisplayFunction];

One particular  X  on this line besides  P = {2,1,-3}  is the vector  X = {-2,0,-1}.  Note that  X  is NOT perpendicular to the Red  V, but that the Black  (X-P)  is perpendicular to V.  Take a look:

X = {-2, 0, -1}; plane2 = 
      View3D[{plane2, Arrow[X, Blue], Arrow[X - P, Tail -> P]}, 
        DisplayFunction -> $DisplayFunction];

Show[plane1, plane2];

Geometric Summary of  a(x-x1) + b(y-y1) + c(z-z1) = 0

The implicit equation

a (x - x1) + b (y - y1)+ c(z-z1) = 0

for given values of the constants  a, b, c, x1, y1, z1, is the plane through the point

P = {x1,y1,z1}  perpendicular to the vector  V = {a,b,c}.

Practice Exercise

1)  Sketch the plane through the origin given by  3x + 2y + 4z = 0  and show that each vector  X  lying in it is perpendicular to the vector  V = {3,2,4}.  Do this by hand and then by computer.

2)  Sketch the plane in 3-D through the point  {1,-2,-1}  perpendicular to  {3,2,4}.  Do this by hand and then by computer.

Geometry of  k  in  a x + b y + c z = k: Distance to the origin

The equation

a x + b y + c z = k

when  k  is not  zero requires a little more effort to plot.  For example,

2 x - 3 y  + 4 z = -8

is perpendicular to the vector  V = {2,-3,4}, but we need to find some point on the lint to plot it.  We can set  x = y = 0  and solve

4 z = 8  => z = -2

showing us that  {0,0,-2}  lies on the plnae.  Now we draw  V  (in Red) with its tail at  P = {0,0,2}  and sketch the perpendicular line:

Clear[P, V, X, x, y, z]; V = {2, -3, 4}; P = {0, 0, -2}; X = {x, y, z}; eq = V . (X - P) == 0Solve[eq, z]

explicitPlane = 
      Plot3D[(1/4) (-8 - 2 x + 3 y), {x, -5, 5}, {y, -5, 
          5}, AxesLabel -> {"x", "y", "z"}, 
        PlotRange -> {-5, 5}, BoxRatios -> Automatic, 
        Ticks -> None, DisplayFunction -> Identity]; plane3 = 
      View3D[{explicitPlane, Arrow[V, Tail -> P, Red], Arrow[P, Blue]}, 
        DisplayFunction -> $DisplayFunction];

We compute the distance from the origin to the plane by measuring perpendicular to the plane.  This is the same as the length of the vector  U  from the origin to the plane parallel to  V.  Since  U  is parallel to  V,  U = t V, for some scalar t.  Substitute and solve:

V.X = k
	 V.(t V) = k
	 t = (k/V) . V

|U| = |t V| = |k| ((| V | )/V) . V = ((| k | )/(| V | ))

k = -8; U = ((k V)/V) . VNorm[U](k/Norm)[V]View3D[{plane3, Arrow[U, Blue]}, 
      DisplayFunction -> $DisplayFunction];

Geometric Summary of  a x + b y + c z = k

The implicit equation

a x + b y + c z = k

is the line perpendicular to the direction of  V = {a,b,c}  translated in the direction of  V  a distance

((| k | )/(| V | ))

from the origin.

Practice Exercise

Suppose we have an equation  V.(X-P) = 0  for a given  V  and  P.

1)  Show that  V.X = k  is the equivalent equation with  k = V.P.

2)  Show that the vector  U  pointing from the origin to the plane parallel to  V is the projection of  P  onto  V. (HINT: Look up the projection formula and look at the previous plane.)

3)	 How far from the origin is the plane-D given by  3 x + 4 y - z = 5.  Do this by hand and then by computer including a sketch.

Distance from the Origin to a Line or Plane

See inside the cells above titled Implicit Lines or Implicit Planes

The Gradient and Contour Maps of z = m x + n y + b

See the NoteBook "LinearContours."

Exercises

Problem 17.1: The Distance from a Point to a Plane

Given a plane  N.X = k, and  point  Q  not on the plane, use vector projection to find the distance from Q to the plane.

HINTS:
Draw the figures that go with the calculations:
given  V.(X-P)=0
project  Q - P onto V,  (Q-P).V/(V.V) V
find |Q - P| = |(Q-P).V|/|V|

Parametric Planes (Optional)

A plane through the tip of  P  parallel to both of the vectors  U  and  V  is given parametrically by

X[s,t] = P + s U + t V

You can prove this yourself by using the geometric meaning of vector sum and scalar multiple.  Try it out:

Clear[P, U, V, X, s, t]; P = {2, 3, 1}; U = {1, 3, 1}; V = {-3, 1, 2}; X[s_, t_] := P + s U + t V; X[s, t]plane = 
      ParametricPlot3D[X[s, t], {s, 0, 2}, {t, 0, 2}, Ticks -> None, 
        AspectRatio -> Automatic, DisplayFunction -> Identity]; 
    View3D[{plane, Arrow[P, Blue], Arrow[U, Tail -> P], 
        Arrow[V, Tail -> P]}, DisplayFunction -> $DisplayFunction];