Laboratory 3
Projections, Lines, and Planes

Introduction

    In this lab, we explore the properties of projections. We shall also study equations of lines and planes in space.

Example 3.1, Projections

    Let Overscript[a, ⇀] and Overscript[b, ⇀] be two nonzero vectors (two or three dimensional). The projection of Overscript[b, ⇀] onto Overscript[a, ⇀] is the vector that has the same direction as Overscript[a, ⇀] and together with Overscript[b, ⇀] forms a right triangle. The scalar projection of Overscript[b, ⇀] onto Overscript[a, ⇀] is defined to be the magnitude of the vector projection, and is called the component of Overscript[b, ⇀] along Overscript[a, ⇀].
    We can derive a formula that gives us the component of one vector in the direction of another. Indeed, let Overscript[a, ⇀] and Overscript[b, ⇀] be two nonzero vectors in the plane.

[Graphics:HTMLFiles/index_13.gif]

Then the projection of the vector Overscript[b, ⇀] in the direction of Overscript[a, ⇀] is the black vector in the figure above, while the component of Overscript[b, ⇀] in the direction of Overscript[a, ⇀] is the length of the black vector. Basic trigonometry tells us that the length of the black vector is the same as || Overscript[b, ⇀] || cos θ; however we know that we can find cos θ from the dot product as  cos θ = (Overscript[a, ⇀] · Overscript[b, ⇀])/(|| Overscript[a, ⇀] || || Overscript[b, ⇀] ||). Thus the component of Overscript[b, ⇀] in the direction of Overscript[a, ⇀] is  (Overscript[a, ⇀] · Overscript[b, ⇀])/(|| Overscript[a, ⇀] ||). For convenience, we define the following command to obtain the component of the vector Overscript[b, ⇀] in the direction Overscript[a, ⇀].

comp[b_, a_] := a . b/Sqrt[a . a]

The vector projection of Overscript[b, ⇀] onto Overscript[a, ⇀] is the vector that points in the same direction as Overscript[a, ⇀], but whose length is the component of Overscript[b, ⇀] in the direction of Overscript[a, ⇀]. Since the vector Overscript[a, ⇀]/(|| Overscript[a, ⇀] ||) points in the same direction as Overscript[a, ⇀] but has length 1, we can define the projection of Overscript[b, ⇀] in the direction of Overscript[a, ⇀] as follows.

proj[b_, a_] := comp[b, a] a/Sqrt[a . a]

    To see these ideas in action, let us set Overscript[a, ⇀] = (2, -4) and Overscript[b, ⇀] = (-3, -4). Then we can find the component of Overscript[b, ⇀] in the direction of Overscript[a, ⇀] and the projection of Overscript[b, ⇀] in the direction of Overscript[a, ⇀] as follows.

a = {2, -4} ; b = {-3, -4} ;

comp[b, a]

5^(1/2)

proj[b, a]

{1, -2}

To see this geometrically, we once again load the following 2d and 3d vector drawing commands.

<<Graphics`Arrow` vector[a_, b_, c_:0] := If[c == 0, Return[Graphics[Arrow[a, b]]], Retu ... ], {0, 0, -h}], 0, al, bt], b], Graphics3D[ {Hue[c], Line[{a, b}]}]}] ] ]

We can then plot Overscript[a, ⇀], Overscript[b, ⇀], and the projection of Overscript[b, ⇀] in the Overscript[a, ⇀] direction as follows.

Show[{vector[{0, 0}, a, 0.01], vector[{0, 0}, b, 0.67], vector[{0, 0}, proj[b, a]]}, AxesTrue, PlotRange {{-5, 5}, {-5, 5}}, AspectRatioAutomatic] ;

[Graphics:HTMLFiles/index_54.gif]

