# If line 1 has parametric equations x=s, y=2-s, z=-2+s, s inRR. Line 2 has parametric eqns x=1+3t, y=-2-2t, z=6+2t, t in RR. Can you find shortest distance between the points? And, the coord of points where the common perpendicular meets the lines?

Oct 2, 2017

See below.

#### Explanation:

Given

${L}_{1} \to {p}_{1} = {p}_{01} + {\lambda}_{1} {\vec{v}}_{1}$ and
${L}_{2} \to {p}_{2} = {p}_{02} + {\lambda}_{2} {\vec{v}}_{2}$

with ${p}_{1} = \left({x}_{1} , {y}_{1}\right)$ and ${p}_{2} = \left({x}_{2} , {y}_{2}\right)$ the distance between two generic points ${p}_{1}$ and ${p}_{2}$ is given by

$d \left({\lambda}_{1} , {\lambda}_{2}\right) = \left\lVert {p}_{1} - {p}_{2} \right\rVert = \left\lVert {p}_{01} - {p}_{02} + {\lambda}_{1} {\vec{v}}_{1} - {\lambda}_{2} {\vec{v}}_{2} \right\rVert$ or

${d}^{2} \left({\lambda}_{1} , {\lambda}_{2}\right) = {\left\lVert {p}_{01} - {p}_{02} \right\rVert}^{2} + {\lambda}_{1}^{2} {\left\lVert {\vec{v}}_{1} \right\rVert}^{2} + {\lambda}_{2}^{2} {\left\lVert {\vec{v}}_{2} \right\rVert}^{2} + 2 {\lambda}_{1} \left\langle{p}_{01} - {p}_{02} , {\vec{v}}_{1}\right\rangle - 2 {\lambda}_{2} \left\langle{p}_{01} - {p}_{02} , {\vec{v}}_{2}\right\rangle - 2 {\lambda}_{1} {\lambda}_{2} \left\langle{\vec{v}}_{1} , {\vec{v}}_{2}\right\rangle$

Now the condition for minimum in ${d}^{2} \left({\lambda}_{1} , {\lambda}_{2}\right)$ which is a continuous ${C}^{2}$ function, is

$\left\{\begin{matrix}\frac{\partial {d}^{2} \left({\lambda}_{1} {\lambda}_{2}\right)}{\partial {\lambda}_{1}} = 2 {\lambda}_{1} {\left\lVert {\vec{v}}_{1} \right\rVert}^{2} + 2 \left\langle{p}_{01} - {p}_{02} & {\vec{v}}_{1}\right\rangle - 2 {\lambda}_{2} \left\langle{\vec{v}}_{1} & {\vec{v}}_{2}\right\rangle = 0 \\ \frac{\partial {d}^{2} \left({\lambda}_{1} {\lambda}_{2}\right)}{\partial {\lambda}_{2}} = 2 {\lambda}_{2} {\left\lVert {\vec{v}}_{2} \right\rVert}^{2} - 2 \left\langle{p}_{01} - {p}_{02} & {\vec{v}}_{2}\right\rangle - 2 {\lambda}_{1} \left\langle{\vec{v}}_{1} & {\vec{v}}_{2}\right\rangle = 0\end{matrix}\right.$

solving now the system

$\left\{\begin{matrix}{\lambda}_{1} {\left\lVert {\vec{v}}_{1} \right\rVert}^{2} + \left\langle{p}_{01} - {p}_{02} & {\vec{v}}_{1}\right\rangle - {\lambda}_{2} \left\langle{\vec{v}}_{1} & {\vec{v}}_{2}\right\rangle = 0 \\ {\lambda}_{2} {\left\lVert {\vec{v}}_{2} \right\rVert}^{2} - \left\langle{p}_{01} - {p}_{02} & {\vec{v}}_{2}\right\rangle - {\lambda}_{1} \left\langle{\vec{v}}_{1} & {\vec{v}}_{2}\right\rangle = 0\end{matrix}\right.$

or

$\left(\begin{matrix}{\left\lVert {\vec{v}}_{1} \right\rVert}^{2} & - \left\langle{\vec{v}}_{1} & {\vec{v}}_{2}\right\rangle \\ - \left\langle{\vec{v}}_{1} & {\vec{v}}_{2}\right\rangle & {\left\lVert {\vec{v}}_{2} \right\rVert}^{2}\end{matrix}\right) \left(\begin{matrix}{\lambda}_{1} \\ {\lambda}_{2}\end{matrix}\right) = \left(\begin{matrix}- \left\langle{p}_{01} - {p}_{02} & {\vec{v}}_{1}\right\rangle \\ \left\langle{p}_{01} - {p}_{02} & {\vec{v}}_{2}\right\rangle\end{matrix}\right)$

Now with

${p}_{01} = \left(0 , 2 , - 2\right)$
${p}_{02} = \left(1 , - 2 , 6\right)$
${\vec{v}}_{1} = \left(1 , - 1 , 1\right)$
${\vec{v}}_{2} = \left(3 , - 2 , 2\right)$

or

$\left(\begin{matrix}3 & - 7 \\ - 7 & 17\end{matrix}\right) \left(\begin{matrix}{\lambda}_{1} \\ {\lambda}_{2}\end{matrix}\right) = \left(\begin{matrix}13 \\ - 27\end{matrix}\right)$

giving

${\lambda}_{1} = 16 , {\lambda}_{2} = 5$ so the distance is

$d \left(16 , 5\right) = 2 \sqrt{2}$ and the points at which this condition is verified are

${p}_{1} = \left(16 , - 14 , 14\right)$
${p}_{2} = \left(16 , - 12 , 16\right)$