# What is the distance between the line (x+1)/7=(y+1)/6=(z+1)/1 and the line (x-3)/1=(y-5)/(-2)=(z-7)/1 ?

Mar 8, 2017

Shortest distance: $2 \sqrt{2}$

#### Explanation:

$m a t h b f {l}_{1} : \frac{x + 1}{7} = \frac{y + 1}{6} = z + 1 q \quad \left[= p\right]$

$m a t h b f {l}_{2} : x - 3 = \frac{y - 5}{-} 2 = z - 7 q \quad \left[= q\right]$

We can write these in parameterised form:

$m a t h b f {l}_{1} : \left(\begin{matrix}x \\ y \\ z\end{matrix}\right) = \left(\begin{matrix}- 1 \\ - 1 \\ - 1\end{matrix}\right) + p \left(\begin{matrix}7 \\ 6 \\ 1\end{matrix}\right)$

$m a t h b f {l}_{2} : \left(\begin{matrix}x \\ y \\ z\end{matrix}\right) = \left(\begin{matrix}3 \\ 5 \\ 7\end{matrix}\right) + q \left(\begin{matrix}1 \\ - 2 \\ 1\end{matrix}\right)$

If the line connecting the points on the shortest distance touches $m a t h b f {l}_{1}$ and $m a t h b f {l}_{2}$, respectively at points $A$ and $B$, then we can say, using the distance formula, that the square of the distance between these points $A$ and $B$ is:

${s}^{2} = S = {\left(- 1 + 7 p - 3 - q\right)}^{2} + {\left(- 1 + 6 p - 5 + 2 q\right)}^{2} + {\left(- 1 + 7 p - 7 - q\right)}^{2}$

$= {\left(- 4 + 7 p - q\right)}^{2} + {\left(- 6 + 6 p + 2 q\right)}^{2} + {\left(- 8 + 7 p - q\right)}^{2}$

Assuming you can use calculus, we can take partial differentials in order to looks for any critical points:

$\frac{\partial S}{\partial p} = 2 \left(- 4 + 7 p - q\right) \cdot 7 + 2 \left(- 6 + 6 p + 2 q\right) \cdot 6 + 2 \left(- 8 + 7 p - q\right) \cdot 7$

$= 4 \left(67 p - q - 60\right) = 0 q \quad \triangle$

$\frac{\partial S}{\partial q} = 2 \left(- 4 + 7 p - q\right) \cdot \left(- 1\right) + 2 \left(- 6 + 6 p + 2 q\right) \cdot 2 + 2 \left(- 8 + 7 p - q\right) \cdot \left(- 1\right)$

$= - 4 \left(p - 3 q\right) = 0 q \quad \square$

$\square$ is fortutious because we see that for a critical point $p = 3 q$. We can sub that straight into $\triangle$ to get:

$4 \left(67 \left(3 q\right) - q - 60\right) = 0$

$\implies q = \frac{3}{10} , \implies p = \frac{9}{10} , \implies S = 8$

The shortest distance is therefore: $s = 2 \sqrt{2}$

We could now check the nature of the critical point via the second derivative but, but from a practical perspective, these are skew lines. The CP must be a min.

I might post a non-calculus approach later if i get time. There, we would use the cross product and algebra.

Mar 9, 2017

I make it $\frac{82}{25} \sqrt{5}$.

#### Explanation:

Line 1:

${t}_{1} = \frac{x + 1}{7} = \frac{y + 1}{6} = \frac{z + 1}{1}$

That is:

$\left(x , y , z\right) = \left(7 {t}_{1} - 1 , 6 {t}_{1} - 1 , {t}_{1} - 1\right)$

$\textcolor{w h i t e}{\left(x , y , z\right)} = \left(- 1 , - 1 , - 1\right) + {t}_{1} \left(7 , 6 , 1\right)$

Line 2:

${t}_{2} = \frac{x - 3}{1} = \frac{y - 5}{- 2} = \frac{z - 7}{1}$

That is:

$\left(x , y , z\right) = \left({t}_{2} + 3 , - 2 {t}_{2} + 5 , {t}_{2} + 7\right)$

