Distance between two straight lines in space

The distance between two straight lines $$r$$ and $$r'$$, $$\text{d}(r,r')$$, is the minimal distance between any point of $$r$$ and any other point of $$r'$$.

  • If the straight lines coincide or are secant, the distance between them is zero, $$\text{d}(r,r')=0$$.
  • If the straight lines are parallel, the distance between them can be calculated at any point of one of the lines, $$P\in r$$ or $$P'\in r'$$, and finding the distance to the other straight line: $$\text{d}(r,r')=\text{d}(P,r')=\text{d}(r,P')$$
  • If the straight lines cross, the following general formula is deduced to calculate the distance between them:

    We take a point $$A$$ belonging to $$r$$ and another point $$A'$$ belonging to $$r'$$. Let $$\vec{v}$$ and $$\vec{v}'$$ be the governing vectors of $$r$$ and $$r'$$. We join the points $$A$$ and $$A'$$. The volume of the parallelepiped determined by $$\overrightarrow{AA'}$$, $$\vec{v}$$ and $$\vec{v}'$$, is the absolute value of the mixed product of these vectors: $$$v_p=|[\overrightarrow{AA'},\vec{v},\vec{v}']|$$$

    On the other hand we can also calculate this volume by multiplying the area of the base and the height: $$$v_p=|\vec{v}\times\vec{v}'|\text{d}(r,r')|$$$

    Therefore: $$$\text{d}(r,r')=\dfrac{|[\overrightarrow{AA'},\vec{v},\vec{v}']|} {|\vec{v}\times\vec{v}'|}$$$

We are going to calculate the distance between the straight lines: $$$ r:x-2=\dfrac{y+3}{2}=z \qquad r':x=y=z$$$

First we determine its relative position. To do it we must write the implicit equations of the straight line: $$$ r:\left\{ \begin{array}{l} 2x-y-7=0 \\ x-z-2=0 \end{array} \right. \qquad r':\left\{ \begin{array}{l} x-y=0 \\ x-z=0 \end{array} \right.$$$

And we calculate the rank of the matrix of the resulting systems of equations: $$$|M'|=\begin{vmatrix} 2 & -1 & 0 & 7 \\ 1 & 0 & -1 & 2 \\ 1 & -1 & 0 & 0 \\ 1 & 0 & -1 & 0 \end{vmatrix} =2 \neq 0 $$$

Therefore $$\text{rank}(M')=4$$ and the two straight lines intersect. Now we must find a point and the governing vector of each line.

For the straight line $$r$$: $$A=(2,-3,0)$$ and $$\vec{v}=(1,2,1)$$.

For the straight line $$r'$$: $$A'=(0,0,0)$$ and $$\vec{v}=(1,1,1)$$.

So we have: $$\overrightarrow{AA'}=(-2,3,0)$$

$$$\begin{array}{rl} |\vec{v}\times\vec{v}'|=&\left| \begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ 1 & 2 & 1 \\ 1 & 1 & 1 \end{vmatrix} \right|= |2\vec{i}+\vec{j}+\vec{k}-2\vec{k}-\vec{j}-\vec{i}|= |\vec{i}-\vec{k}| \\ =& |(1,0,-1)| = \sqrt{1^2+0^2+(-1)^2}=\sqrt{2} \end{array}$$$

$$$[\overrightarrow{AA'},\vec{v},\vec{v}']= \begin{vmatrix} -2 & 3 & 0 \\ 1 & 2 & 1 \\ 1 & 1 & 1 \end{vmatrix} = -4+3+2-3=-2 $$$

Finally: $$$ \text{d}(r,r')=\dfrac{|[\overrightarrow{AA'},\vec{v},\vec{v}']|} {|\vec{v}\times\vec{v}'|}= \dfrac{|-2|}{\sqrt{2}}=\sqrt{2}$$$