= Solution
Use <parametric equations> for the two lines,
$$
\mathbf r=\mathbf p+t\mathbf u,\quad \mathbf p=(2,3,-1),\quad\mathbf u=(2,1,2),
\qquad
\mathbf r=\mathbf q+s\mathbf v,\quad\mathbf q=(-2,-1,1),\quad\mathbf v=(1,2,1).
$$
Their <cross product> is $\mathbf u\times\mathbf v=(-3,0,3)\ne0$. Projection of the separation of the base points onto this common normal gives the <shortest distance between skew lines>:
$$
\boxed{d=\frac{|(\mathbf q-\mathbf p)\cdot(\mathbf u\times\mathbf v)|}{|\mathbf u\times\mathbf v|}
=\frac{18}{3\sqrt2}=3\sqrt2.}
$$
This projection is a lower bound on every connecting segment because adding either line's direction leaves its normal component unchanged. It is attained: imposing perpendicularity of $\mathbf p+t\mathbf u-\mathbf q-s\mathbf v$ to both directions gives $t=2/3$ and $s=7/3$. The corresponding points are $(10/3,11/3,1/3)$ and $(1/3,11/3,10/3)$; their difference is $(3,0,-3)$, perpendicular to both lines and of length $3\sqrt2$.
Back to article page