Shortest distance between skew lines

Skew lines never meet and are not parallel; the shortest gap is along their common perpendicular.

Key formulas

d = |(P₂−P₁) · n| / |n|
n = d₁ × d₂

What skew means

In 3D, two lines can fail to intersect without being parallel. The common perpendicular is unique and gives the minimum distance.

Vector formula

Direction vectors d₁, d₂ give n = d₁ × d₂. Take any points P₁, P₂ on the lines. Then d = |(P₂−P₁)·n| / |n|.

If they are parallel

Then d₁ × d₂ = 0. Use a different method: distance from a point on one line to the other line.

Worked example

Worked example

Problem. Line 1 passes through (0,0,0) with direction (1,0,0). Line 2 passes through (0,0,5) with direction (0,1,0). Find the shortest distance between them.

Solution. d₁ × d₂ = (0,0,1), |n| = 1. (P₂ − P₁) · n = (0,0,5)·(0,0,1) = 5. Distance = 5/1 = 5. The lines are skew (or parallel in xy sense) with gap 5 along z.

Flag

If n = 0, stop — the lines are parallel, not skew.

Review quiz

Lines through (3,4,6) with direction (2,0,0) and through (3,4,13) with direction (0,2,0). Shortest distance is:

Practice questions

  1. Explain why skew lines cannot lie in one plane.
  2. Write the distance formula in words before symbols.

Study notes

Do skew lines exist in 2D?

No. In a plane, non-parallel lines always meet.

More in Spatial Geometry