$\textcolor{w h i t e}{\left(x , y , z\right)} = \left(3 , 5 , 7\right) + {t}_{2} \left(1 , - 2 , 1\right)$

A line through the points of closest approach of these two lines is perpendicular to both of these lines, so has the same direction as the cross product of $\left(7 , 6 , 1\right)$ and $\left(1 , - 2 , 1\right)$:

$\left(7 , 6 , 1\right) \times \left(1 , - 2 , 1\right) = \left\mid \begin{matrix}i & j & k \\ 7 & 6 & 1 \\ 1 & - 2 & 1\end{matrix} \right\mid$

$\textcolor{w h i t e}{\left(7 , 6 , 1\right) \times \left(1 , - 2 , 1\right)} = \left(\left\mid \begin{matrix}6 & 1 \\ - 2 & 1\end{matrix} \right\mid , \left\mid \begin{matrix}1 & 7 \\ 1 & 1\end{matrix} \right\mid , \left\mid \begin{matrix}7 & 6 \\ 1 & - 2\end{matrix} \right\mid\right)$

$\textcolor{w h i t e}{\left(7 , 6 , 1\right) \times \left(1 , - 2 , 1\right)} = \left(8 , - 6 , - 20\right)$

So we want to find ${t}_{1} , {t}_{2} , {t}_{3}$ such that:

$\left(- 1 , - 1 , - 1\right) + {t}_{1} \left(7 , 6 , 1\right) + {t}_{3} \left(8 , - 6 , - 20\right) = \left(3 , 5 , 7\right) + {t}_{2} \left(1 , - 2 , 1\right)$

Adding $\left(1 , 1 , 1\right) + {t}_{2} \left(- 1 , 2 , - 1\right)$ to both sides, this becomes:

${t}_{1} \left(7 , 6 , 1\right) + {t}_{2} \left(- 1 , 2 , - 1\right) + {t}_{3} \left(8 , - 6 , - 20\right) = \left(4 , 6 , 8\right)$

Which we can rewrite as:

$\left(\begin{matrix}7 & - 1 & 8 \\ 6 & 2 & - 6 \\ 1 & - 1 & - 20\end{matrix}\right) \left(\begin{matrix}{t}_{1} \\ {t}_{2} \\ {t}_{3}\end{matrix}\right) = \left(\begin{matrix}4 \\ 6 \\ 8\end{matrix}\right)$

Rewrite as an augmented matrix:

$\left(\begin{matrix}7 & - 1 & 8 & | & 4 \\ 6 & 2 & - 6 & | & 6 \\ 1 & - 1 & - 20 & | & 8\end{matrix}\right)$

Perform a sequence of row operations to make the left hand side of this matrix into a $3 \times 3$ identity matrix.

$\left(\begin{matrix}7 & - 1 & 8 & | & 4 \\ 6 & 2 & - 6 & | & 6 \\ 1 & - 1 & - 20 & | & 8\end{matrix}\right) \to$

$\left(\begin{matrix}1 & - 3 & 14 & | & - 2 \\ 6 & 2 & - 6 & | & 6 \\ 1 & - 1 & - 20 & | & 8\end{matrix}\right) \to$

$\left(\begin{matrix}1 & - 3 & 14 & | & - 2 \\ 3 & 1 & - 3 & | & 3 \\ 1 & - 1 & - 20 & | & 8\end{matrix}\right) \to$

$\left(\begin{matrix}1 & - 3 & 14 & | & - 2 \\ 0 & 10 & - 45 & | & 9 \\ 0 & 2 & - 34 & | & 10\end{matrix}\right) \to$

$\left(\begin{matrix}1 & - 3 & 14 & | & - 2 \\ 0 & 1 & - \frac{9}{2} & | & \frac{9}{10} \\ 0 & 1 & - 17 & | & 5\end{matrix}\right) \to$

$\left(\begin{matrix}1 & - 3 & 14 & | & - 2 \\ 0 & 1 & - \frac{9}{2} & | & \frac{9}{10} \\ 0 & 0 & - \frac{25}{2} & | & \frac{41}{10}\end{matrix}\right) \to$

