Pv13 - Distances between parallel or skew lines

Pv13 - Distances between parallel or skew lines

The distance between two lines is the shortest gap between them, not the length between their displayed starting points. For parallel lines you reduce the problem to a point and a line. For skew lines you use the supplied formula and understand why its direction is perpendicular to both lines.

The shortest connector is perpendicular

Two rails have equations r=t(2,1,0)\mathbf{r}=t(2,1,0) and r=(0,3,4)+s(1,2,0)\mathbf{r}=(0,3,4)+s(1,2,0). Their displayed starting points are 55 units apart. Is that the gap between the rails?

Try different points. At t=−1t=-1, the first rail contains Q(−2,−1,0)Q(-2,-1,0); at s=−2s=-2, the second contains R(−2,−1,4)R(-2,-1,4). The connector QR→=(0,0,4)\overrightarrow{QR}=(0,0,4) has length 44, so the starting-point distance 55 cannot be the shortest. The connector is vertical and both rail directions are horizontal: it is perpendicular to both.

You already know

Parallel lines have proportional directions. Skew lines are non-parallel and have no common point. The shortest distance from a point to a line follows a perpendicular connector; a vector product of two non-parallel directions gives a direction perpendicular to both.

For a shortest connector between two lines, neither endpoint can slide a little along its line to make the connector shorter. Geometrically, it must meet each line at right angles. This explains the required direction without asking you to prove a distance formula.

Common perpendicular

A common perpendicular meets two lines and is perpendicular to both. For two skew lines, the segment of their common perpendicular between them is the shortest connector. For distinct parallel lines, there are infinitely many shortest perpendicular connectors, all with the same length.

The direction condition alone is not enough to locate the connector: its endpoints must actually lie on the two lines. In the rail example, the parameter substitutions establish this as well as the perpendicularity.

[DIAGRAM: asset_name: Shortest gap between skew rails; asset_slug: b029_common_perpendicular; caption: A connector perpendicular to both skew rails gives their shortest gap; description: A three-dimensional view shows blue line r=t(2,1,0) in z=0 and clay line r=(0,3,4)+s(1,2,0) in z=4. Sage segment QR joins Q=(-2,-1,0) to R=(-2,-1,4) and is labelled length 4. The displayed starting points A=(0,0,0) and B=(0,3,4) are joined by a thin dashed grey segment labelled length 5, not shortest. The two horizontal line directions are non-parallel, and QR is vertical, perpendicular to both.]
A connector perpendicular to both skew rails gives their shortest gap

If the directions are d1\mathbf{d}_1 and d2\mathbf{d}_2, their vector product provides the common perpendicular's direction when it is non-zero. This follows from the booklet's vector-product properties. Parallel directions instead give zero, so they need the point-to-line route in Part 2.

Key idea

A shortest connector between skew lines must be perpendicular to both directions. A connector between convenient starting points usually has extra movement along the lines.

The next check concerns direction only. The lines are stated to be skew, so there is a non-zero common-perpendicular direction.

Reducing parallel lines to a point and a line

Every point on one of two parallel lines has the same perpendicular distance from the other, so choose whichever point makes the arithmetic easiest.

If AA is on the first line, BB is on the second and d≠0\mathbf{d}\ne\mathbf{0} is their common parallel direction, use the point-to-line method already learnt. A perpendicular-foot calculation is valid, or you can use the vector-product ratio below.

Distance between parallel lines

For parallel lines through AA and BB, in non-zero direction d\mathbf{d},

d=∣AB→×d∣∣d∣d=\frac{|\overrightarrow{AB}\times\mathbf{d}|}{|\mathbf{d}|}

Use either line's direction; it need not be a unit vector. Coincident lines give zero.

Not in the formula booklet: learn it.

This is exactly a point-to-line distance with BB as the point. The booklet supplies the vector-product operation, but not this particular distance ratio.

Worked example 1: the displayed points are not the nearest pair

Question. Determine the distance between

ℓ1: r=(100)+t(122),ℓ2: r=(400)+s(244)\ell_1:\ \mathbf{r}=\begin{pmatrix}1\\0\\0\end{pmatrix}+t\begin{pmatrix}1\\2\\2\end{pmatrix},\qquad \ell_2:\ \mathbf{r}=\begin{pmatrix}4\\0\\0\end{pmatrix}+s\begin{pmatrix}2\\4\\4\end{pmatrix}

