# Find the distance between two lines in $\Bbb R^3$ [duplicate]

There are two lines in $\Bbb R^3$ given in parametric form: l_1: \left\{ \begin{aligned} x &= x_1 +a_1t\\ y &= y_1 +b_1t \\ z &= z_1 +c_1t \\ \end{aligned} \right. l_2: \left\{ \begin{aligned} x &= x_2 +a_2s \\ y &= y_2 +b_2s \\ z &= z_2 +c_2s \\ \end{aligned} \right.

What's the simplest method (or formula) for finding (the shortest) distance beteen them?

example I'm doing:

l_1: \left\{ \begin{aligned} x &= 0 \\ y &= -1 - 2t \\ z &= -2t \\ \end{aligned} \right.

l_2: \left\{ \begin{aligned} x &= 3s \\ y &= 1 - s \\ z &= 2 + 4s \\ \end{aligned} \right.

Hint: Find a vector $\mathbf A$ perpendicular to both lines and then find the projection onto $\mathbf A$ of any vector joining $\ell_1$ and $\ell_2$. Pictures help.