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...
 A: 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.)
A: If the normal vector is not provided in the question, you can still solve the question.
Any point $P$ on line $\vec{AB}$ given $u$ can be represented as
$\begin{pmatrix}
  1-2u \\
2u\\
2+u
\end{pmatrix}$
, whilst point any point $Q$ on line $\vec{CD}$ given $v$ can be represented as
$\begin{pmatrix}
  2v \\
1-v\\
1-2v
\end{pmatrix}$,
$\vec{PQ}=$
$\begin{pmatrix}
-1+2u+2v \\
1-2u-v\\
-1-u-2v
\end{pmatrix}$
You can interpret the shortest distance between $\vec{AB}$ and $\vec{CD}$ at points $P$ and $Q$ as a separate line that is perpendicular to both $\vec{AB},\vec{CD}$ at the same time, similar to how the shortest distance from a point to a line functions:
$$
\vec{PQ} \perp \vec{AB} \\
\vec{PQ} \perp \vec{CD}
$$
The dot product between two perpendicular vectors is 0, which gives:
$$
\vec{PQ} \cdot \vec{AB} =
\begin{pmatrix}
-1+2u+2v \\
1-2u-v\\
-1-u-2v
\end{pmatrix}
\cdot
\begin{pmatrix}
-2 \\
2\\
1
\end{pmatrix} =
0 \\
\vec{PQ} \cdot \vec{CD} =
\begin{pmatrix}
-1+2u+2v \\
1-2u-v\\
-1-u-2v
\end{pmatrix}
\cdot
\begin{pmatrix}
2 \\
-1\\
-2
\end{pmatrix} =
0 
$$
Which gives the following system of equations
$$
\begin{aligned}
3-9u-8v = 0\\
-1+8u+9v=0
\end{aligned}
$$
Solving for $u,v$ gives $u=\frac{19}{17},v=-\frac{15}{17}$, which can be substituted back to calculate the coordinates of $P$ and $Q$, giving $P=(\frac{38}{17}, \frac{53}{17}, -\frac{21}{17}), Q=(-\frac{30}{17}, \frac{32}{17}, \frac{47}{17})$
