Skip to content

Mathematics · Ch 9 — Three-Dimensional Geometry

Shortest Distance Between Two Lines

7

Shortest Distance Between Two Lines

What "shortest distance" means. Given two lines L1L_1 and L2L_2 in space, the shortest distance between them is the length of the shortest possible line segment joining a point of L1L_1 to a point of L2L_2 -- equivalently, the length of the unique segment that is perpendicular to both lines simultaneously (the common perpendicular). For two intersecting lines this distance is trivially 00; for two skew lines it is a genuine positive length; for two parallel lines it reduces to the ordinary perpendicular distance between them.

Shortest distance between two skew lines -- derivation. Let L1: r⃗=a⃗1+λb⃗1L_1:\ \vec r=\vec a_1+\lambda\vec b_1 and L2: r⃗=a⃗2+μb⃗2L_2:\ \vec r=\vec a_2+\mu\vec b_2 be two skew lines. Since b⃗1×b⃗2\vec b_1\times\vec b_2 is perpendicular to both b⃗1\vec b_1 and b⃗2\vec b_2 (a defining property of the cross product), it points along the direction of the common perpendicular to both lines -- so the shortest distance is exactly the length of the projection of the vector a⃗2−a⃗1\vec a_2-\vec a_1 (joining a point of L1L_1 to a point of L2L_2) onto this common-perpendicular direction b⃗1×b⃗2\vec b_1\times\vec b_2. The scalar projection of a vector v⃗\vec v onto a direction n⃗\vec n is v⃗⋅n⃗∣n⃗∣\dfrac{\vec v\cdot\vec n}{|\vec n|}, so

d=∣(a⃗2−a⃗1)⋅(b⃗1×b⃗2)∣b⃗1×b⃗2∣∣.d=\left|\frac{(\vec a_2-\vec a_1)\cdot(\vec b_1\times\vec b_2)}{|\vec b_1\times\vec b_2|}\right|.

The absolute value is essential: the scalar triple product (a⃗2−a⃗1)⋅(b⃗1×b⃗2)(\vec a_2-\vec a_1)\cdot(\vec b_1\times\vec b_2) can come out negative depending on the order the two lines are labelled or the direction chosen for b⃗1,b⃗2\vec b_1,\vec b_2, but a distance is always taken to be non-negative -- a sign flip here reflects only a labelling choice, never an error in the lines themselves. If b⃗1×b⃗2=0⃗\vec b_1\times\vec b_2=\vec 0, the lines are parallel and this formula cannot be used (division by a zero vector) -- the parallel-line formula below applies instead. If the numerator itself works out to 00 while b⃗1×b⃗2≠0⃗\vec b_1\times\vec b_2\ne\vec 0, the lines are not skew after all -- a zero shortest distance between non-parallel lines means they actually intersect (Section 6).

In Cartesian form. If L1L_1 passes through (x1,y1,z1)(x_1,y_1,z_1) with direction ratios a1,b1,c1a_1,b_1,c_1 and L2L_2 through (x2,y2,z2)(x_2,y_2,z_2) with direction ratios a2,b2,c2a_2,b_2,c_2, the same formula, written using the scalar triple product as a 3×33\times3 determinant, is

d=∣∣x2−x1y2−y1z2−z1a1b1c1a2b2c2∣∣(b1c2−b2c1, c1a2−c2a1, a1b2−a2b1)∣∣.d=\left|\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}}{\left|(b_1c_2-b_2c_1,\ c_1a_2-c_2a_1,\ a_1b_2-a_2b_1)\right|}\right|. …