For skew lines r = a₁+λb₁ and r = a₂+μb₂, the shortest distance is the projection of (a₂−a₁) onto the common perpendicular direction b₁×b₂.
Derivation
Let the skew lines be L1:r=a1+λb1 and L2:r=a2+μb2.
The common perpendicular: A line perpendicular to both L1 and L2 must be parallel to b1×b2 (perpendicular to both direction vectors). This common perpendicular is unique for skew lines and has the shortest length.
Shortest distance: Let P on L1 and Q on L2 be the endpoints of the common perpendicular. PQ is parallel to b1×b2.
The vector a2−a1 connects one base point to the other. Its projection onto the common perpendicular direction gives the shortest distance:
d=∣b1×b2∣∣(a2−a1)⋅(b1×b2)∣
Cartesian form: For lines (x−x1)/a1=(y−y1)/b1=(z−z1)/c1 and (x−x2)/a2=(y−y2)/b2=(z−z2)/c2: