The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Shortest Distance Between Two Vectors

Date: 04/07/98 at 02:39:55
From: blah
Subject: Vectors

How do you find the distance between the lines (1,2,3) + s(1,0,-1) 
and x = 0, y = 1+2t, z = 3+t?

I think I have to change the lines to (1+s,2,3-s) and (0,1+2t,3+t) 
then do d = (|a1 - a2|.(b1 x b2))/|b1 x b2| where a1 and a2 are points 
on each of the lines, and b1 and b2 are the two lines. Is this right?  
Which two points should I use? Does it matter which points I pick?

Thanks :)

Date: 04/07/98 at 06:58:42
From: Doctor Anthony
Subject: Re: Vectors

To find the shortest distance between two skew lines (lines which do 
not meet) you first require the direction of the common perpendicular.  
Express this vector as a unit vector and then find the component in 
this direction of a line joining ANY two points on the two lines.  
This component will be the shortest distance between the lines.

The direction of one line is: (1, 0, -1)
and of the other:             (0, 2,  1)

You can use vector products to find the common perpendicular:

     |i   j    k|    
     |1   0   -1| = i(2) - j(1) + k(2) = 2i - j + 2k
     |0   2    1|

Express this as a unit vector:

     (1/3)[2i - j + 2k]           (Equation 1)

A line joining (1,2,3) on line 1 to (0,1,3) on line 2 is the vector:

     [(1-0), (2-1), (3-3)] = [1, 1, 0]

Now scalar multiply this with the unit vector shown in Equation 1:

     Shortest distance = (1/3)[1*2 + 1*(-1) + 0*2]

                       = (1/3)[2-1]
                       = 1/3 units.

-Doctor Anthony,  The Math Forum
Check out our web site!   

Date: 04/07/98 at 09:07:37
From: blah
Subject: Re: Vectors

I can see that the direction of the lines is found by taking the
coefficient of the parameter. Is there a formal way of doing this, or 
is it better just to learn the trick?

Thanks again =)

Date: 04/07/98 at 11:03:25
From: Doctor Anthony
Subject: Re: Vectors

The general vector equation of a line is:

     r = p + t*u  

where p is a point on the line and u is a vector in the direction of 
the line.

To go from the origin to any point r1 on the line we go first to the 
point p, then a distance proportional to t along the vector u. So when 
the equation is written in the form (1,2,3) + s(1,0,-1), we know that 
(1,2,3) is a point on the line and (1,0,-1) is the direction of the 
line. If we write the direction vector as a unit vector this would be:

     r = (1,0,-1) + (s/sqrt(2))(1,0,-1)

and now s is the actual distance along the line from the point p.

If you see an equation of a line written in the form:

     x-x1    y-y1    z-z1
     ----  = ----  = -----  = t
      a        b       c

then (a,b,c) are direction ratios of the line, (x1,y1,z1) is a point 
on the line, and t is the same parameter as we used in the vector 

-Doctor Anthony,  The Math Forum
Check out our web site!   
Associated Topics:
College Calculus
College Linear Algebra

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.