Academy
Formulas/maths/3d Geometry/Shortest Distance Between Skew Lines

Shortest Distance Between Skew Lines

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+λb1L_1: \mathbf{r} = \mathbf{a_1}+\lambda\mathbf{b_1} and L2:r=a2+μb2L_2: \mathbf{r} = \mathbf{a_2}+\mu\mathbf{b_2}.

The common perpendicular: A line perpendicular to both L1L_1 and L2L_2 must be parallel to b1×b2\mathbf{b_1}\times\mathbf{b_2} (perpendicular to both direction vectors). This common perpendicular is unique for skew lines and has the shortest length.

Shortest distance: Let PP on L1L_1 and QQ on L2L_2 be the endpoints of the common perpendicular. PQ\overrightarrow{PQ} is parallel to b1×b2\mathbf{b_1}\times\mathbf{b_2}.

The vector a2a1\mathbf{a_2}-\mathbf{a_1} connects one base point to the other. Its projection onto the common perpendicular direction gives the shortest distance:

d=(a2a1)(b1×b2)b1×b2d = \frac{|(\mathbf{a_2}-\mathbf{a_1})\cdot(\mathbf{b_1}\times\mathbf{b_2})|}{|\mathbf{b_1}\times\mathbf{b_2}|}

Cartesian form: For lines (xx1)/a1=(yy1)/b1=(zz1)/c1(x-x_1)/a_1 = (y-y_1)/b_1 = (z-z_1)/c_1 and (xx2)/a2=(yy2)/b2=(zz2)/c2(x-x_2)/a_2 = (y-y_2)/b_2 = (z-z_2)/c_2:

d=x2x1y2y1z2z1a1b1c1a2b2c2b1×b2d = \frac{\begin{vmatrix} x_2-x_1 & y_2-y_1 & z_2-z_1 \\ a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \end{vmatrix}}{|\mathbf{b_1}\times\mathbf{b_2}|}

When lines are parallel (b1×b2=0\mathbf{b_1}\times\mathbf{b_2} = \mathbf{0}): The formula breaks down. Use the point-to-line distance formula instead.

When d=0d = 0: The lines are coplanar (either intersecting or parallel).