# Shortest distance between two lines and common perpendicular

Line 1 has equation: $\dfrac{x-8}{3}=\dfrac{y+9}{-16}=\dfrac{z+1}{-2}$

Line 2 has equation: $\left(\begin{matrix}x\\y\\z \end{matrix}\right)=\left(\begin{matrix}15\\29\\5 \end{matrix}\right) + \left(\begin{matrix}3\\8\\-5 \end{matrix}\right)t$

How do you find the shortest distance between lines 1 and 2?

Also how would I find the coordinates of the points where the common perpendicular meets the line 1 and 2? Would I use cross product of direction vectors from both lines? But how would I find the coordinate that starts from?

• math.stackexchange.com/questions/210848/…
– user137731
Dec 1, 2015 at 14:05
• Hint: to find two points on Line 1, you can look for values for (x;y;z) which result in 0 or 1. This leads to points (8; -9; -1) and (11; -25; -3). From there, you directly get an equation of the second form, including both direction vectors. Dec 1, 2015 at 14:09
• What do you mean by second form??
– Ivy
Dec 1, 2015 at 14:17
• The shortest distance between two lines is the length of projection of any vector between the two lines onto the cross product of the direction of the two lines. Dec 1, 2015 at 14:20
• The "second form" is the form used for Line 2: point plus multiple of direction vector. Once you have two points, you can use their difference as direction vector and one of the points as starting point. Dec 1, 2015 at 14:28

My answer is based on Lee Yiyuan's suggestion.

Rewrite the equation of line 1 as

$$\left(\begin{matrix}x\\y\\z\end{matrix}\right) =\left(\begin{matrix}8\\-9\\-1\end{matrix}\right) +\left(\begin{matrix}3\\-16\\-2\end{matrix}\right) t.$$

A vector perpendicular to both lines is

$$\begin{vmatrix}i&j&k\\3&-16&-2\\3&8&-5\end{vmatrix} =96i+9j+72k.$$

One of the vectors joining two lines is

$$\left(\begin{matrix}8\\-9\\-1\end{matrix}\right) -\left(\begin{matrix}15\\29\\5\end{matrix}\right) =\left(\begin{matrix}-7\\-38\\-6\end{matrix}\right).$$

Calculate the projection of this vector to the vector perpendicular to both lines, and then take its absolute value as the final answer.

\begin{split} & \mbox{Distance between $L_1$ and $L_2$}\\ =&\left\lvert\frac{\langle(-7,-38,-6),(96,9,72)\rangle}{\lVert(96,9,72)\rVert}\right\rvert\\ =&\left\lvert\frac{-1446}{\sqrt{14481}}\right\rvert\\ =&\frac{482}{\sqrt{1609}} \end{split}