Which vector is Overscript[a, ⇀], which is Overscript[b, ⇀], and which is the projection of Overscript[b, ⇀] in the direction of Overscript[a, ⇀] ?

    The projection and component operations are also defined for vectors in three dimensions. Suppose that Overscript[a, ⇀] = (1, -1, 5) and Overscript[b, ⇀] = (3, -2, 2). Then we can find the projection and component of Overscript[b, ⇀] in the direction of Overscript[a, ⇀] as follows.

a = {1, -1, 5} ; b = {3, -2, 2} ;

comp[b, a]

5/3^(1/2)

proj[b, a]

{5/9, -5/9, 25/9}

Show[{vector3d[{0, 0, 0}, a, 0.01], vector3d[{0, 0, 0}, b, 0.67], vector3d[{0, 0, 0},  ... ]}, AxesTrue, PlotRange {{-5, 5}, {-5, 5}, {-5, 5}}, BoxRatiosAutomatic] ;

[Graphics:HTMLFiles/index_69.gif]

Experiment 3.1

    1.  Let Overscript[a, ⇀] = (5, 2) and Overscript[b, ⇀] = (2, 3). Find the projection of Overscript[b, ⇀] in the direction of Overscript[a, ⇀], as well as the component of Overscript[b, ⇀] in the direction of Overscript[a, ⇀]. Graph Overscript[a, ⇀], Overscript[b, ⇀], and the projection of Overscript[b, ⇀] in the Overscript[a, ⇀] direction, and label the results.

    2. Let Overscript[a, ⇀] = (5, 2, -4) and Overscript[b, ⇀] = (2, 3, -2). Find the projection of Overscript[b, ⇀] in the direction of Overscript[a, ⇀], as well as the component of Overscript[b, ⇀] in the direction of Overscript[a, ⇀]. Graph Overscript[a, ⇀], Overscript[b, ⇀], and the projection of Overscript[b, ⇀] in the Overscript[a, ⇀] direction, and label the results.
    
    3.  Let Overscript[a, ⇀] = (4, 2) and Overscript[b, ⇀] = (-2, 3). Find the projection of Overscript[b, ⇀] in the direction of Overscript[a, ⇀], as well as the component of Overscript[b, ⇀] in the direction of Overscript[a, ⇀]. Graph Overscript[a, ⇀], Overscript[b, ⇀], and the projection of Overscript[b, ⇀] in the Overscript[a, ⇀] direction, and label the results.

    4. Let Overscript[a, ⇀] = (3, 2, -4) and Overscript[b, ⇀] = (2, 2, -1). Find the projection of Overscript[b, ⇀] in the direction of Overscript[a, ⇀], as well as the component of Overscript[b, ⇀] in the direction of Overscript[a, ⇀]. Graph Overscript[a, ⇀], Overscript[b, ⇀], and the projection of Overscript[b, ⇀] in the Overscript[a, ⇀] direction, and label the results
    

Example 3.2, Lines and Planes

Lines

    Let L be the line in three dimensional space determined by a point P_0 = (x_0, y_0, z_0) on the line and the direction vector Overscript[v, ⇀] of the line. Then any point P on the line has the form P = P_0 + t Overscript[v, ⇀] for some real number t.FormBox[RowBox[{Cell[], Cell[]}], TraditionalForm]Suppose that we wanted to represent the line through the point P_0 = (1, -2, 4) in the direction Overscript[v, ⇀] = (2, 4, -4). An unknown point on this line P would have the form P = (x, y, z), and would satisfy P = P_0 + t Overscript[v, ⇀]. We can represent this in Mathematica as follows. First we define the points.

P = {x, y, z} ; P0 = {1, -2, 4} ; v = {2, 4, -4} ;

Our equation is then

PP0 + t * v

{x, y, z}  {1 + 2 t, -2 + 4 t, 4 - 4 t}

We used double equals "==" instead of "=" because we want to let Mathematica know that this equality is to hold for all values of t. As a consequence, we conclude that our line has the equations x = 1 + 2t, y = -2 + 4t, z = 4 - 4t. We can then plot the graph of this line with the aid of the Mathematica command ParametricPlot3D in the following fashion.