Plan. Confirm parallel directions, form a connector between the displayed points, then find its perpendicular component using the vector product.

(2,4,4)=2(1,2,2)parallel directionsAB→=(4,0,0)−(1,0,0)=(3,0,0)point-to-point connectorAB→×d=(3,0,0)×(1,2,2)=(0,−6,6)vector productd=36+361+4+4=623=22point-to-line distance\begin{aligned} (2,4,4)&=2(1,2,2) && \text{parallel directions} \\ \overrightarrow{AB}&=(4,0,0)-(1,0,0)=(3,0,0) && \text{point-to-point connector} \\ \overrightarrow{AB}\times\mathbf{d}&=(3,0,0)\times(1,2,2)=(0,-6,6) && \text{vector product} \\ d&=\frac{\sqrt{36+36}}{\sqrt{1+4+4}}=\frac{6\sqrt2}{3}=2\sqrt2 && \text{point-to-line distance} \end{aligned}

Why this step? ∣AB∣=3|AB|=3 includes movement along the line direction. The vector-product ratio retains only the perpendicular gap.

Answer. 222\sqrt2 units.

Check. The nearest point to BB on ℓ1\ell_1 has t=1/3t=1/3. Its connector to BB is (8/3,−2/3,−2/3)(8/3,-2/3,-2/3), perpendicular to (1,2,2)(1,2,2), with squared length 88.

The next example changes only the displayed starting point of the second line, moving it one copy of (1,2,2)(1,2,2) along that line. Its geometric position and distance remain unchanged.

Worked example 2: any point on the parallel line works

Question. Determine the distance between ℓ1\ell_1 above and

ℓ3: r=(522)+s(244)\ell_3:\ \mathbf{r}=\begin{pmatrix}5\\2\\2\end{pmatrix}+s\begin{pmatrix}2\\4\\4\end{pmatrix}

Plan. Use the new displayed point and the same common direction in the ratio.

AC→=(5,2,2)−(1,0,0)=(4,2,2)new connectorAC→×d=(4,2,2)×(1,2,2)=(0,−6,6)same perpendicular aread=723=22same shortest gap\begin{aligned} \overrightarrow{AC}&=(5,2,2)-(1,0,0)=(4,2,2) && \text{new connector} \\ \overrightarrow{AC}\times\mathbf{d}&=(4,2,2)\times(1,2,2)=(0,-6,6) && \text{same perpendicular area} \\ d&=\frac{\sqrt{72}}{3}=2\sqrt2 && \text{same shortest gap} \end{aligned}

Why this step? Adding a multiple of d\mathbf{d} to the connector does not change its vector product with d\mathbf{d}, because d×d=0\mathbf{d}\times\mathbf{d}=\mathbf{0}.

Answer. 222\sqrt2 units.

Check. (5,2,2)=(4,0,0)+12(2,4,4)(5,2,2)=(4,0,0)+\tfrac12(2,4,4), so ℓ3\ell_3 is another equation of ℓ2\ell_2.

Notice which vectors have which jobs. Subtract position vectors to make a connector, then use a direction vector for the base of the area calculation.

Watch out

Wrong: use the two parallel direction vectors as the vector-product numerator. Their product is zero, even for separate lines. Right: cross a connector between points with one common line direction.

Use the first line's direction in this problem; the negative multiple in the second equation does not change the geometry.

Using the supplied formula for skew lines

For skew lines, a common direction along the lines does not exist; instead, measure the separation in a direction perpendicular to both.

Take points with position vectors a\mathbf{a} and b\mathbf{b}, and non-parallel line directions d1\mathbf{d}_1 and d2\mathbf{d}_2. The non-zero vector n=d1×d2\mathbf{n}=\mathbf{d}_1\times\mathbf{d}_2 supplies the normal direction. Taking a scalar product of a connector with its unit vector measures the connector's component in that direction. This is the underlying geometry of the supplied formula, not a proof you need to reproduce.

Shortest distance between skew lines

For skew lines r=a+td1\mathbf{r}=\mathbf{a}+t\mathbf{d}_1 and r=b+sd2\mathbf{r}=\mathbf{b}+s\mathbf{d}_2, put n=d1×d2≠0\mathbf{n}=\mathbf{d}_1\times\mathbf{d}_2\ne\mathbf{0}. Then

d=∣(b−a).n∣∣n∣=∣(b−a).n∣n∣∣d=\frac{|(\mathbf{b}-\mathbf{a}).\mathbf{n}|}{|\mathbf{n}|} =\left|(\mathbf{b}-\mathbf{a}).\frac{\mathbf{n}}{|\mathbf{n}|}\right|

