I think that the easiest way to picture, and so find the shortest distance
between these 2 lines, is through using the equation for a plane.
We will
use the forms Ax + By + Cz = r.n = D where n is a unit
normal to the plane.
Then we have n = (A, B, C). Also, |D|
gives the perpendicular distance from the origin to the plane.
(You may need
to go through my pages on planes to be happy with this. In particular, you may
need equations of
planes in the form Ax + By + Cz = D.)
Now, here's how we use planes to
solve our problem.
Imagine sliding a copy of line L(2) up towards line L(1)
until it intersects with it at P. It doesn't matter what path you take so long
as you keep the direction of L(2) unchanged.
Now, line L(1) and the shifted
line L(2) will lie in a plane, P(1), and the point P with position vector
p lies on this plane.
Also, we can find a normal vector for P(1) by
working out the cross product of d and e. This can be adjusted to
give a unit normal vector for plane P(1) which I'll call n.
We can now
write its vector equation as r.n = p.n =
d1 where |d1| is the perpendicular distance
of plane P(1) from the origin.
Similarly, we can shift a copy of line L(1) until it intersects with line
L(2) at Q. The shifted line L(1) and line L(2) lie in a second plane P(2) with
point Q lying in it. The planes P(1) and P(2) are parallel to each other, and
the n already found is a unit normal vector to P(2) as well.
So the
vector equation of plane P(2) can be written as r.n = q.n =
d2 where |d2| is the perpendicular distance
of plane P(2) from the origin.
The shortest distance between the 2 skew lines
L(1) and L(2) is now given by |d1 - d2|.
The modulus sign matters here because it is taking care of whether the 2
planes are on the same side or opposite sides of the origin.
See my drawing
below showing p.n = d1 and q.n =
d2 in the two cases.
A numerical example
Find the shortest
distance between the two skew lines L(1) and L(2) with equations
r =
(1, 2, 2) + s (4, 3, 2) and r = (1, 0, -3) + t (4, -6, -1).
The point P with position vector p = (1, 2, 2) lies on L(1).
Shifting a copy of L(2) until it intersects with L(1) at P gives plane P(1)
with the point P lying in it.
The point Q with position vector q = (1, 0, -3) lies on L(2).
Shifting a copy of L(1) until it intersects with L(2) at Q gives plane P(2)
with the point Q lying in it.
The cross product of the two direction vectors, (4, 3, 2) and (4, -6, -1)
gives a common normal to both planes.
Working this out gives the vector (9,
12, -36).
So a unit normal vector to both planes is given by 1/13 (3,
4, -12).
The equation of P(1) is 1/13 (3, 4, -12) . r = 1/13
(3, 4, -12) . (1, 2, 2) = -1.
The equation of P(2) is 1/13 (3,
4, -12) . r = 1/13 (3, 4, -12) . (1, 0, -3) = 3.
So the
shortest distance between the 2 skew lines L(1) and L(2) is |-1-3| = 4 units.