ParametricPlot3D[Evaluate[P0 + t * v], {t, -5, 5}, BoxRatiosAutomatic, PlotRange {{-10, 10}, {-10, 10}, {-10, 10}}] ;

[Graphics:HTMLFiles/index_130.gif]

Note the use of the Mathematica command Evaluate in the argument of the ParametricPlot3D command.

Planes

    A plane in three dimensional space determined by a point P_0 on the plane and a vector Overscript[n, ⇀] normal to the plane, is described by the vector equation (P - P_0) · Overscript[n, ⇀] = 0 whereFormBox[Cell[], TraditionalForm] P is an arbitrary point on the plane. Suppose that we want to find the plane that passes through the point P_0 = (1, -2, 1) and is normal to the vector Overscript[n, ⇀] = (1, -1/2, 2). First we define the points.

P = {x, y, z} ; P0 = {1, -2, 1} ; n = {1, -1/2, 2} ;

Then we write the equation of the plane just as we did for the line, using double equals "==".

(P - P0) . n0

-1 + x + 1/2 (-2 - y) + 2 (-1 + z) 0

We can simplify the result using the command Simplify.

Simplify[(P - P0) . n0]

8 + y2 x + 4 z

    There are two ways we can draw the graph of the resulting plane. The first method is to use the command Plot3D, which returns the graph of a surface in the form z = z(x, y). To apply this command, we first solve the equation of our plane for z.

Solve[(P - P0) . n0, z]

{{z1/4 (8 - 2 x + y)}}

We can then see that z = 1/4 (8 - 2 x + y). We then plot the result.

Plot3D[1/4 (8 - 2 x + y), {x, -10, 10}, {y, -10, 10}, BoxRatiosAutomatic] ;

[Graphics:HTMLFiles/index_149.gif]

    The first argument of the Plot3D command is the function whose graph we want; the second two arguments are the ranges of the two independent variables, typically x and y. After that follow the options used for the plot; we have used the option BoxRatios->Automatic so that the scale would be the same on each of the three axes. We shall discuss the command Plot3D in more detail in later labs.
    The command Plot3D works well provided the plane can be written as z = z(x, y), but not all planes can be written in this fashion. In particular, the equation of a plane whose normal vector is perpendicular to the z-axis can not be written in this fashion. There is an alternative however. We know that our plane has the equation x + 2 z = 4 + y/2. We can rewrite this as x - y/2 + 2z = 4. Given any function f(x, y, z), we can plot the solution of f(x, y, z) = c by using a contour plot. The appropriate Mathematica command is called ContourPlot3D. We must first load the package.

<<Graphics`ContourPlot3D`

ContourPlot3D[x - y/2 + 2z, {x, -10, 10}, {y, -10, 10}, {z, -10, 10}, Contours {4}, AxesTrue, BoxRatiosAutomatic] ;

[Graphics:HTMLFiles/index_160.gif]

Because we want to plot x - y/2 + 2z = 4, we use the Contours->{4} option. In general, if we want to plot f(x, y, z) = c, we would use the option Contours->{c}.
    Note that the two planes we have generated are the same, even though the hatched lines on the planes are drawn differently.

Applications

    Let us put all of these ideas together, and find the equation of the plane passing through the point P = (1, 2, 3) and perpendicular to the line through P and the point Q = (2, -1, -6). We shall also find the line through P and Q, and we shall also plot both the line and the plane on the same graph. First we name our points.

P = {1, 2, 3} ; Q = {2, -1, -6} ;

Next we find the vector from P to Q. This is the direction vector for our line, and it is also the normal vector for our plane.

n = Q - P

{1, -3, -9}

Every point on our line has the form P + t Overscript[n, ⇀] for some real number t.

P + t n

{1 + t, 2 - 3 t, 3 - 9 t}

Thus the parametric form of our line is x = 1 + t, y = 2 - 3t, z = 3 - 9t. The graph of our line can then be found as before; we call the result A.

