1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Shortest distance between two lines (vector algebra)

  1. Sep 12, 2009 #1
    1. The problem statement, all variables and given/known data
    line l1 : x=2 y= -1 + p z= 2p
    line l2 : x=-1 + t y=1-3t z=1-2t

    Find the shortest (exact) distance between l1 and l2.

    2. Relevant equations
    That's what I am looking for!


    3. The attempt at a solution

    Thanks!
     
  2. jcsd
  3. Sep 12, 2009 #2
    You have to show your attempt at a solution before we can help you.

    Thanks
    Matt
     
  4. Sep 12, 2009 #3
    I don't see your point. I have tried to solve the problem but didn't manage to do so, cause I can't find the right formulas.

    All I am asking for is the information on what formulas might be helpful.

    Do you expect me to write some attempt here, even if the wrong equations were used? whats the point?
     
  5. Sep 12, 2009 #4
    Yes, you are expected to post your work. If it is wrong then we can help to steer you onto the right path. So yes, write your attempt and indicate where you think you went wrong and then we can help.

    That is my point.

    Thanks
    Matt
     
  6. Sep 12, 2009 #5
    I tried to use the following equation:

    d = sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2), but it doesnt give me the right answer.
    whats wrong then ?

    thanks :)
     
  7. Sep 12, 2009 #6
    The distance formula is,

    d = sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)

    Well, the first thing you should do is substitute in you values for the quantity (x2-x1), square that quantity, and then simplify it if you can. Do the same for the other two quantities. Add them together and then take thier square root.

    Thanks
    Matt
     
  8. Sep 14, 2009 #7

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I will give you a few hints. The first is that you don't want to use distance formulas. From your two lines you can get direction vectors D1 and D2, right? And the cross product N = D1 X D2 would be normal to both lines. From your lines you can also get points P1 and P2 on line1 and line2 and use them to get a vector V across from one line to the other. Can you see that the distance between the lines would be the absolute value of the component of V on N? Try that.
     
    Last edited: Sep 14, 2009
  9. Sep 15, 2009 #8
    d = sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)
    d = sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)

    there's no difference between these 2..
     
  10. May 3, 2010 #9
    Can you please explain this a little more? I see that N=D1(cross)D2 is normal to both vectors, hence normal to the plane of the two vectors D1 and D2. Also the vector V we formed from one line to another has to be in the plane of the vectors D1 and D2. Therefore N is normal also to V; now how can V have any component on another vectos normal to it; the component of V on N is zero. Am I right?
    Thanks
    TJ
     
  11. May 3, 2010 #10

    Mark44

    Staff: Mentor

    The solution doesn't count as a relevant equation.
     
  12. May 3, 2010 #11
    Shhh! It's rude to point out that a post is completely useless. Oh wait...
     
  13. Oct 2, 2012 #12
    **Shortest distance between 2 lines drawn in 3D**

    R1(t) = (x1(t), y1(t), z1(t)) // t is the independent variable for line 1
    R2(s) = (x2(s), y2(s), z2(s)) // s is the independent variable for line 2

    D = R1(t) - R2(s) // distance between anywhere on the 2 different lines

    We first need to find, for a given point on line 1 (ie at position t), where the shortest distance from this point across to line 2 occurs.
    So we start by finding the square of the length of the vector D (ie its dot product (denoted by D.D); this just gives us a nice positive equation to work with). We then find where the derivative of this dot product with respect to s is equal to 0, while also making sure that we are dealing with a minima and not a maxima. From this, we will find the function s(t) (see below):

    ∂[D.D]/∂s = 0 [1] // derivative of the dot product
    ∂^2[D.D]/∂s^2 > 0 // ie the double derivative must be positive to ensure that it's a minima

    *Note: as there were 2 independent variable in equation D, we needed to use the partial derivative.

    Now solve equation [1] to find s(t) // s as a function of t.

    What equation s(t) tells us, is that for a given point t (on line 1), the shortest distance to line 2 can be found at point s (on line 2).

    So, now all we need to do is find which value of t (on line 1) will give us the overall shortest distance (ie when comparing all the shortest distances already found for the different values of t).

    First we re-write equation D using function s(t) (which was found from equation [1] above:
    D = R1(t) - R2(s(t)) [2] // now equation D is entirely written with respect to the single independent variable t

    And similarly (as we did before):

    d[D.D]/dt = 0 [3] // derivative of the dot product (calculated using equation [2])
    d^2[D.D]/dt^2 > 0 // ie the double derivative must be positive to ensure that it's a minima

    Solving equation [3] to find t, we now have a value (point t on line 1), where the overall shortest line occurs.
    Substituting this value of t in to equation [2] and finding the length of this vector (ie the square root of its dot product), one should arrive at the value for "the shortest distance between 2 lines drawn in 3D".

    I think this approach should also work for n-dimensions (which we would clearly need).
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Shortest distance between two lines (vector algebra)
Loading...