In the formula booklet.

The numerator is a scalar product with a cross product; keep the two operations distinct. The absolute value handles either order of the points or either orientation of the common normal.

Worked example 3: the gap between the rails

Question. Determine the shortest distance between the skew lines

ℓ1: r=t(210),ℓ2: r=(034)+s(120)\ell_1:\ \mathbf{r}=t\begin{pmatrix}2\\1\\0\end{pmatrix},\qquad \ell_2:\ \mathbf{r}=\begin{pmatrix}0\\3\\4\end{pmatrix}+s\begin{pmatrix}1\\2\\0\end{pmatrix}

Plan. Cross the directions, then apply the supplied formula to the connector between the displayed points.

n=(2,1,0)×(1,2,0)=(0,0,3)normal to both directionsb−a=(0,3,4)connector(b−a).n=0+0+12=12normal component numeratord=∣12∣3=4supplied distance formula\begin{aligned} \mathbf{n}&=(2,1,0)\times(1,2,0)=(0,0,3) && \text{normal to both directions} \\ \mathbf{b}-\mathbf{a}&=(0,3,4) && \text{connector} \\ (\mathbf{b}-\mathbf{a}).\mathbf{n}&=0+0+12=12 && \text{normal component numerator} \\ d&=\frac{|12|}{3}=4 && \text{supplied distance formula} \end{aligned}

Why this step? The connector's yy-component 33 lies along the span of the line directions. The scalar product with their vertical common normal ignores it and retains the gap 44.

Answer. 44 units, resolving the opening question.

Check. The actual connector from (−2,−1,0)(-2,-1,0) on ℓ1\ell_1 to (−2,−1,4)(-2,-1,4) on ℓ2\ell_2 is perpendicular to both directions and has length 44.

The next example changes only the second line's starting height from 44 to −4-4. The signed separation reverses, but the distance is still positive.

Worked example 4: a negative scalar-product numerator

Question. Determine the shortest distance between ℓ1\ell_1 above and r=(03−4)+s(120)\mathbf{r}=\begin{pmatrix}0\\3\\-4\end{pmatrix}+s\begin{pmatrix}1\\2\\0\end{pmatrix}.

Plan. Use the unchanged cross product and retain the absolute value around the new scalar product.

n=(0,0,3)directions unchanged(b−a).n=(0,3,−4).(0,0,3)=−12opposite signed separationd=∣−12∣3=4positive distance\begin{aligned} \mathbf{n}&=(0,0,3) && \text{directions unchanged} \\ (\mathbf{b}-\mathbf{a}).\mathbf{n}&=(0,3,-4).(0,0,3)=-12 && \text{opposite signed separation} \\ d&=\frac{|-12|}{3}=4 && \text{positive distance} \end{aligned}

Why this step? Choosing the opposite normal would reverse the numerator again. Neither a normal's orientation nor a point's side of the other line can make a distance negative.

Answer. 44 units.

Check. The closest connector now joins (−2,−1,0)(-2,-1,0) to (−2,−1,−4)(-2,-1,-4), again with length 44.

Any points on the lines work. Replacing their connector by b+sd2−a−td1\mathbf{b}+s\mathbf{d}_2-\mathbf{a}-t\mathbf{d}_1 leaves its scalar product with n\mathbf{n} unchanged, because d1.n=d2.n=0\mathbf{d}_1.\mathbf{n}=\mathbf{d}_2.\mathbf{n}=0. This explains why the formula can use convenient displayed points even when those points are not the nearest pair.

Watch out

Wrong: apply the skew-line formula to parallel directions, obtaining 0/00/0. Right: check the directions first. Parallel lines use a point-to-line distance; non-parallel skew lines have a non-zero common normal.

If you need to verify proposed nearest endpoints, check that each belongs to its line and that their connector has zero scalar product with both directions. The following problem needs only the supplied ratio.

Quick Recap

  • The shortest connector meets both lines perpendicularly; convenient starting points need not be its endpoints.
  • Parallel lines reduce to a point-to-line distance using a common parallel direction.
  • For skew lines, cross the directions, then take a connector's component along that common normal using the supplied formula.
  • Keep distances non-negative, and never use the skew ratio when the directions are parallel.

The opening rails have shortest gap 44, although their displayed starting points are 55 units apart.