A = ParametricPlot3D[Evaluate[P + t n], {t, -10, 10}, BoxRatiosAutomatic, PlotRange {{-10, 10}, {-10, 10}, {-10, 10}}] ;

[Graphics:HTMLFiles/index_181.gif]

If T = (x, y, z) is in our plane, then (T - P) · Overscript[n, ⇀] = 0, so the equation of the plane is

T = {x, y, z} ; (T - P) . n0

-1 + x - 3 (-2 + y) - 9 (-3 + z) 0

Thus, the equation of our plane is x - 3y - 9z = -32. We can graph this using either ContourPlot3D or Plot3D. We shall use the latter, and call the result B.

Solve[(T - P) . n0, z]

{{z1/9 (32 + x - 3 y)}}

B = Plot3D[1/9 (32 + x - 3 y), {x, -10, 10}, {y, -10, 10}, BoxRatiosAutomatic] ;

[Graphics:HTMLFiles/index_190.gif]

We can show the both the plane and the line together using the Show command.

Show[A, B] ;

[Graphics:HTMLFiles/index_192.gif]

Experiment 3.2

    1. Find the equation of the plane passing through the point P = (-5, -3, -2) and perpendicular to the line through P and the point Q = (-7, -4, 6). Then find the equation of the line through P and Q, and plot both the plane and the line on the same graph.
    
    2. Find the equation of the plane passing through the point P = (2, 1, 1) and perpendicular to the line through P and the point Q = (-2, 1, 4). Then find the equation of the line through P and Q, and plot both the plane and the line on the same graph.

Example 3.3, Intersection of Two Planes

    Now we shall use the ideas of the previous two parts to find an equation for the line of intersection of the two planes given by 2x + z = 1 and -x - y - 2z = 0.

    Let Overscript[n, ⇀] _1 and Overscript[n, ⇀] _2 be normal vectors for each of the two planes. From the equations of the planes, we see that Overscript[n, ⇀] _1 = (2, 0, 1) and Overscript[n, ⇀] _2 = (-1, -1, -2). Notice that the normal vectors are not parallel, therefore the intersection of the planes must be a line. Any direction vector of the line of intersection must be orthogonal to the normal vector of each of the two planes. Thus the line of the intersection lies in both planes and is perpendicular to both Overscript[n, ⇀] _1 and Overscript[n, ⇀] _2. Consequently, Overscript[n, ⇀] = Overscript[n, ⇀] _1Overscript[n, ⇀] _2 is a direction vector for the line of intersection.

n1 = {2, 0, 1} ; n2 = {-1, -1, -2} ; n = n1n2

{1, 3, -2}

Now we need to find a point on both planes. Suppose (x, y, z) is a point on both planes; then we know that is must satisfy the equations of each plane. As a consequence,
    2x           + z = 1,
    -x - y - 2z = 0.
These are two equations in three variables, so we expect that there are an infinite number of solutions, one for each value of z. To see that this is the case, let us solve these two equations for x and y, and call the result sol.

sol = Solve[{2x + z1, -x - y - 2z0}, {x, y}]

{{x -1/2 (-1 + z), y -1/2 (1 + 3 z)}}

We can then choose any value of z we wish, and use the above to find the corresponding values of x and y that solve the equations of both planes. For simplicity, let us set z = 0. ThenFormBox[RowBox[{Cell[], Cell[]}], TraditionalForm]

sol /. z0

{{x1/2, y -1/2}}

We see that x = 1/2, y = -1/2, and z = 0 solves the equations of both planes, and hence lies on both planes. Let us call this point P.

P = {1/2, -1/2, 0}

{1/2, -1/2, 0}

Then every point on our line must have the form P + t Overscript[n, ⇀] for some real number t.

P + t n

{1/2 + t, -1/2 + 3 t, -2 t}

Finally, we plot the equations of the two planes, as well as the line on the same graph. We shall use the options DisplayFunction->Identity and DisplayFunction->$DisplayFunction so that we do not see the intermediate steps.

