# Homework Help: Min. distance from a line to a line

1. Aug 23, 2014

### spacetimedude

1. The problem statement, all variables and given/known data
A line is inclined at equal angles to the x-, y-, z- axes and passes through the origin. Another line passes through the points (1,2,4) and (0,0,1). Find the minimum distance between the two lines.

2. Relevant equations
d=|(r2-r1).n(hat)|

3. The attempt at a solution

r1=i+j+k
r2=i+2j+4k

n=(i+j+k)x(i+2j+4k)=2i-3j+k
|n|=1/$\sqrt{14}$

d=(1/14)|k.(2i-3j+k)|=1/$\sqrt{14}$

The answer says that the r2=k+λ(i+2j+3k) and the final answer is 1/$\sqrt{6}$.

Could you care to explain why r2=k+λ(i+2j+3k) and when finding n, the answer excludes the lone k in r2=k+λ(i+2j+3k)? Also, when doing these kind of problems, does it matter if d=|(r1-r2).n(hat)| and not d=|(r2-r1).n(hat)|? I'm having difficulties trying to figure out which vector to subtract first.

Thank you

2. Aug 23, 2014

### ehild

r1 and r2 are the directional vectors of the lines in the formula for the distance.

ehild

3. Aug 23, 2014

### pasmith

Straight lines are parametrized by
$$\mathbf{r}(t) = \mathbf{c} + \mathbf{m}t.$$ The direction of the line is determined by the gradient $\mathbf{m}$.

Here the second line is parametrized by $$\mathbf{r}_2(t) = (\mathbf{i} + 2\mathbf{j} + 4\mathbf{k})t + \mathbf{k}(1 - t) = \mathbf{k} + (\mathbf{i} + 2\mathbf{j} + 3 \mathbf{k})t$$ so its gradient is $\mathbf{i} + 2\mathbf{j} + 3 \mathbf{k}$

The minimum distance occurs between two points lying on a line which perpendicular to both $\mathbf{r}_1$ and $\mathbf{r}_2$. Thus the gradient $\mathbf{n}$ of this line is the cross product of the gradients of the first two, ie $$\mathbf{n} = (\mathbf{i} + \mathbf{j} + \mathbf{k}) \times (\mathbf{i} + 2\mathbf{j} + 3\mathbf{k}).$$

Your geometric intuition should tell you that the distance from point A to point B is the same as the distance from point B to point A. Thus if you get different results for $d$ by subtracting $\mathbf{r}_1$ from $\mathbf{r}_2$ and vice-versa then either you are doing something wrong or the formula is nonsensical.

In this case if you are getting different results then you are doing something wrong: since $(\mathbf{r}_2 -\mathbf{r}_1)\cdot \mathbf{n} = -(\mathbf{r}_1 - \mathbf{r}_2) \cdot \mathbf{n}$ it follows that $|(\mathbf{r}_2 -\mathbf{r}_1)\cdot \mathbf{n}| = |(\mathbf{r}_1 - \mathbf{r}_2) \cdot \mathbf{n}|$. If that was not clear then you need to revise the basic properties of the scalar product.

4. Aug 23, 2014

### D H

Staff Emeritus
That's not right. r1 is the displacement vector from the origin to some arbitrary point on line #1, and r2 is the displacement vector from the origin to some arbitrary point on line #2.

What spacetimedude got wrong was his nhat. That's what uses those directional vectors.

It doesn't matter which point you pick. As I wrote above, r2 represents some arbitrary point on line #2. You can pick any point on the line you want and you'll get the same result. The same answer, 1/√6, results whether you use (0,0,1), (1,2,4), or (10,20,31). The obvious choice here is the point (0,0,1).

That expression r2=k+λ(i+2j+3k) represents the set of all points that lie on the second line.

Suppose you know that $\vec p_1$ and $\vec p_2$ are displacement vectors from the origin to two distinct points on some line. Then $\vec p_1 + \alpha (\vec p_2 - \vec p_1)$ where $\alpha$ is some real number will also describe a point on that line.

Here you know that (0,0,1) and (1,2,4) are two points on the second line. The displacement vectors that represent these points are $\vec p_1 = \hat k$ and $\vec p_2 = \hat \imath + 2 \hat \jmath + 4\hat k$. Using $\lambda$ in lieu of my $\alpha$ (it's just a dummy variable) yields $\vec r_2 = \vec p_1 + \lambda (\vec p_2 - \vec p_1) = \hat k + \lambda(\hat \imath + 2 \hat \jmath + 3\hat k)$.

Order doesn't matter. You're taking the absolute value of that inner product. Switch which one you call line #1 and line #2 and you'll get the same result.

5. Aug 23, 2014

### BruceW

I think DH has explained it well. The OP's problem was in calculating n. He should have been taking a cross product of the gradient of the two lines, not the cross product of two specific points that lie on those lines. (and to do this, he needs to work out the gradient of the second line).

6. Aug 23, 2014

### spacetimedude

I've got it! Thanks so much everyone!