Skew Lines, and the Distance between Them

In a plane, two distinct lines either intersect or are parallel. In space there is a third possibility: skew lines — lines that are neither parallel nor intersecting. They lie in different planes, like a road and an overhead flyover crossing above it.

For intersecting lines the shortest distance is 00; for the other cases there is a unique common perpendicular — the segment PQPQ meeting both lines at right angles — and its length is the shortest distance.

Two skew lines with the common perpendicular segment and both formulas

The skew-lines formula

For r⃗=a⃗1+λb⃗1\vec{r} = \vec{a}_1 + \lambda\vec{b}_1 and r⃗=a⃗2+μb⃗2\vec{r} = \vec{a}_2 + \mu\vec{b}_2:

d=∣(b⃗1×b⃗2)⋅(a⃗2−a⃗1)∣∣b⃗1×b⃗2∣d = \frac{\left|\left(\vec{b}_1 \times \vec{b}_2\right)\cdot\left(\vec{a}_2 - \vec{a}_1\right)\right|}{\left|\vec{b}_1 \times \vec{b}_2\right|}

Why it works: the common perpendicular is perpendicular to both directions, so it points along n^=b⃗1×b⃗2∣b⃗1×b⃗2∣\hat{n} = \dfrac{\vec{b}_1 \times \vec{b}_2}{\left|\vec{b}_1 \times \vec{b}_2\right|}. The distance is the projection of the joining vector a⃗2−a⃗1\vec{a}_2 - \vec{a}_1 on this unit normal — a scalar triple product over a cross-product magnitude.

Key Point (the coplanarity test hiding inside): the numerator (b⃗1×b⃗2)⋅(a⃗2−a⃗1)\left(\vec{b}_1\times\vec{b}_2\right)\cdot\left(\vec{a}_2-\vec{a}_1\right) is the scalar triple product [b⃗1 b⃗2 a⃗2−a⃗1]\left[\vec{b}_1\ \vec{b}_2\ \vec{a}_2-\vec{a}_1\right]. It vanishes exactly when the two (non-parallel) lines are coplanar, i.e. intersecting. So the same computation answers both "how far apart?" and "do they meet?" — d=0d = 0 means they intersect.

Parallel Lines, and the Exam Workflow

Parallel-lines formula

Parallel lines share a direction b⃗\vec{b}, so b⃗1×b⃗2=0⃗\vec{b}_1 \times \vec{b}_2 = \vec{0} and the skew formula breaks down. Instead, drop a perpendicular from any point of one line to the other:

d=∣b⃗×(a⃗2−a⃗1)∣∣b⃗∣d = \frac{\left|\vec{b} \times \left(\vec{a}_2 - \vec{a}_1\right)\right|}{\left|\vec{b}\right|}

