Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know how to find the distance between a point and a line, not between two lines.

Find the shortest distance between the lines $(-1,1,4) + t(1,1,-1)$ and $(5,3,-3) + s(-2,0,1)$

Any help would be appreciated.

share|cite|improve this question
Can you use differential calculus? – DonAntonio Oct 11 '12 at 3:20
No, I cannot, I think I may have figured it out by doing the do product of the vectors t and s with the cross product of s and t, then subtracting them. Incidentally the shortest distance is 0, I believe. – Unknown Oct 11 '12 at 3:25
up vote 3 down vote accepted

Let $x_1$ and $y_1$ be 2 points on the line 1 and line 2 respectively. Form the difference vector $d=x_1-y_1$. Take another point $x_2$ on the line 1. Form the direction vector $x=x_1-x_2$. Project $d$ on to the direction vector $x$.

\begin{align} x_{parallel}= \frac{(d.x)}{||x||^2}x \end{align}

Now the norm of the following vector (the euclidean distance from the origin), will give you the required minimum distance.

\begin{align} x_{perp}= d-x_{parallel} \end{align}

(if they are not parallel, this will not work, instead it gives the shortest distance between the point $x_1$ and line 2.)

share|cite|improve this answer

The distance between two lines in $ \Bbb R^3 $ is equal to the distance between parallel planes that contain these lines.

To find that distance first find the normal vector of those planes - it is the cross product of directional vectors of the given lines. For the normal vector of the form (A, B, C) equations representing the planes are:

$ Ax + By + Cz + D_1 = 0 $
$ Ax + By + Cz + D_2 = 0 $

Take coordinates of a point lying on the first line and solve for D1.
Similarly for the second line and D2.

The distance we're looking for is: $$d = \frac{|D_1 - D_2|}{\sqrt{A^2 + B^2 + C^2}}$$

share|cite|improve this answer

the answer is a little tricky, first use cross product to find n by using the two direction vector.$(d1*d2)$, |i,j,k 1,1,-1 -2,0,1| = $i+j+2k$. then let point $p$ and $s$ be on the two line respectively, find vector $ps. = (5,-3,-3)-(-1,1,4) = (6,2,-7)$ then find the projection of $ps$ onto $n$ and find the length of the projection. $(6,2,-7) \cdot \frac{(1,1,2)}{||1,1,2||^2}= 6^{1/2},$ or $2.44949.$

share|cite|improve this answer
You should use MathJax to formulate your answer so that is easier to read. There is a guide at…. – Marconius Nov 6 '15 at 22:48

protected by Zev Chonoles Nov 6 '15 at 22:50

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.