The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » sci.math.* » sci.math

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Distance Between Lines in R^3 (fwd)
Replies: 15   Last Post: Sep 13, 2013 1:25 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Thomas Nordhaus

Posts: 433
Registered: 12/13/04
Re: Distance Between Lines in R^3 (fwd)
Posted: Jul 26, 2013 5:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Am 26.07.2013 05:33, schrieb William Elliot:
> How do we find the shortest distance between two lines L, L' in R^3 ?
> 2.;task=show_msg;msg=0792

How about doing it straight forward from scratch? Let P1(s) = v0 +s*v,
P2(t) = w0 + t*w be arbitrary points on the line L, L' resp.

Let f(s,t) = ||P1(s)-P2(t)||^2 = <P1(s)-P2(t),P1(s)-P2(t)> where <,> is
the dot-product. Compute the partials D1f, D2f w.r.t. s and t:

D1(s,t) = 2<P1'(s),P1(s)> - 2<P1'(s),P2(t)>
D2(s,t) = 2<P2'(t),P2(t)> - 2<P2'(t),P1(s)>

this yields

D1(s,t) = 2<v,v0+s*v - w0-t*w>
D1(s,t) = 2<w,w0+t*w - v0-s*v>.

You want that D1 and D2 vanish simultaneously. This results in the

s*<v,v> - t*<v,w> = <v,w0-v0> = 0
-s*<v,w> + t*<w,w> = <w,v0-w0> = 0

This can be written as a matrix-equation:

M*[s,t] = [<v,w0-v0>,<w,v0-w0>]'
where M is a 2x2 matrix and []' is a 2x1 column-vectors.

M is invertible provided its determinant is non-zero:

det(M) = <v,v><w,w> - <v,w>^2

***** (Case I, det(M)= 0) *****

Now, by the Cauchy-Schwarz inequality det(M) is zero iff v and w are
collinear, i.e. there is a real number a !=0 such that w = a*v. Then

det(M) <v,v><a*v,a*v> - <v,a*v>^2 = 0.

This refers to the case that L and L' are parallel. In this case going
back to (A) results in:

(s-at)*<v,v> = <v,w0-v0>
(-as+a^2*t)*<v,v> = a<v,v0-w0>

which are the same equations. Therefore one has to solve

(s-at)*<v,v> = <v,w0-v0>. So s = s(t) = at + <v,w0-v0>/<v,v>.

Next we compute f(s(t),t), the square of the distance. This value must
be independent of t. Choosing t=0 one obtains:

f(s(0),0) = <v0+s(0)v-w0,v0+s(0)v-w0>. The distance D between L and L'
therefore is

D = || v0 - w0 + (<v,w0-v0>/||v||^2)*v ||

***** (Case II, det(M)!= 0) *****

In this case you have to solve (A) for s and t. The unique solution
(S,T) is then given by:

[S,T] = M^(-1) * [<v,w0-v0>,<w,v0-w0>]'

The distance D between L and L' is then given by

|| v0+S*v - w0-T*w||.

Hope I got it right!
Thomas Nordhaus

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.