Shortest Distance between Two Skew Lines
Select four points , , , in three dimensions to determine two lines (green) and (blue). For almost all choices of coordinates, the lines are skew: neither parallel nor intersecting. The goal is to find the shortest distance between the two lines. As a by-product, the shortest segment between the lines is shown in red.[more]
Write the points as vectors , , , .
The cross-product of the directions of the lines is , which gives a vector perpendicular to both lines. The unit vector in this direction is then . The equations and determine parallel planes through the two lines at distances and from the origin. Therefore, .
Here is one way to find the shortest line segment connecting the two lines. Project the points and to the plane containing the line ; call the projected points and . Let be the intersection of and .
To find the intersection, express the lines in parametric form: and . Set the right-hand sides equal and solve for . Substitute that value of in either equation to find .
Similarly for : Project the points and to the plane containing ; call the projected points ' and . Let be the intersection of and .[less]