Why Distances Between Lines Need Care
Two lines in space can be parallel, intersecting, or skew. Parallel lines have the same direction, while skew lines are nonparallel and do not intersect. For either pair, the distance means the length of the shortest segment joining a point on one line to a point on the other.
For parallel lines, this shortest segment can be found by measuring from a point on one line to the other line. For skew lines, the shortest segment must be perpendicular to both lines. Cross products provide formulas for both distances and a direct way to identify the direction of that common perpendicular.
The Two Distance Formulas
Write the lines using position vectors \(\mathbf{p}\) and \(\mathbf{q}\), and nonzero direction vectors \(\mathbf{u}\) and \(\mathbf{v}\):
Here \(s\) and \(t\) range over all real numbers. For parallel lines, the direction vectors are scalar multiples of one another. For skew lines, they are not scalar multiples, and the lines do not intersect. Set \(\mathbf{r}=\mathbf{q}-\mathbf{p}\), the vector from the chosen point on the first line to the chosen point on the second.
The parallel formula is the point-to-line distance formula applied to the point \(\mathbf{q}\). The skew-lines formula uses a vector perpendicular to both directions: \(\mathbf{u}\times\mathbf{v}\). The absolute value ensures the distance is nonnegative.
Distance Between Parallel Lines
When the lines are parallel, moving along either line does not change the perpendicular separation between them. Therefore, choose any point on one line and find its distance to the other line. For example, with \(\mathbf{q}\) on \(L_2\), the cross product \(\mathbf{r}\times\mathbf{u}\) measures the area of a parallelogram with base length \(\lVert\mathbf{u}\rVert\). Dividing that area by the base length gives the perpendicular height, which is the distance.
Worked Example: Distance Between Parallel Lines
Find the distance between
The direction vectors are \(\mathbf{u}=(2,-1,2)\) and \(\mathbf{v}=(4,-2,4)=2\mathbf{u}\), so the lines are parallel. Take \(\mathbf{p}=(1,0,2)\) and \(\mathbf{q}=(0,3,1)\). Then
Compute the cross product and direction length:
Thus
To check, the point \(\mathbf{q}\) lies on \(L_2\). Its projection parameter onto \(L_1\) is \(\mathbf{r}\cdot\mathbf{u}/(\mathbf{u}\cdot\mathbf{u})=-7/9\). The point on \(L_1\) directly across from \(\mathbf{q}\) is therefore \(\mathbf{p}-\frac79\mathbf{u}\), and the connecting vector is
Its dot product with \(\mathbf{u}\) is \(\frac{10}{9}-\frac{20}{9}+\frac{10}{9}=0\), so it is perpendicular to the lines. Its length is \(\sqrt{450/81}=5\sqrt{2}/3\), agreeing with the formula.
Why the Skew-Lines Formula Works
For skew lines, the vector \(\mathbf{n}=\mathbf{u}\times\mathbf{v}\) is nonzero and perpendicular to both directions. The scalar triple product \(\mathbf{r}\cdot\mathbf{n}\) measures the signed component of \(\mathbf{r}\) in the direction normal to both lines. Dividing its absolute value by \(\lVert\mathbf{n}\rVert\) gives the length of that component. The following argument shows why this component is exactly the minimum separation.
Finding the Common Perpendicular Directly
The formula gives the distance without finding the closest points. When the points themselves are needed, solve the two perpendicularity equations. The check is essential: the resulting points must lie on their respective lines, and the vector joining them must have zero dot product with both directions.
Worked Example: Closest Points on Two Skew Lines
Find the distance between
Here \(\mathbf{p}=(0,0,0)\), \(\mathbf{q}=(1,0,0)\), \(\mathbf{u}=(1,1,0)\), \(\mathbf{v}=(0,1,1)\), and \(\mathbf{r}=(1,0,0)\). The cross product and triple product are
The directions are nonparallel, and the nonzero triple product shows that the lines are not coplanar, so they are skew. The distance formula gives \(d=1/\sqrt{3}\).
For the closest points, the connecting vector from a point on \(L_1\) to a point on \(L_2\) is
Impose perpendicularity to each direction:
The second equation gives \(s=2t\). Substituting into the first gives \(1+t-4t=0\), so \(t=1/3\) and \(s=2/3\). The closest points are
Their difference is \(\mathbf{x}_2-\mathbf{x}_1=(1/3,-1/3,1/3)\). Its dot products with \(\mathbf{u}\) and \(\mathbf{v}\) are \(1/3-1/3=0\) and \(-1/3+1/3=0\), respectively. Its length is \(\sqrt{3/9}=1/\sqrt{3}\), confirming the formula and the perpendicularity conditions.
A Second Skew-Lines Calculation
Worked Example: Distance and Common Perpendicular
Consider
Take \(\mathbf{p}=(1,-1,0)\), \(\mathbf{q}=(0,2,3)\), \(\mathbf{u}=(1,0,1)\), and \(\mathbf{v}=(0,2,0)\). Then \(\mathbf{r}=(-1,3,3)\), and
Thus the distance is \(8/(2\sqrt{2})=2\sqrt{2}\). To find the closest points, use \(\mathbf{D}=\mathbf{r}+t\mathbf{v}-s\mathbf{u}\). The perpendicularity equations are
They give \(s=1\) and \(t=-3/2\). The connecting vector is
Its dot products with \(\mathbf{u}\) and \(\mathbf{v}\) are \(-2+2=0\) and \(0\), so it is perpendicular to both lines. Its length is \(\sqrt{4+4}=2\sqrt{2}\), as required.
Distinguishing Skew Lines from Other Pairs
Do not apply the skew-lines formula without first checking the geometric situation. If the directions are parallel, the cross product in its denominator is zero, so use the parallel-lines formula instead. If the directions are not parallel, the triple product helps distinguish skew lines from intersecting ones: a zero triple product means \(\mathbf{r}\) lies in the plane spanned by the two directions. The lines are then coplanar and, because their directions are nonparallel, they intersect. Their distance is zero.
A Common Mistake
A frequent error is to use the point-to-line formula with a point on one skew line and the direction of the other line, then assume this gives the distance between the two lines. It generally does not: the selected point may not be the endpoint of the shortest connecting segment.
Worked Example: Why a Point-to-Line Calculation Can Fail
For the skew lines from the earlier example, take \(\mathbf{q}=(1,0,0)\) on \(L_2\), \(\mathbf{p}=(0,0,0)\) on \(L_1\), and \(\mathbf{u}=(1,1,0)\). The point-to-line calculation gives
This is the distance from \(\mathbf{q}\) to \(L_1\), not the distance between the two lines. The actual line-to-line distance is \(1/\sqrt{3}\), as the skew-lines formula and common perpendicular show. The correction is to use the skew-lines formula or find the points where the connecting segment is perpendicular to both directions.
Choosing and Checking a Method
Start by writing each line with a point and a nonzero direction vector. Then classify the pair before calculating. The distance formulas depend on the geometry: parallel lines use one line's direction and a point on the other, while skew lines use both directions and their common normal.
If \(\mathbf{u}\times\mathbf{v}=\mathbf{0}\), the directions are parallel; otherwise they are not.
For nonparallel directions, check whether \(\mathbf{r}\cdot(\mathbf{u}\times\mathbf{v})\) is zero. Zero means the lines intersect; nonzero means they are skew.
For parallel lines use \(\lVert\mathbf{r}\times\mathbf{u}\rVert/\lVert\mathbf{u}\rVert\). For skew lines use \(\left|\mathbf{r}\cdot(\mathbf{u}\times\mathbf{v})\right|/\lVert\mathbf{u}\times\mathbf{v}\rVert\).
If you find closest points, confirm they lie on their lines, their connecting vector has the calculated length, and its dot products with both direction vectors are zero.
These methods matter because they turn a spatial picture into a small set of vector calculations. The perpendicularity check also explains the geometry of the answer: the distance is not just the length of an arbitrary connector, but the length of the shortest one.
Check Your Understanding
Use the line directions and points carefully in each question.
- What condition on two direction vectors identifies parallel lines?
- Why does the distance between parallel lines equal the distance from any point on one line to the other line?
- For skew lines, why is \(\mathbf{u}\times\mathbf{v}\) the direction of the common perpendicular?
- What does a zero scalar triple product imply when the line directions are nonparallel?
- For the lines \(\mathbf{x}=s(1,1,0)\) and \(\mathbf{x}=(1,0,0)+t(0,1,1)\), find the parameters of the closest points and verify the connecting vector is perpendicular to both directions.