Sunday, 13 June 2010

What's the Point

When I talked about the vector (or parametric) equations of a line, I failed to touch on one of the common questions from early linear algebra; to find the point where the two lines intersect.

When we have L1 = P + t U and L2 = Q + r V for direction vectors U and V, and point vectors P and Q, the two lines lie in a single plane (and thus intersect) if (P-Q), U, and V are form a dependent system. If there is a point where L1 and L2 are equal, then P + t U=Q + r V.
Reordering this we get (P-t) = rV-tU. This says that if there is a solution, there must be a linear combination of V and U that equals (P-Q) or that the three vectors form a dependent system. Remember back to Alg II when you learned about determinants and recall that if the determinant of a nxn matrix was =0, the system was called a dependent system. And hopefully you knew that meant there was a way to combine multiples of n-1 of the vectors to get the remaining one.

A linear combination of three vectors U, V, and W would be something like aU + bV + cW; and focusing on three space; if three vectors are all independent (they have a non-zero determinant) then you can use a linear combination of the three of them to find any point in three space. But if they are dependent (the determinant is zero) then a linear combination of the three vectors can only generate points on a plane or in extreme cases, on a line.

I will use the following two lines L1: (4,1,5)+t<1, -1, 2> and L2: (8,9,4)+r<2,2,1> to illustrate how to find the intersection.
We first need to know if there is actually an intersection so we construct the matrix with the vectors (P-Q), U, and V.. In this example (P-Q) = 4,8,-1; U= 1,-1, 2; and V= 2,2,1. When we find the determinant it is zero.
This means that P-Q can be written as some linear combination of U and V for appropriate values of t and r.

To find the value of t and r that will produce the linear combination, we set two of the parametric equations equal. For example, 4+t = 8+2r from the first (x) terms and 5+2t = 4+r from the third (z) can be rewritten as the system 2r-t=-4 and r-2t=1. A solution is r=-3, t=-2.

If we insert these into L1: (4,1,5)+t<1, -1, 2> and L2: (8,9,4)+r<2,2,1> we get L1: (4,1,5)-2<1, -1, 2> and L2: (8,9,4)-3<2,2,1>; both yielding the point (2,3,1) for a common point to both lines.

And that is really all there is to finding the intersection of two lines; but the idea also lets you do something a little more complex. You can use it to help find the shortest line segments between two skew lines.

But if instead we had L1=(4,1,5)+t<1, -1, 2>and L2= (3,4,4)+r<2,2,1>, then the determinant of the Matrix formed with vectors (P-Q), U, and V) would have a determinant of -10

which means that there is no linear combination of U and V that will give us P-Q. The
geometrical interpretation is that lines L1 and L2 are skew lines, lines that are not in the same plane.

It is possible to find the two parallel Planes that contain the two lines by using the cross product of the two direction vectors. The cross product of <1, -1, 2> and <2,2,1> is <5, -3, -4> so each plane can be written as 5x - 3y - 4 z = d for some d. The value of d for each line is the dot product of <5, -3, -4> with any point on the respective lines. For example the dot product of <5, -3, -4> and (4,1,5) is -3, so the equation of the plane containing L1 is 5x - 3y - 4 z = -3. Similarly we can find that L2 lies in the plane 5x - 3y - 4 z = -13. If we divide the difference, 10, by the unit vector in the direction <5, -3, -4>, (sqrt(50)), we find the distance between the two planes is sqrt(2). It should be easy to see that this will be the smallest distance between any two points on the respective lines.

To find the endpoints of this shortest segment between L1 and L2, we can imagine moving them onto the same plane and finding the point of intersection, and then use that intersection to find the points on the original lines.

To move the point (3,4,4) on L2 some number of units perpendicular to the two planes, we create the values (x,y,z)= (3,4,4)+s<5, -3, -4>

If this point is to be on the plane 5x - 3y - 4 z = -3 which L1 is on, it must be true that 5(3+5s) -3(4-3s) - 4(4-4s) = -3. This will simplify to 15 + 25 s - 12 + 16s -16 + 16s = -3 or 50 s = 10.

So s=1/5 and the new equation for L1 on the same plane as L2 is (x,y,z)= (3,4,4)+1/5 <5, -3, -4> + r<2,2,1> . That can be simplified down to (x,y,z)= (4, 3.4, 3.2)+r(2,2,1). Solving for the values of r and t that give an intersection we get 4+2r = 4+t so t=2r from the x(t) relations of the two lines.. and from z(t) we get 3.2+r = 5+2t and substituting t=2r; 3.2+r = 5+4r so 3r=-1.8 or r= -.6 and t=-1.2

The point of intersection in this common plane is (4, 3.4, 3.2) -.6<2,2,1>= (2.8,2.2, 2.6) and checking to be sure...(4,1,5)-1.2<1, -1, 2>=(2.8,2.2, 2.6), so all appears well.


Now we can apply these same parametric values (r=-.6 and t=-1.2) to find the end points on the original lines at (4,1,5)-1.2<1, -1, 2> = (2.8,2.2, 2.6) on the plane containing L1 and and (3,4,4)-.6<2,2,1>= (1.8, 2.8, 3.4). Just one last check to make sure that these are indeed a distance of sqrt(2) apart, we take the dot-product of the vector from one point to the other <2.8-2, 2.2-2.8, 2.6-3.4> and indeed we get a dot product of 2.
Post a Comment