Shortest Distance between Skew Lines


By Christine Hopkins (T4577) on Sunday, April 29, 2001 - 09:42 pm:

Please could you help me solve this question:

Find the co-ordinates of A on a line l and B on a line l' such that AB is as short as possible.

l:
x=5t-6
y=4t
z=3t-3

l':
x=t+6
y=2t-8
z=3t-1

Thank-you!!!


By Dan Goodman (Dfmg2) on Monday, April 30, 2001 - 02:57 am:

Hi Christine. What you should do is to find the closest distance from a point to a line, there is a standard equation for this but I'll show you how to get it. Let (u,v,w) be a particular point, and let f(t)=(u-x(t))2 +(v-y(t))2 +(w-z(t))2 (where x(t), y(t) and z(t) are the coordinates of the point on the line at time t, in your line L we have x(t)=5t-6, etc.) You want to minimise the distance (which is sqrt(f(t))), but this can be done by minimising the distance squared (it saves a bit of time on the diferentiation). For your line L, we have f(t)=(u-5t+6)2 +(v-4t)2 +(w-3t+3)2 , differentiating this we get f'(t)=-10(u-5t+6)-8(v-4t)-6(w-3t+3)=0, so t(50+24+18)=10u+6v+6w+60+18. We then substitute this value of t back into the function f(t) to get the distance squared. If we want to minimise the distance between two skew lines, we want to minimise the distance between a point on L' and the line L, over all points on L'. In other words, suppose D(u,v,w) gives the distance squared between u,v,w and the line L. Let g(t)=D(t+6,2t-8,3t-1), this is the distance squared from the point on L' at time t and the line L. If we minimise this value over t, we will get the minimum distance squared between L and L'. If you don't know about differentiation then this problem is a bit harder.


By Tom Hardcastle (P2477) on Friday, May 11, 2001 - 10:24 pm:

There is also an elegant way to do it using the vector cross and dot products. This method depends on first finding the shortest distance between the two lines and then using this to find the points on the lines. I'll deal with the general case here.
If we have two lines l1 and l2 such that their equations are r=a+td and r=a+ue respectively then the shortest distance between them is the shortest distance between two parallel planes π1 and π2 such that π1 contains l1 and π2 contains l2 .
At this point a diagram may be helpful.
planes


The shortest distance between the lines is clearly PQ. This is equal to NB, which is equal to ABcosθ.

Letting A and B be the points whose position vectors are a and b respectively, and calculating the unit vector in the direction of NB (equal to the unit vector in the direction PQ) to be (d x e ) / |d x e | allows us to calculate
ABcosθ=|((a-b).(d×e))/|d×e||.
The length of the line PQ is now known. Its direction is also known to be along the same line as the unit vector (d x e )) / |d x e |. So if l1 were displaced by this amount in this direction, the two lines would meet at the points on those lines where the lines l1 and l2 are closest.

So a + td ± |((a - b ).(d x e )) / |d x e || * (d x e ) / |d x e | = b + ue This equation can then be solved for t and u to find the points on the lines l1 and l2 where the two lines are closest. Note that the sign on the displacement may be + or - as we don't know which way the unit vector (d x e ) / |d x e | is pointing. There will, however, be a unique solution to the equation as only one of the choices of direction will lead to the two lines intersecting.

Tom.