# Distance between 2 lines

1. Jun 21, 2013

### nameVoid

when trying to find the distance between 2 skew lines i see how we can take the a vector between points on each and the cross product of the direction vectors to find the distance but is this looks only to be the distance from one line to a particular point on the other

2. Jun 21, 2013

### nameVoid

my question is if this is the shortest distance between the lines it does not appear to me that it is when using arbritrary points on each line

3. Jun 22, 2013

### verty

I see what you mean, you are correct, it won't be the shortest distance. The vector must be perpendicular to both lines to give the shortest distance. Can you think of a way to find a vector perpendicular to both lines?

4. Jun 22, 2013

### Solkar

It's not right ahead the minimal distance d between the lines g_1, g_2 you find by selecting those arbitrary points p_1, p_2 on each, you do this for getting representations of the parallel planes to be constructed:

A plane P can be described in many ways, one of them is
- a normal n
- and a fixed value λ, for which

<n,p> = λ (¹)

holds for all p ∈ P:

Given one point p in the plane for which <n,p> yields a certain value λ(p)
Now consider a second point q ∈ P:

The vector
r := qp
is parallel to the plane, thus it's orthogonal to n
<n, r> = 0

With
λ(q) := <n,q> = <n, p + r> = <n, p> + <n, r>,
the last "=" due to bi-linearity of <.,.>
one gets
λ(q) = <n,q> = <n, p> + 0 = <n,p> = λ(p).

So the, seemingly arbitrary, λ(p), we found is actually the plane-specific λ we've been looking for.

---

Because finding the minimal distance d between the lines g_1 and g_2 is equivalent to finding the distance of the constructed parallel planes p_1, p_2 , one gets for d
d = abs(λ_1 - λ_2),

¹For shortness sake, I do not distinguish points from vectors here

Last edited: Jun 22, 2013
5. Jun 23, 2013

### HallsofIvy

The "shortest distance between two lines" (also know as the distance between the two lines. When we have regions that have more than one line between them, by "the distance" between them we typically mean the shortest distance between them) is measured along the line perpendicular to both lines. And that means that the line must line in the unique plane perpendicular to both.

As an example, suppose the lines are given by the equations x= t+ 3, y= 2t- 1, z= 3t and x= 2s+1, y= s- 2, z= s+ 4. Any plane perpendicular to the first line is of the form x+ 2y+ 3z= A, for some number, A, and any plane perpendicular to the second line is of the form 2x+ y+ z= B, for some number B. Find A and B such that those are the same plane and find the distance between the points where the two lines intersect each other.

6. Jun 26, 2013

### nameVoid

so the cross product between 2 vectors is always perpendicular to both vectors but what about the length of this vector

Last edited: Jun 26, 2013
7. Jun 26, 2013

### HallsofIvy

No, the shortest distance between two points is a number. It is measured along a straight line. And the topic here is the shortest distance between to skew lines, not two points.

8. Jun 26, 2013

### nameVoid

it would be obviously the shortest distance between two parrallel linesbut considering two skew lines where the distance varies

Last edited: Jun 26, 2013
9. Jun 26, 2013

### haruspex

The length of the cross-product is not necessarily what you want.
You need to start by specifying the form in which the two lines are defined. Something like r00s0, r11s1?

10. Jun 27, 2013

### HallsofIvy

The length of the cross product is not relevant. If you are given the two lines as <x, y, z>= <a, b, c>+ <d, e, f> t and <x, y, z>= <p, q, r>+ <u, v, w> s, then <a, b, c> and <u, v, w> are vectors in the direction of the two lines. Their cross product is perpendicular to both and so perpendicular to the plane you want to find.

11. Jun 27, 2013

### LCKurtz

Let's say you divide the cross product of the two direction vectors by its length to make at a unit vector $\hat n$ perpendicular to both lines. Then if $P_0,\, P_1$ are points, one on each line, and you let $\vec V=\overline{P_0P_1}$ be the vector displacement between the points, then the distance $d$ between the lines is$$d =|\vec V \times \hat n|$$The advantage of this formula is that you are normally given two points and two direction vectors, and you don't need anything else.

 Typo alert, that should be $d =|\vec V \cdot \hat n|$

Last edited: Jun 27, 2013
12. Jun 27, 2013

### haruspex

<d, e, f> and <u, v, w>

13. Jun 27, 2013

### nameVoid

if v=p0p1 then d=|v|cost=v.(axb)/|axb| now this is obviously the length of v is not going to be constant with arbtrary points

14. Jun 27, 2013

### LCKurtz

Please quote the post to which you are responding. It it's mine there was a typo. Still, what is your point?

Last edited: Jun 27, 2013
15. Jun 27, 2013

### haruspex

As far as I can see, you have still not given an explicit statement of the vector form in which the two lines are specified. Is it a pair of points on each line? One point plus a direction vector for each line? Something else?

16. Jun 29, 2013

### nameVoid

well we have p0 and p1 as points on each line and vectors a and b as directions

17. Jun 29, 2013

### haruspex

OK, so you can use the formulae LCKurtz gave you. But LCK was using P0, P1 as labels, not vectors, hence gave the vector form of the line joining them as $\overline{ P_0P_1 }$. If you have p0, p1 as vectors, what will you write instead?
Why not? See what happens if you replace p0 by another point on that line, p0+at.

18. Jun 29, 2013

### nameVoid

length of v is not constant where v is the vector between points d=lvlcost

19. Jun 29, 2013

### nameVoid

the example in the book takes parameter 0 for both lines but again i do not understand how this distance is the shortest distance considering that d is proportional to v

Last edited: Jun 29, 2013
20. Jun 29, 2013

### micromass

nameVoid, could you please quote the post you're replying to? It's a lot easier for us. Just hit "quote" on the right-hand side.