(the cross product's magnitude is ∣a⃗2−a⃗1∣∣b⃗∣sin⁡θ\left|\vec{a}_2 - \vec{a}_1\right||\vec{b}|\sin\theta, and dividing by ∣b⃗∣|\vec{b}| leaves exactly the perpendicular offset).

The workflow, every time

  1. Extract a⃗1,b⃗1,a⃗2,b⃗2\vec{a}_1, \vec{b}_1, \vec{a}_2, \vec{b}_2 — converting Cartesian or parametric forms to standard form first.
  2. Check parallelism: are b⃗1,b⃗2\vec{b}_1, \vec{b}_2 proportional? Yes → parallel formula. No → skew formula.
  3. Skew route: compute b⃗1×b⃗2\vec{b}_1 \times \vec{b}_2 (determinant), dot with a⃗2−a⃗1\vec{a}_2 - \vec{a}_1, divide by the cross's magnitude, absolute value on top.
  4. Interpret d=0d = 0: the lines intersect.

Key Point (three traps): (1) the numerator's modulus — a negative triple product just means the normal points the other way; (2) subtracting the anchor points in a consistent order (a⃗2−a⃗1\vec{a}_2 - \vec{a}_1 throughout — flipping only changes the sign the modulus removes anyway, but mixing coordinates mid-computation is fatal); (3) a line given parametrically like r⃗=(1−t)i^+(t−2)j^+(3−2t)k^\vec{r} = (1 - t)\hat{i} + (t - 2)\hat{j} + (3 - 2t)\hat{k} must be regrouped as a⃗+tb⃗\vec{a} + t\vec{b} — here a⃗=(1,−2,3)\vec{a} = (1, -2, 3) and b⃗=(−1,1,−2)\vec{b} = (-1, 1, -2) — before anything else.

Solved Examples

Example 1: The standard skew computation

Find the shortest distance between r⃗=i^+j^+λ(2i^−j^+k^)\vec{r} = \hat{i} + \hat{j} + \lambda\left(2\hat{i} - \hat{j} + \hat{k}\right) and r⃗=2i^+j^−k^+μ(3i^−5j^+2k^)\vec{r} = 2\hat{i} + \hat{j} - \hat{k} + \mu\left(3\hat{i} - 5\hat{j} + 2\hat{k}\right).

Solution:

  1. Cross the directions: b⃗1×b⃗2=∣i^j^k^2−113−52∣=3i^−j^−7k^\vec{b}_1 \times \vec{b}_2 = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ 2 & -1 & 1 \\ 3 & -5 & 2 \end{vmatrix} = 3\hat{i} - \hat{j} - 7\hat{k}, magnitude 9+1+49=59\sqrt{9 + 1 + 49} = \sqrt{59}.
  2. Joining vector: a⃗2−a⃗1=i^−k^\vec{a}_2 - \vec{a}_1 = \hat{i} - \hat{k}.
  3. Triple product: (3)(1)+(−1)(0)+(−7)(−1)=10(3)(1) + (-1)(0) + (-7)(-1) = 10.

Answer: d=1059d = \dfrac{10}{\sqrt{59}}.


Example 2: Parallel lines

Find the distance between r⃗=i^+2j^−4k^+λ(2i^+3j^+6k^)\vec{r} = \hat{i} + 2\hat{j} - 4\hat{k} + \lambda\left(2\hat{i} + 3\hat{j} + 6\hat{k}\right) and r⃗=3i^+3j^−5k^+μ(2i^+3j^+6k^)\vec{r} = 3\hat{i} + 3\hat{j} - 5\hat{k} + \mu\left(2\hat{i} + 3\hat{j} + 6\hat{k}\right).

Solution:

  1. Same direction b⃗=(2,3,6)\vec{b} = (2, 3, 6), ∣b⃗∣=7|\vec{b}| = 7 — use the parallel formula.
  2. Joining vector: a⃗2−a⃗1=2i^+j^−k^\vec{a}_2 - \vec{a}_1 = 2\hat{i} + \hat{j} - \hat{k}.
  3. Cross: b⃗×(a⃗2−a⃗1)=∣i^j^k^23621−1∣=−9i^+14j^−4k^\vec{b} \times \left(\vec{a}_2 - \vec{a}_1\right) = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ 2 & 3 & 6 \\ 2 & 1 & -1 \end{vmatrix} = -9\hat{i} + 14\hat{j} - 4\hat{k}, magnitude 81+196+16=293\sqrt{81 + 196 + 16} = \sqrt{293}.

Answer: d=2937d = \dfrac{\sqrt{293}}{7}.


Example 3: Another skew pair

Find the shortest distance between r⃗=(i^+2j^+k^)+λ(i^−j^+k^)\vec{r} = \left(\hat{i} + 2\hat{j} + \hat{k}\right) + \lambda\left(\hat{i} - \hat{j} + \hat{k}\right) and r⃗=2i^−j^−k^+μ(2i^+j^+2k^)\vec{r} = 2\hat{i} - \hat{j} - \hat{k} + \mu\left(2\hat{i} + \hat{j} + 2\hat{k}\right).

Solution:

  1. Cross: b⃗1×b⃗2=∣i^j^k^1−11212∣=−3i^+0j^+3k^\vec{b}_1 \times \vec{b}_2 = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ 1 & -1 & 1 \\ 2 & 1 & 2 \end{vmatrix} = -3\hat{i} + 0\hat{j} + 3\hat{k}, magnitude 323\sqrt{2}.
  2. Joining vector: (1,−3,−2)(1, -3, -2).
  3. Triple product: (−3)(1)+0+(3)(−2)=−9(-3)(1) + 0 + (3)(-2) = -9; modulus 99.

Answer: d=932=32=322d = \dfrac{9}{3\sqrt{2}} = \dfrac{3}{\sqrt{2}} = \dfrac{3\sqrt{2}}{2}.


Example 4: Cartesian input

Find the shortest distance between x−11=y−2−3=z−32\dfrac{x - 1}{1} = \dfrac{y - 2}{-3} = \dfrac{z - 3}{2} and x−42=y−53=z−61\dfrac{x - 4}{2} = \dfrac{y - 5}{3} = \dfrac{z - 6}{1}.

Solution:

  1. Extract: a⃗1=(1,2,3)\vec{a}_1 = (1, 2, 3), b⃗1=(1,−3,2)\vec{b}_1 = (1, -3, 2); a⃗2=(4,5,6)\vec{a}_2 = (4, 5, 6), b⃗2=(2,3,1)\vec{b}_2 = (2, 3, 1).
  2. Cross: b⃗1×b⃗2=(−3−6, 4−1, 3+6)=(−9,3,9)\vec{b}_1 \times \vec{b}_2 = (-3 - 6, \ 4 - 1, \ 3 + 6) = (-9, 3, 9), magnitude 81+9+81=171=319\sqrt{81 + 9 + 81} = \sqrt{171} = 3\sqrt{19}.
  3. Triple product with (3,3,3)(3, 3, 3): −27+9+27=9-27 + 9 + 27 = 9.

Answer: d=9319=319d = \dfrac{9}{3\sqrt{19}} = \dfrac{3}{\sqrt{19}}.


Example 5: Parametric input, regrouped first

Find the shortest distance between r⃗=(1−t)i^+(t−2)j^+(3−2t)k^\vec{r} = (1 - t)\hat{i} + (t - 2)\hat{j} + (3 - 2t)\hat{k} and r⃗=(s+1)i^+(2s−1)j^−(2s+1)k^\vec{r} = (s + 1)\hat{i} + (2s - 1)\hat{j} - (2s + 1)\hat{k}.

Solution:

  1. Regroup each as a⃗+(parameter)b⃗\vec{a} + (\text{parameter})\vec{b}: first line: a⃗1=(1,−2,3)\vec{a}_1 = (1, -2, 3), b⃗1=(−1,1,−2)\vec{b}_1 = (-1, 1, -2); second: a⃗2=(1,−1,−1)\vec{a}_2 = (1, -1, -1), b⃗2=(1,2,−2)\vec{b}_2 = (1, 2, -2).
  2. Cross: b⃗1×b⃗2=(2+4, −2−2, −2−1)=(2,−4,−3)\vec{b}_1 \times \vec{b}_2 = (2 + 4, \ -2 - 2, \ -2 - 1) = (2, -4, -3), magnitude 4+16+9=29\sqrt{4 + 16 + 9} = \sqrt{29}.
  3. Triple product with (0,1,−4)(0, 1, -4): 0−4+12=80 - 4 + 12 = 8.

Answer: d=829d = \dfrac{8}{\sqrt{29}} — the entire difficulty was the regrouping in step 1.


Example 6: A clean integer answer

Find the shortest distance between r⃗=6i^+2j^+2k^+λ(i^−2j^+2k^)\vec{r} = 6\hat{i} + 2\hat{j} + 2\hat{k} + \lambda\left(\hat{i} - 2\hat{j} + 2\hat{k}\right) and r⃗=−4i^−k^+μ(3i^−2j^−2k^)\vec{r} = -4\hat{i} - \hat{k} + \mu\left(3\hat{i} - 2\hat{j} - 2\hat{k}\right).

Solution:

  1. Cross: b⃗1×b⃗2=(4+4, 6+2, −2+6)=(8,8,4)\vec{b}_1 \times \vec{b}_2 = (4 + 4, \ 6 + 2, \ -2 + 6) = (8, 8, 4), magnitude 64+64+16=12\sqrt{64 + 64 + 16} = 12.
  2. Joining vector: (−10,−2,−3)(-10, -2, -3).
  3. Triple product: −80−16−12=−108-80 - 16 - 12 = -108; modulus 108108.

Answer: d=10812=9d = \dfrac{108}{12} = 9 — big numbers, but the framework is identical.