Solve[2x + z1, z] Solve[-x - y - 2z0, z]

{{z1 - 2 x}}

{{z1/2 (-x - y)}}

plane1 = Plot3D[1 - 2x, {x, -10, 10}, {y, -10, 10}, BoxRatiosAutomatic, DisplayFunctio ...  y)/2, {x, -10, 10}, {y, -10, 10}, BoxRatiosAutomatic, DisplayFunctionIdentity] ;

Next, let L be the graph of our line. Note that we use the Hue option and the Thickness option so that our line is more easily seen in the combined graph.

L = ParametricPlot3D[{1/2 + t, -1/2 + 3 t, -2 t, {Hue[0.01], Thickness[0.01]}}, {t, -10, 10},  ... 62754;Identity, BoxRatiosAutomatic, PlotRange {{-10, 10}, {-10, 10}, {-10, 10}}] ;

Finally, we show the net result.

Show[{plane1, plane2, L}, PlotRange {{-10, 10}, {-10, 10}, {-10, 10}}, DisplayFunction$DisplayFunction] ;

[Graphics:HTMLFiles/index_246.gif]

Experiment 3.3a

    1. Find an equation for the line of intersection of two planes given by 3x - y + z = 2 and 2x + y - 2z = 0. Check your work by graphing both planes and the line of intersection.

   
           2. Find an equation for the line of intersection of two planes given by x - 2y + z = 0 and 2x + 3y - 2z = 0. Check your work by graphing both planes and the line of intersection.

Experiment 3.3b

    1.Find an equation for the line of intersection between the plane through a = (5, 1, -8), b = (-6, 2, 7), c = (3, 9, 1) and the plane through e = (-8, 1, 1), f = (4, -7, -3) and g = (-5, -7, -1). Check your work by graphing both planes and the line of intersection.
    
    2.Find an equation for the line of intersection between the plane through a = (1, 2, 3), b = (3, 2, 1), c = (-1, -2, 2) and the plane through e = (1, 2, -3), f = (2, 3, 1) and g = (0, -2, -1). Check your work by graphing both planes and the line of intersection.

Example 3.4, Distance between a Point and a Plane

    Let us find the distance between the point P = (4, 4, 5) and the plane given by x + y + 4z = 8.

[Graphics:HTMLFiles/index_265.gif]

     Let R be the point in the plane so that the distance between the point P and the plane is the same as the distance between P and R. We would like to find the distance between P and R. We know that the vector from P to R points in the same direction as the normal vector to the plane, and we know that the normal is given by Overscript[n, ⇀] = (1, 1, 4). If we could find a point Q in the plane, then we see from the figure above that the distance from P to R will be exactly the component of the vector Overscript[P Q, ⇀] in the direction of Overscript[P R, ⇀]. Since Overscript[P R, ⇀] has the same direction as Overscript[n, ⇀], it is sufficient to find the component of Overscript[P Q, ⇀] in the direction of Overscript[n, ⇀]. To find our point in the plane, let x = 0 and y = 0, and obtain the point Q = (0, 0, 2).
    We begin by defining our variables.

P = {4, 4, 5} ; Q = {0, 0, 2} ; PQ = Q - P n = {1, 1, 4}

{-4, -4, -3}

{1, 1, 4}

The distance we want is the component of Overscript[P Q, ⇀] in the direction of Overscript[n, ⇀], or more precisely the absolute value of the component of Overscript[P Q, ⇀] in the direction of Overscript[n, ⇀]; we have to take the absolute value because Overscript[n, ⇀] might point in the direction from P to R, or it might point in the opposite direction.

Abs[comp[PQ, n]]

(10 2^(1/2))/3

We conclude that the distance from the point to the plane is (10 2^(1/2))/3.

Experiment 3.4

    1.Find the distance between the point P = (1, 0, 5) and the plane given by 2x + y - z = 3.

    2.Find the distance between the point P = (1, 5, -4) and the plane given by 3x - y + 2z = 3.