$\left(\begin{matrix}1 & - 3 & 14 & | & - 2 \\ 0 & 1 & - \frac{9}{2} & | & \frac{9}{10} \\ 0 & 0 & 1 & | & - \frac{41}{125}\end{matrix}\right) \to$

$\left(\begin{matrix}1 & 0 & \frac{1}{2} & | & \frac{7}{10} \\ 0 & 1 & - \frac{9}{2} & | & \frac{9}{10} \\ 0 & 0 & 1 & | & - \frac{41}{125}\end{matrix}\right) \to$

$\left(\begin{matrix}1 & 0 & 0 & | & \frac{108}{125} \\ 0 & 1 & 0 & | & - \frac{72}{125} \\ 0 & 0 & 1 & | & - \frac{41}{125}\end{matrix}\right)$

Hence:

$\left\{\begin{matrix}{t}_{1} = \frac{108}{125} \\ {t}_{2} = - \frac{72}{125} \\ {t}_{3} = - \frac{41}{125}\end{matrix}\right.$

So the two points of closest approach are:

$\left(- 1 , - 1 , - 1\right) + {t}_{1} \left(7 , 6 , 1\right) = \left(- 1 , - 1 , - 1\right) + \frac{108}{125} \left(7 , 6 , 1\right)$

$\textcolor{w h i t e}{\left(- 1 , - 1 , - 1\right) + {t}_{1} \left(7 , 6 , 1\right)} = \left(\frac{631}{125} , \frac{523}{125} , - \frac{17}{125}\right)$

$\left(3 , 5 , 7\right) + {t}_{2} \left(1 , - 2 , 1\right) = \left(3 , 5 , 7\right) - \frac{72}{125} \left(1 , - 2 , 1\right)$

$\textcolor{w h i t e}{\left(3 , 5 , 7\right) + {t}_{2} \left(1 , - 2 , 1\right)} = \left(\frac{303}{125} , \frac{769}{125} , \frac{803}{125}\right)$

The distance between these two points is:

$\frac{1}{125} \sqrt{{\left(303 - 631\right)}^{2} + {\left(769 - 523\right)}^{2} + {\left(803 + 17\right)}^{2}}$

$= \frac{1}{125} \sqrt{107584 + 60516 + 672400}$

$= \frac{1}{125} \sqrt{840500}$

$= \frac{1}{125} \cdot 410 \sqrt{5}$

$= \frac{82}{25} \sqrt{5}$

Mar 9, 2017

$\frac{82}{25} \sqrt{5}$

#### Explanation:

${\lambda}_{1} = \frac{x + 1}{7} = \frac{y + 1}{6} = \frac{z + 1}{1}$

${\lambda}_{2} = \frac{x - 3}{1} = \frac{y - 5}{- 2} = \frac{z - 7}{1}$

$\left\{\begin{matrix}x = - 1 + 7 {\lambda}_{1} \\ y = - 1 + 6 {\lambda}_{1} \\ z = - 1 + {\lambda}_{1}\end{matrix}\right. \to p = {p}_{1} + {\lambda}_{1} {v}_{1}$

$\left\{\begin{matrix}x = 3 + {\lambda}_{2} \\ y = 5 - 2 {\lambda}_{2} \\ z = 7 + {\lambda}_{2}\end{matrix}\right. \to p = {p}_{2} + {\lambda}_{2} {v}_{2}$

Now the distance between the two lines is

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

but

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

The minimum of ${d}^{2} \left({\lambda}_{1} , {\lambda}_{2}\right)$ is located at the solution of

$\left\{\begin{matrix}\frac{\partial}{\partial {\lambda}_{1}} {d}^{2} = 0 \\ \frac{\partial}{\partial {\lambda}_{2}} {d}^{2} = 0\end{matrix}\right.$

which is obtained solving the linear system

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

Solving for ${\lambda}_{1} , {\lambda}_{2}$ we obtain

${\lambda}_{1} = \frac{108}{125} , {\lambda}_{2} = - \frac{72}{125}$

which substituted into $d \left({\lambda}_{1} , {\lambda}_{2}\right) = \frac{82}{25} \sqrt{5}$