Lines and Planes in 3D

By C. K. Cheung

The Parametric Equation of a Line Determined by a Vector and a Point

Problem : Find an equation for the line passing through the origin in the direction of the vector

(1, 2, 3) = i + 2j + 3k.

Let us first consider the following vectors :
0.9(1,2,3), 2(1,2,3), 2.5(1,2,3), 3.2(1,2,3), -1.3(1,2,3), -2.2(1,2,3), etc.. (They are multiples of the vector (1, 2, 3).) The following Maple command will show the positions of their endpoints together with the vector (1, 2, 3) (without the arrow head) :

> with (mvcal) : demo(4.1) ;

The line obtained from this formula can be seen with

> demo(4.2) ;

In general, if v is a vector then the line in the direction of v through the origin is given parametrically by L(t) = t v.

What about the equation of a line in the direction of (1, 2, 3) and through the point (0, -1, 3) ?
Geometrically, we have to translate the previous line to the point (0, -1, 3). Mathematically, this means that the line becomes:

t(1,2,3) + (0,-1,3)

To understand what this formula means, let us first notice that (0,0,0),(1,2,3),2(1,2,3)=(2,4,6) and 3(1,2,3)=(3,6,9) are points on the original line. The points (0,-1,3),(1,1,6),(2,3,9) and (3,5,12) are on the new line, they are obtained from:

(0, 0, 0) + (0,-1, 3) = (0, -1, 3),

(1, 2, 3) + (0, -1, 3) = (1, 1, 6),

(2, 4, 6) + (0, -1, 3) = (2, 3, 9)