Example 3.5, Distance between a Point and a Line

    Let us find the distance between the point P = (2, -5, -2) and the line given by x = -1 + 4t, y = 4t, and z = 2 + 5t.

[Graphics:HTMLFiles/index_308.gif]

    Let R be the point on the line closest to P. Choose another point Q on the line; we can do this by setting t = 0 in the parametric form of the line; this gives us the point Q = (-1, 0, 2). Because R is the point on the line closest to P, we know that the triangle P Q R is a right triangle. Thus, if we let Overscript[a, ⇀] be the vector from P to Q, the distance from P to the line is || Overscript[a, ⇀] || sin θ.
    Let Overscript[v, ⇀] = (4, 4, 5) be a vector that points in the same direction as the line; we know that it points in the same direction as the vector from R to Q; thus the angle θ in our figure is the angle between Overscript[v, ⇀] and Overscript[a, ⇀]. However, we know that || Overscript[v, ⇀] Overscript[a, ⇀] || = || Overscript[v, ⇀] || || Overscript[a, ⇀] || sin θ, so that the distance between the point and the line is .

P = {2, -5, -2} ; Q = {-1, 0, 2} ; a = Q - P ; v = {4, 4, 5} ;

Sqrt[va . va]/Sqrt[v . v]

2066/57^(1/2)

Thus the distance from the point to the line is 2066/57^(1/2) .

Experiment 3.5

    1. Find the distance between the point P = (3, -1, 4) and the line given by x = 5 + 3t, y = -2t, and z = 2 - 4t.

    2. Find the distance between the point P = (2, -1, 5) and the line given by x = -1 + 3t, y = 1 + 2t, and z = 2 + 4t.

Example 3.6, Distance between Two Skew Lines

    Let us find the distance between the line through a = (-4, -5, -3), b = (0, -1, 2) and the line through c = (2, 0, -3), d = (3, 4, 3).

    We imagine a plane which contains the line c d, and is parallel to the line a b. The distance between the two lines then is just the distance from any point on the a b to the plane.

[Graphics:HTMLFiles/index_348.gif]

    Let us find the equation of the plane containing c d and parallel to a b. We know that this plane contains the line c d, so the normal to our plane must be perpendicular to the vector from c to d. On the other hand, because the plane is parallel to the line through a and b, we also know that the normal vector must be perpendicular to the vector from a to b. Thus, the normal vector for our plane is Overscript[n, ⇀] = Overscript[a b, ⇀]  Overscript[c d, ⇀].

a = {-4, -5, -3} ; b = {0, -1, 2} ; c = {2, 0, -3} ; d = {3, 4, 3} ;

ab = b - a ; cd = d - c ; n = ab  cd

{4, -19, 12}

    To find the distance between a point on the line a b and the plane, we simply need find a point on the line and a point on the plane, and then take the absolute value of the component of the vector between these two points in the direction of the normal. However, we know that a is on the line a b, while c is in the plane, so we can let our vector Overscript[v, ⇀] be the vector from a to c.

v = c - a

{6, 5, 0}

The distance from the line to the plane is then just the absolute value of the component of Overscript[v, ⇀] in the direction of Overscript[n, ⇀].

Abs[comp[v, n]]

71/521^(1/2)

As the distance between the plane and the line is the same as the distance between the lines, we conclude that the distance between the two lines is 71/521^(1/2).

Experiment 3.6

    1.Find the distance between the line through a = (2, -4, 2), b = (-5, 3, 1) and the line through c = (1, 3, -2), d = (-5, -4, 2).

    2.Find the distance between the line through a = (2, -4, 2), b = (-5, 3, 1) and the line through c = (-1, 3, 4), d = (-5, 5, 2).

Credits

These laboratories were created by Raouf Boules, Geoff Goodson, Ohoe Kim and Mike O'Leary for use in the Calculus courses of Towson University. Commercial use is prohibited without permission of the authors. Non-commercial use is permitted, provided this credit section is retained.


Created by Mathematica  (August 20, 2004)