Two lines in space that are neither parallel nor intersecting are called skew lines. The shortest distance between them is one of the most formula-driven questions in 3-D geometry, but students still lose marks through sign slips and wrong vector choices. By the end of this article you will understand where the formula comes from, apply it to vector and Cartesian forms, and handle the parallel and intersecting cases correctly.
The picture behind the formula
Take two lines
\[L_1:\ \vec r = \vec a_1 + \lambda\vec b_1,\qquad L_2:\ \vec r = \vec a_2 + \mu\vec b_2.\]
The shortest segment joining them is perpendicular to both lines. A vector perpendicular to both directions is \(\vec b_1\times\vec b_2\). Now join any point of \(L_1\) to any point of \(L_2\), for example \(\vec a_2 – \vec a_1\). The shortest distance is the length of the projection of this joining vector onto the common perpendicular:
\[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|.\]
So the formula is just “projection of \(\vec a_2 – \vec a_1\) on the common perpendicular”. It does not matter which points on the lines you pick: any joining vector has the same component along \(\vec b_1\times\vec b_2\).
Step-by-step procedure
- Read off \(\vec a_1, \vec b_1\) and \(\vec a_2, \vec b_2\). For Cartesian form \(\frac{x-x_1}{a} = \frac{y-y_1}{b} = \frac{z-z_1}{c}\), the point is \((x_1, y_1, z_1)\) and the direction is \((a, b, c)\).
- Check for parallel lines: if \(\vec b_1\) and \(\vec b_2\) are proportional, use the parallel-lines formula below instead.
- Compute \(\vec b_1\times\vec b_2\) and its magnitude.
- Compute \(\vec a_2 – \vec a_1\).
- Dot product \((\vec a_2 – \vec a_1)\cdot(\vec b_1\times\vec b_2)\).
- Divide by \(|\vec b_1\times\vec b_2|\) and take the absolute value.
- Interpret: if the numerator is 0, the lines intersect and \(d = 0\).
Write the vectors out in a mini table first: \(\vec a_1, \vec b_1, \vec a_2, \vec b_2\) on four separate lines. Nearly every error in this topic is a sign copied wrongly from the equation of the line, especially from Cartesian form, where \(x + 2\) means the point has \(x_1 = -2\).
Worked example 1: lines in vector form
Find the shortest distance between \(\vec r = (\hat i + 2\hat j – \hat k) + \lambda(2\hat i + \hat j + 3\hat k)\) and \(\vec r = (3\hat i + 2\hat k) + \mu(\hat i – \hat j + 2\hat k)\).
Here \(\vec a_1 = (1,2,-1)\), \(\vec b_1 = (2,1,3)\), \(\vec a_2 = (3,0,2)\), \(\vec b_2 = (1,-1,2)\). The directions are not proportional.
\[\vec b_1\times\vec b_2 = \begin{vmatrix}\hat i & \hat j & \hat k\\ 2 & 1 & 3\\ 1 & -1 & 2\end{vmatrix} = \hat i(2+3) – \hat j(4-3) + \hat k(-2-1) = 5\hat i – \hat j – 3\hat k.\]
\(|\vec b_1\times\vec b_2| = \sqrt{25 + 1 + 9} = \sqrt{35}\), and \(\vec a_2 – \vec a_1 = 2\hat i – 2\hat j + 3\hat k\).
\[(\vec a_2 – \vec a_1)\cdot(\vec b_1\times\vec b_2) = 10 + 2 – 9 = 3.\] \[d = \frac{|3|}{\sqrt{35}} = \frac{3}{\sqrt{35}} = \frac{3\sqrt{35}}{35}\text{ units}\;(\approx 0.51).\]
Since \(d \neq 0\) and the lines are not parallel, they are skew.
Worked example 2: lines in Cartesian form
Find the shortest distance between
\[\frac{x-1}{2} = \frac{y+1}{3} = \frac{z}{1}\quad\text{and}\quad\frac{x+2}{1} = \frac{y-1}{-2} = \frac{z-3}{2}.\]
Convert carefully: \(\vec a_1 = (1,-1,0)\), \(\vec b_1 = (2,3,1)\); \(\vec a_2 = (-2,1,3)\), \(\vec b_2 = (1,-2,2)\).
\[\vec b_1\times\vec b_2 = \hat i(6+2) – \hat j(4-1) + \hat k(-4-3) = 8\hat i – 3\hat j – 7\hat k,\quad |\vec b_1\times\vec b_2| = \sqrt{64+9+49} = \sqrt{122}.\]
\(\vec a_2 – \vec a_1 = (-3, 2, 3)\), so the dot product is \(-24 – 6 – 21 = -51\).
\[d = \frac{|-51|}{\sqrt{122}} = \frac{51}{\sqrt{122}}\text{ units}\;(\approx 4.62).\]
The negative numerator only means \(\vec a_2 – \vec a_1\) points opposite to the chosen perpendicular; the absolute value takes care of it.
The parallel case
If \(\vec b_1 \parallel \vec b_2\), then \(\vec b_1\times\vec b_2 = \vec 0\) and the skew-line formula breaks down (division by zero). For parallel lines \(\vec r = \vec a_1 + \lambda\vec b\) and \(\vec r = \vec a_2 + \mu\vec b\), use
\[d = \frac{|\vec b\times(\vec a_2 – \vec a_1)|}{|\vec b|}.\]
This is the height of the parallelogram formed by \(\vec b\) and \(\vec a_2 – \vec a_1\): area divided by base.
Worked example 3
Find the distance between \(\vec r = (\hat i + \hat j) + \lambda(2\hat i – \hat j + 2\hat k)\) and \(\vec r = (3\hat i + \hat k) + \mu(2\hat i – \hat j + 2\hat k)\).
\(\vec b = (2,-1,2)\), \(|\vec b| = 3\), \(\vec a_2 – \vec a_1 = (2,-1,1)\).
\[\vec b\times(\vec a_2 – \vec a_1) = \begin{vmatrix}\hat i & \hat j & \hat k\\ 2 & -1 & 2\\ 2 & -1 & 1\end{vmatrix} = \hat i(-1+2) – \hat j(2-4) + \hat k(-2+2) = \hat i + 2\hat j.\] \[d = \frac{\sqrt{1+4}}{3} = \frac{\sqrt5}{3}\text{ units}.\]
Worked example 4: when the answer is zero
Do the lines \(\vec r = (\hat i + 2\hat j + 3\hat k) + \lambda(\hat i – \hat j + 2\hat k)\) and \(\vec r = (2\hat i + \hat j + 5\hat k) + \mu(2\hat i + \hat j + \hat k)\) intersect?
\(\vec b_1\times\vec b_2 = \hat i(-1-2) – \hat j(1-4) + \hat k(1+2) = -3\hat i + 3\hat j + 3\hat k\) and \(\vec a_2 – \vec a_1 = (1,-1,2)\).
Dot product: \(-3 – 3 + 6 = 0\). So \(d = 0\) and, since the directions are not parallel, the lines intersect. Indeed, \(\lambda = 1\) on the first line gives \((2,1,5)\), which is the point \(\mu = 0\) on the second.
Common mistakes
- Sign errors converting Cartesian form. \(\frac{y+1}{3}\) means \(y_1 = -1\).
- Using a denominator as a point or a point as a direction.
- Middle-term sign in the cross product. Expand the determinant slowly.
- Leaving a negative distance. Distance is the absolute value.
- Applying the skew formula to parallel lines, which gives \(\frac{0}{0}\). Check the directions first.
- Not rationalising or simplifying when the question expects a neat final form; both \(\frac{3}{\sqrt{35}}\) and \(\frac{3\sqrt{35}}{35}\) are acceptable, but simplify any common factors.
Practise next
Practise more on the shortest distance topic page, and revise how to read points and directions on equation of a line. The method rests on the vector product, so revisit that if your cross products are slow. Register for a free student account to take timed tests on the Three Dimensional Geometry chapter.
Frequently asked questions
What are skew lines?
Skew lines are lines in space that are neither parallel nor intersecting. They lie in different planes, so a non-zero shortest distance separates them.
Does it matter which line I call L1?
No. Swapping the lines changes the sign of the numerator at most, and the absolute value removes it, so the distance is the same.
How do I know if two lines intersect?
If the directions are not parallel and \((\vec a_2 - \vec a_1)\cdot(\vec b_1\times\vec b_2) = 0\), the shortest distance is zero and the lines intersect.
Which formula do I use for parallel lines?
Use \(d = \frac{|\vec b\times(\vec a_2 - \vec a_1)|}{|\vec b|}\), where \(\vec b\) is the common direction. The skew-line formula fails because \(\vec b_1\times\vec b_2 = \vec 0\).