etc.. This is how we get the "new" points from the "old" points. (To be more precise, when we do

(1, 2, 3) + (0, -1, 3) = (1, 1, 6),

what we actually mean is

(1i+2j+3k) + (0i-1j+3k) = (1i+1j+6k)

. The end point of the position vector gives the coordinates of the "new" point on the "new" line.

In general : If v is a vector and P is a point, then the line in the direction of v passing through P is given parametrically by:

L(t) = t v + P

Here t is a parameter (a real number), so that tv is a scalar multiple of v. When we write +P we really mean + the vector whose initial point is the origin and whose terminal point is P. (See the example above.) The line is traced out by the endpoints of the vectors L(t) as t varies. L(t) is called a "vector-valued function" because it is a rule which associates to each real number t a vector.

If v=(a1,a2,a3),P=(p1,p2,p3), then the above formula for the line becomes:

L(t) = t (a1,a2,a3) + (p1,p2,p3)

= (t a1 + p1, t a2 + p2, t a3 + p3)

= (t a1 + p1) i + (t a2 + p2) j + (t a3 + p3) k

Sometimes we prefer to write the coordinates of as and write down the formula for the coordinates separately :

x = t a1 + p1, y = t a2 + p2, z = t a3 + p3

Example 1.1

Find the parametric equation of the line in the direction of the vector v = i + 2 j through the point (1,-1). Plot this line using Maple.
Solution:
The equation is

L(t)=t(1,2)+(1,-1)=(t+1,2t-1)=(t+1)i+(2t-1)j

or x = t+1, y = 2t-1.
(This example does not involve the z-coordinate.)

To plot a line on the x-y plane, we have to use the plot command :

> plot ([formula for x, formula for y, range of t]);

> plot([t+1,2*t-1,t=-5..5]);

Be sure to check that the line does pass through the point (1,-1) (click the mouse and locate it).

Example 1.2:

Find the parametric equation of the line in the direction of v=i-2j+3k through the point (2,1,-1). Plot this line using Maple.
Solution:
The line is L(t)=t(1,-2,3)+(2,1,-1)=(t+2,-2t+1,3t-1),
or x=t+2,y=-2t+1,z=3t-1.

To plot a curve in space we need to use the command spacecurve, and it is used in the form :

> with (plots) ;

> spacecurve([formula for x, formula for y, formula for z],range of t);

In the first version of Maple V, the spacecurve program is unreliable, so we have to use another command to draw lines or curves in space :

> plot3d([formula for x, formula for y, formula for z],range of t , s=0..1);

All the troubles with the spacecurve program have been fixed in Maple V release 2, so users with the new version can choose either command. The picture for our line is :

> with(plots) ; spacecurve( [t+2, -2*t+1, 3*t-1], t=-4..4 ) ;

#or

> plot3d( [t+2, -2*t+1, 3*t-1], t=-4..4, s=0..1) ;

or if you'd like to see the line in a box :

> plot3d( [t+2, -2*t+1, 3*t-1], t=-4..4, s=0..1, axes=BOXED) ;

#If you are using Maple V release 2 (or higher), you can even assign colour to your line :

> spacecurve( [t+2, -2*t+1, 3*t-1], t=-4..4, colour = GREEN ) ;

Notice how the plot3d and spacecurve commands are different from the plot command:

1. Range of t is written outside the square brackets [ ] ,
2. In plot3d, we have to type s=0..1. This is a "dummy range"; the parameter, s, is not actually involved in the formula of the curve.

Example 1.3:

Find the parametric equation of the line through (2,1,-1) in the direction of w=-2i+4j-6k. Plot with Maple and compare with example 1.2.
Solution:
or , .

> spacecurve ( [-2*t +2, 4*t+1, -6*t -1], t=-2..2) ;

#or

> plot3d( [-2*t +2, 4*t+1, -6*t -1], t=-2..2, s=0..1) ;

Compare with the previous example and notice that these two lines are exactly the same, although they have different equations. (The two lines are the same because they pass through the same point, (2,1, -1) and are "inclined" in the same manner; one is pointing at v and the other is pointing at w=-2v . )

Warning :

The same line can have different formulae.
For example : x = t + 3, y = -2t -1, z = 3t +2 will also give the same line as in example 1.2 and 1.3.

> spacecurve ( [t+3, -2*t-1, 3*t+2], t = -4..4);

or

> plot3d( [t+3, -2*t-1, 3*t+2], t = -4..4, s=0..1);

#Section 2 : Parametric Equation of the Line through Two Points Example 2.1 : Find a parametric equation for the line through the points A = (0,1,3) and B= (2,1,-1). Solution: This line is parallel to the vector = (2, 1, -1) - (0, 1, 3) = (2, 0, -4) and passes through A = (0,1,3). Using the formula in Section 1, the equation of the line is : .

> spacecurve([ 2*t, 1, -4*t+3], t=-2..2) ;

#or

> plot3d([ 2*t, 1, -4*t+3], t=-2..2, s=0..1) ;

#Or we can use B= (2,1,-1) as the point the line passes through, in which case the equation of the line is: .

> plot3d([ 2*t+2, 1, -4*t-1], t=-2..2, s=0..1) ;

#The two lines are the same. The above example shows how to find a line passing through two given points. But usually we are just required to find the equation of a line segment joining two points instead of the whole line. Let , be two points in space. The equation of the line segment joining P to Q, with P as the starting point and Q as the end point, is given by : Then when t = 0, (time = 0) , the line is at = (1 - 0) P + 0Q = P, when t = 1, (time = 1) , the line is at = Q. So the starting point is P and the end point is Q as required. Example 2.2 : The equation for the line segment joining (-3, 2, -3) to (1, -1, 4) is given by : ( 1 - t) (-3, 2, -3) + t (1, -1, 4) = (-3 + 4 t, 2 - 3 t, -3 + 7 t), .

> plot3d( [ -3 + 4*t, 2 -3*t, -3 +7*t], t=0..1, s=0..1, axes = BOXED );

#Section 3 : The Equation of a Plane Using dot products we can write down the equation of a plane in 3-space easily. A Plane through the Origin Problem : Let . Find a plane passing through the origin and perpendicular to . Let us first look at the vectors that are perpendicular to ; here are some of them : (-1,1,0) (because (-1,1,0) (1,1,3) = 0 ) , (0,-3,1) (because (0,-3,1) (1,1,3) = 0 ) , (-2,-1,1) (because (-2, -1, 1) (1, 1, 3) = 0), (5,-2, -1) , (5,4,-3), (-4, -5, 3), (1,5,-2), (0.5, -2, 0.5), (-5,0.5,1.5), (-0.5, -1, 0.5), (1,2, -1), (2,-5,-1), (1,2,-1) etc.............. The following picture shows the vector (with an arrow head) and the "perpendicular vectors".

> with(mvcal) ; demo(4.3) ;

#(Fig. 5) >From the picture, we see that these perpendicular vectors "almost" formed the required plane. So to form a plane that is perpendicular to , we have to include all vectors that are perpendicular to . If is a point on that plane, then the vector has to be perpendicular to . This means , or equivalently, x + y + 3 z = 0, which is the equation of the required plane . In general, suppose that is the vector . Then the equation of the plane that is perpendicular to and passes through the origin is given by : , or equivalently, . Example 3.1 : If = (1, -1, 2), then the plane through the origin and perpendicular to the vector has equation A Plane through an Arbitrary Point Problem : Find a plane passing through the point P = (1, 2, 5) and perpendicular to = ( 1, 1, 3). The trick is very similar to what we did earlier. If A= is a point on the desired plane, then the vector is perpendicular to . (See the picture on the next page.). So we have : , or . Equivalently : This is the equation of the desired plane. Example 3.2 : Find the equation of the plane which passes through (1, 2, 3) and is perpendicular to the vector (-1, 1, 2). Solution : . or , . In Maple a picture of the plane, , can be drawn with the command:

> plot3d(A*x + B*y + C, x=x0..x1, y=y0..y1) ;

#Of course you have to specify the A, B and C for your plane and tell Maple how big a picture you want by specifying x0, x1, y0 and y1. For example 3.2 we solve for z to get .

> plot3d(7/2 + x/2 -y/2 , x=-5..5, y=-5..5, axes = BOXED);

#(Fig. 6) Example 3.3 : If determines a plane, we may read off directly from the formula that it is perpendicular to the vector (2, -1, 1). (If you do not know how we get the vector (2, -1, 1), read the formula in the box and example 3.2 carefully.) So are the planes , , . Hence, these planes are parallel to each other.

> vector := plot3d( [2*t, -1*t, 1*t], t=0..1, s=0..1, grid =[2,2]) :

> planes := plot3d( { -5 -2*x +y, 3 -2*x +y, -1 -2*x +y, (-4 -4*x +2*y)/2 },

x=-1.5..1, y=-1.5..1, grid = [4,4], scaling = CONSTRAINED, orientation = [40,80]):

> with(plots) :

> display3d({vector, planes} ) ;

#(Fig. 7) A vector perpendicular to a plane is called a normal to a plane. In example 3.2, (-1, 1, 2) is a normal to the plane . In example 3.3, (2, -1, 1) is normal to the plane . A Plane through Three Points Example 3.4 : Find the equation of the plane that passes through the points A(1, -1, 1), B(2,0, 0) and C(1,1,0). Solution : To write down the equation of a plane, we need to find its normal and a point it passes through. We first notice that the vectors , lie on the plane, so the normal is perpendicular to both and and is given by . (We have emphasized in Section 7 of Module 2 that is perpendicular to both and . ) The equation of the plane with normal (1, 1, 2) passing through A(1, -1, 1), is given by : , or , .

> plot3d( (2 - x - y)/2, x=-3..3, y=-3..3) ;

#Section 4 : Intersection of Lines and Planes Question 1 : When will two lines in space intersect each other ? We learned in high school geometry that two lines on a plane will intersect if the lines are not parallel. Can this be true for lines in space too? Look at the following lines : : , : . is pointing in the direction of (2, 3, 1) and is pointing in the direction of (-3, 2, 0), they are not parallel, but they do not intersect either, as you can see from the picture :

> line1 := plot3d( [2*t +1, 3*t -2, t +1], t=-3..3, s=0..1, grid =[2,2]) :

> line2 := plot3d( [-3*t +2, 2*t -1, 1], t= -5..5, s =0..1, grid =[2,2],

orientation=[11, 73]) : with( plots) : display3d( {line1, line2} ) ; #(Fig. 8) Now look at the lines : , .

> line3 := plot3d( [2*t +1, 3*t +2, t +3], t=-3..3, s=0..1, grid =[2,2]) :

> line4 := plot3d ( [-3*t -3, 2*t +9, 4], t=-3..3, s=0..1, grid = [2,2]) :

> display3d ( {line3, line4} ) ;

#(Fig. 9) and have the same directions as and , but they intersect each other at the point (3, 5, 4) (locate from the picture). So for lines in space, their directions alone cannot determine if they will intersect . If is the intersection point for and , then it will satisfy the formulae for both lines. So to find the intersection points, we have to solve the equations of and simultaneously. However, the following procedure is a common mistake. One may try to solve the equations : , . (The first three equations are from and the others are from .)

> solve( {x=2*t+1, y=3*t+2, z=t+3, x=-3*t-3, y=2*t +9, z=4}, {x, y, z, t} ) ;

#But Maple gives no solution to this. What goes wrong ? It is wrong because your equations required that the parameter t in be the same parameter t in , (you used the same t in both expressions) and that is not necessary the case. For example, in drawing the picture for and , we can replace our previous command by :

> line4 := plot3d ( [-3*s -3, 2*s +9, 4], t=0..1, s=-3..3, grid = [2,2]) :

#Replace t by s for the parameter of .

> display3d( {line3, line4} ) ;

#It shows us the same picture. So to find the intersection points, we should instead solve the equations : ,

> solve( {x = 2*t +1, y =3*t +2, z = t+3, x =-3*s-3, y=2*s+9, z= 4},{x, y, z,s,

t}) ; #So the intersection point is (3, 5, 4), it occurs at t = 1 on and at s = -2 on . Question 2 : When will a line and a plane intersect each other ? The only case in which a line fails to intersect a plane occurs when the line is parallel to the plane, and not lying in it. This happens when a direction vector for the line lies in the plane, that is when it is perpendicular to a normal to the plane. Example 4.1 : Consider the line : and the plane . is pointing in the direction of (-3, 2, 1), which is perpendicular to the normal of the plane , (1, 1, 1) (because the dot product of the two vectors is 0). (-1, -2, -1) is a point on the line, but it does not satisfy the equation , so the line is not lying on the plane. Therefore this line will not intersect the plane. You can see this from the picture :

> line := plot3d( [-3*t -1, 2*t -1, t -1], t=-5..5, s=0..1, grid =[2,2]) :

> plane := plot3d( 3 -x -y, x=-3..3, y=-3..3,orientation= [103,110]) :

> display3d( {line, plane} ) ;

#(Fig. 10)

> solve( {x=-3*t-1, y=2*t-2, z=t-1, x+y+z =3}, {x, y, z, t} ) ;

#will not give you an answer. Example 4.2 : The line and the plane must intersect, because the direction of the line is not perpendicular to the normal of the plane.

> plane2 := plot3d( 3 -x -2*y, x=-5..5, y=-5..5, orientation=[-147,106]) :

> display3d( {line, plane2} ) ;

#(Fig. 11)

> solve ( { x = -3*t -1, y =2*t -2, z =t -1, x+2*y +z =3}, {x, y, z, t}) ;

Question 3 : When will two planes intersect each other ? If two planes are parallel, they will not intersect each other, and that is the case only when their normals are parallel (cf. example 3.3). Example 4.3 : The planes and will intersect each other because their normals, (-2, 1, -1) and (1, 2, 1), are not parallel.

> plot3d( { -2*x +y -1, 2 -x -2*y}, x= -3..3, y=-3..3) ;

#(Fig. 12)

> solve ( {-2*x+y-z =1, x + 2*y +z =2}, {x, y, z} ) ;

#So they intersect in the line : . Note: If you want to draw a curve in the x-y plane , use the "plot" command. If you want to draw a curve or line in space, you can use either the "spacecurve" or the "plot3d" command. If you want to draw a plane or a surface (discussed later), you need to use "plot3d" command. Be careful with these, it can get confusing.