2
$\begingroup$

If I have two lines $$ \eqalign{ & L_1 \left( t \right):p_1 + td_1 \cr & L_2 \left( q \right):p_2 + qd_2 \cr} $$ living in $\mathbb{R}^n$, there exists a classical formula to find the distance between them involving dot and cross products. The question is: can I deduce that formula only using calculus? (In this case, 2 variables) i.e., find the values such that the function $$ f\left( {t,q} \right) = \left \| L_1 (t) - L_2(t) \right \| = \left \| p_1 + td_1 - p_2 - qd_2 \right\| $$ reaches its minimum value.

Oh sorry; for simplicity, to have the natural cross product, just take $\mathbb{R}^3$.

2 Answers 2

1

Consider the distance squared between two points on these lines are $d_2(t_1, t_2) = \vert\vert p_1 - p_2 + t_1 q_1 - t_2 q_2 \vert\vert^2$.

Simple algebra shows, here $(u,v)$ denotes dot product of two vectors:

$$ d_2(t_1,t_2) = \vert p_{12} \vert^2 + 2 t_1 (p_{12}, q_1)- 2 t_2 (p_{12},q_2) + t_1^2 \vert q_1 \vert^2 + t_2^2 \vert q_2 \vert^2 - 2 t_1 t_2 (q_1,q_2) $$

You now minimize it by requiring derivatives with respect to $t_1$ and $t_2$ to vanish. This yields

$$ t_1 = \frac{ (p_{12},q_1) \vert q_2\vert^2 - (p_{12},q_2) (q_1, q_2) }{(q_1, q_2)^2 - \vert q_1 \vert^2 \vert q_2 \vert^2} \; \;\; \text{and} \;\;\; t_2 = - \frac{ (p_{12},q_2) \vert q_1\vert^2 - (p_{12},q_1) (q_1, q_2) }{(q_1, q_2)^2 - \vert q_1 \vert^2 \vert q_2 \vert^2} $$

Upon substitution I obtain the minimal distance squared is

$$ \vert p_{12} \vert^2 + \frac{ \vert q_1\vert^2 (p_{12},q_2)^2 + \vert q_2\vert^2 (p_{12},q_1)^2 - 2 (q_1,q_2)(p_{12},q_1)(p_{12},q_2) }{ (q_1, q_2)^2 - \vert q_1 \vert^2 \vert q_2 \vert^2} $$

where $p_{12}=p_1-p_2$.

  • 0
    What did you do? I did not understand you , sorry.2011-08-09
  • 0
    @Daniel I constructed the function of distance squared between two points on two curve, i.e. point $p_1 + t_1 q_1$ and point $p_2 + t_2 q_2$. This gives bivariate polynomial in $t_1$ and $t_2$ with coefficients expressible as scalar products of appropriate vectors. Then I solved for minimal parameters, obtained from $\frac{d}{d{t_1}} d_2(t_1,t_2) = 0$ and $\frac{d}{d{t_2}} d_2(t_1,t_2) = 0$ and substituted them back.2011-08-09
  • 0
    @Daniel I have updated my response filling in steps. Hope this helps.2011-08-09
  • 0
    I assume that $(u,v)$ denotes the scalar (dot) product $u\cdot v$.2011-08-09
  • 0
    By $d_2$, I assume you mean $d^2$.2011-08-17
  • 0
    @robjohn $d_2(t_1,t_2)$ is spelled out in my post (see first formula). It stands for the distance squared.2011-08-17
  • 0
    The first equation is why I assumed $d^2$ (distance squared). $d_2$ is also used in the original question ($L_2(q):p_2+qd_2$). There are just a lot of $d$s floating about :-)2011-08-17
1

In the past, I have solved these types of problems without calculus just by requiring the minimizing line to be orthogonal to whatever it was supposed to minimize the distance between.

Since I am lazy, I will rewrite the equations as $ L_1 ( p):a + p b $ and $ L_2 ( q):c + q d $. We want to find values of $p$ and $q$ such that, if $P = L_1(p)$ and $Q = L_2(q)$, then $P-Q$ is orthogonal to both $b$ and $d$.

Using "$.$" for dot product (I don't see where cross product is needed), this becomes $$0 = ( a + p b - c - q d).b = ( a + p b - c - q d).d$$ or, letting $g = c-a$, $$\eqalign{p |b|^2 - q(d.b) = g.b \cr p(b.d)-q |d|^2 = g.d\cr}$$

Solving these for $p$ and $q$ and substituting back in $P$ and $Q$ should give the points (modulo and errors on my part). Note that, if $b$ and $d$ are not proportional, Cauchy-Schwarz shows this equation has a unique solution.

  • 0
    "The Schwarz of inequality / And lemma too, he has no T. // The "Distribution" Schwartz you see / Is French, and so he has a T. -- Ralph Boas, [Spelling Lesson](http://dx.doi.org/10.1007/BF03022860). :D2011-08-17
  • 0
    @J.M. [that reminds me...](http://math.stackexchange.com/q/41070/) :)2011-08-21
  • 0
    ...apparently you went on a Schwarz correction spree @Theo... :D2011-08-21
  • 0
    @J.M. Yes I did :) (I only see your comment now that I'm back at it. Note that the system only removes one punctuation character after the notification, so a trailing ellipsis undermines notification.) Is it sooo hard to spell names correctly? I'll never understand how mathematicians can see $\ddot{u} = u$ as a mildly interesting equation (as opposed to $u = u$) while they fail to see the difference between Holder and Hölder, Schwarz and Schwartz, etc.2011-08-26
  • 0
    @Theo: I could understand the "Holder" bit at least; not everybody a.) has an international keyboard; b.) can remember the ASCII code for those fancy letters; or c.) has the patience to bring up a character map application or search for that stuff in his/her favorite search engine. Oh well. We'll never run out of work... ;)2011-08-28