# Find the two points where the shortest distance occurs on two lines

Find the point P on $\vec{AB}$ and point Q on $\vec{CD}$ such that $\vec{PQ}$ is the shortest distance between the lines AB and CD, given $\vec{AB} = \begin{pmatrix} 1\\ 0\\ 2\\ \end{pmatrix} + u\begin{pmatrix} -2\\ 2\\ 1\\ \end{pmatrix} ,\vec{CD} = \begin{pmatrix} 0\\ 1\\ 1\\ \end{pmatrix} + v\begin{pmatrix} 2\\ -1\\ -2\\ \end{pmatrix}$ the normal vector $n=\begin{pmatrix} -3\\ -2\\ -2\\ \end{pmatrix}$

and the shortest distance is $\frac{3}{\sqrt{17}}$. I figured all this out from 4 given points but don't know how to find points P and Q. Please help, I'm stuck...

Once you know that the normal vector is $n$, the vector equation $$\begin{pmatrix} 1\\ 0\\ 2\\ \end{pmatrix} + u\begin{pmatrix} -2\\ 2\\ 1\\ \end{pmatrix} +w\begin{pmatrix} -3\\ -2\\ -2\\ \end{pmatrix} = \begin{pmatrix} 0\\ 1\\ 1\\ \end{pmatrix} + v\begin{pmatrix} 2\\ -1\\ -2\\ \end{pmatrix}$$ is equivalent to a system of three linear equations in three unknowns, which indeed has the unique solution $$u=\frac{19}{17},v=-\frac{15}{17},w=\frac{3}{17}.$$ That tells you that the points on $\vec{AB}$ and $\vec{CD}$ are $$\begin{pmatrix} 1\\ 0\\ 2\\ \end{pmatrix} + \frac{19}{17}\begin{pmatrix} -2\\ 2\\ 1\\ \end{pmatrix} \quad\text{and}\quad\begin{pmatrix} 0\\ 1\\ 1\\ \end{pmatrix} -\frac{15}{17}\begin{pmatrix} 2\\ -1\\ -2\\ \end{pmatrix},$$ respectively. (It also tells you that the distance between the two lines is the norm of $\frac3{17}(-3\ {-2}\ {-2})$, or $\frac3{\sqrt{17}}$ as you indicated.)