How to find $2$ points on $2$ separate lines that are closest to each other

92 Views Asked by At

Find points $P$,$Q$ which are closest possible with $P$ lying on the line

$x=−1−t \\y=−1+4t\\ z=−3$

and $Q$ lying on the line

$x=−82+4s\\y=−15\\z=33+6s$

I tried by first subtracting the terms $P$ by $Q$, then took their square root. then I found The minimum for $PQ$ is when $f′(s)=0$;$f′(t)=0$ and tried from there to solve for $s$ and $t$, I got

$s=\frac{286}{31}$ and $t=\frac{12744}{527}$

then plugged those values back in to get my points but I'm not sure if I either got a calculation error or if I'm doing it wrong entirely because I keep getting the wrong answer!

3

There are 3 best solutions below

0
On BEST ANSWER

I'll give a geometry driven solution.

The primary observation is that the line segment joining $P$ and $Q$, $\overline{PQ}$ will be perpendicular to both lines: $$ \ell_1:\ (x,y,z) = (-1,-1,-3) + t(-1,4,0)\\ \ell_2:\ (x,y,z) = (-82,-15,33) + s(4,0,6) $$

$\vec{PQ} = (-81+t+4s,-14-4t,36+6s)$ and using the scalar product to detect orthogonality yields $$ \vec{PQ}\perp\ell_1\ \Rightarrow\ \vec{PQ} \cdot (-1,4,0) = 0 \ \Rightarrow\ 81-t-4s +4(-14-4t) = 0\\ \vec{PQ}\perp\ell_2\ \Rightarrow\ \vec{PQ} \cdot (4,0,6) = 0 \ \Rightarrow\ 4(-81+t+4s) +6(36+6s) = 0 $$ or $$ 17t + 4s = 25 \\ t + 13s = 27 $$ So $t=1$ and $s=2$ and $$ \boxed{ P = (-1,-1,-3) + 1(-1,4,0) = (-2,3,-3)\\ Q = (-82,-15,33) + 2(4,0,6) = (-74,-15,45) } $$

7
On

Hint:

write the equations of the two lines in the form: $$ \vec x=\vec a_1 +t\vec b_1 \qquad \vec x=\vec a_2 +t\vec b_2 $$

The unit vector $$ \vec n =\frac{\vec b_1 \times \vec b_2}{|\vec b_1 \times \vec b_2|} $$

is orthogonal to the two lines. So the minimum distance from the lines is the distance from the points $\vec a_1$ and $\vec a_2$ projected on $\vec n$ $$ d=|\vec n \cdot (\vec a_1-\vec a_2)| $$


From this we can found the points $P$ and $Q$ noting that $$ \overrightarrow{PQ}=(\vec a_1+t\, \vec b_1)-(\vec a_2+s \,\vec b_2)=d\, \vec n $$

This gives a system of linear equations in $t$ and $s$ whose solutions are the values that correspond to the points $P$ and $Q$.

0
On

Here is how I would personally approach the problem.

We have $$\vec{P}(t) = ( -1 - t ,\;\; -1 + 4 t ,\;\; -3 )$$ and $$\vec{Q}(s) = ( -82 + 4 s ,\;\; -15 ,\;\; 33 + 6 s )$$ When the distance between $\vec{P}(t)$ and $\vec{Q}(s)$ is minimized, so is the distance squared. The distance squared between the two points is $$\begin{array}{rl} f(s, t) = & \left( \vec{P}(t) - \vec{Q}(s) \right)\cdot\left( \vec{P}(t) - \vec{Q}(s) \right) \\ = & (4 s + t - 81)^2 + (4 t + 14)^2 + (6 s + 36)^2 \\ = & 52 s^2 + 17 t^2 + 8 s t - 216 s - 50 t + 8053 \end{array}$$ It reaches an extremum (a minimum or a maximum) whenever $$\frac{d f(s,t)}{d s} = 104 s + 8 t - 216 = 0$$ and $$\frac{d f(s, t)}{d t} = 8 s + 34 t - 50 = 0$$ Solving the pair of equations $$\begin{cases} 104 s + 8 t - 216 = 0 \\ 8 s + 34 t - 50 = 0 \end{cases}$$ yields the solution $$\begin{cases} s = 2 \\ t = 1 \end{cases}$$ Plugging $t = 1$ back to $\vec{P}(t)$ we get $$\vec{P} = \vec{P}(1) = ( -2 ,\;\, 3 ,\;\, -3 )$$ and $s = 2$ to $\vec{Q}(s)$ yields $$\vec{Q} = \vec{Q}(2) = ( -74 ,\;\, -15 ,\;\, 45 )$$ where the distance squared is $f(2,1) = 7812$, i.e. the distance is $\sqrt{7812} \approx 88.3855$.

To verify, I personally check how the function $f(s,t)$ looks like in Gnuplot, using command splot 52*x*x+17*y*y+8*x*y-216*x-50*y+8053 w lines, and indeed the function does have a minimum there.