How to find the distance between two non-parallel lines? I am tasked to find the distance between these two lines.
$p1 ... x = 1 + t, y = -1 + 2t, z = t$
$p2 ... x = 1 - t; y = 3 - t; z = t$
Those two lines are nonparallel and they do not intersect (I checked that).
Using the vector product I computed the normal (the line orthogonal to both of these lines), and the normal is $(3, -2, 1)$. Now I have the direction vector of the line which will intersect both of my nonparallel lines.
However, here's where I encounter the problem - I don't know what next. The next logical step in my opinion would be to find a point on $p1$ where I could draw that orthogonal line and where that orthogonal line would also intersect with $p2$... There's only one such point, since we are in 3D space and I could draw an orthogonal line from any point in $p1$ but it could miss $p2$.
 A: Take the common normal direction.
$$\mathbf{n} = \pmatrix{1\\2\\1} \times \pmatrix{-1\\-1\\1} = \pmatrix{3 \\-2 \\1 }  $$
Now project any point from the lines onto this direction. Their difference is the distance between the lines
$$ d = \frac{ \mathbf{n} \cdot ( \mathbf{r}_1 - \mathbf{r}_2 )}{\| \mathbf{n} \|} $$
$$ d = \frac{ \pmatrix{3\\-2\\1} \cdot \left( \pmatrix{1\\-1\\0} - \pmatrix{1\\2\\1} \right) }{ \| \pmatrix{3\\-2\\1} \|} = \frac{ \pmatrix{3\\-2\\1} \cdot \pmatrix{0\\-4\\0} } {\sqrt{14}} = \frac{8}{\sqrt{14}} = 2.1380899352993950$$
NOTE: The $\cdot$ is the vector inner product, and $\times$ is the cross product
A: HINT...find any vector joining one point on one line to another point on the other line and calculate the projection of this vector onto the common normal which you have found already.
A: Lines can be written in a vector form:     
$p_1=\begin{bmatrix}   1 \\ -1 \\ 0  \end{bmatrix}+t\begin{bmatrix}   1 \\ 2 \\ 1  \end{bmatrix}  $     
$p_2=\begin{bmatrix}   1 \\ 3 \\ 0  \end{bmatrix}+s\begin{bmatrix}   -1 \\ -1 \\ 1  \end{bmatrix} $
Denote it with symbols of vectors $p_{01},p_{02},v_1,v_2$:
$p_1=p_{01}+tv_1$
$p_2=p_{02}+sv_2$  
Distance is measured alongside vector which is  perpendicular to $v_1$ and $v_2$, we can take for example a cross product $v_\perp=v_1 \times v_2$ what you have already done.
Now moving from the point $p_{01}$ to the point $p_{02}$ through $p_{1\perp}$ and $p_{2\perp}$ where $p_{1\perp},p_{2\perp}$ are the ends of segment perpendicular to the lines $p_1$ and $p_2$  we have:
$p_{12}=p_{02}-p_{01}= t  v_1+r  v_\perp+s  v_2 = 
\begin{bmatrix}  v_1 &  v_\perp & v_2 \end{bmatrix} \begin{bmatrix}   t  \\ r  \\ s   \end{bmatrix} $
Solution for this equation is:
$\begin{bmatrix}t  \\ r  \\ s   \end{bmatrix}=\begin{bmatrix}  v_1 & v_\perp & v_2 \end{bmatrix}  ^{-1}p_{12} $
Having $t , r,   s $ it's straightforward to calculate the ends of segment perpendicular to both lines and  its length $d=\Vert rv_\perp \Vert$.
