# Distance in 3-space between two parallel vectors

I know these two lines are parallel, but I don't know how to find the distance between them. Any suggestions?

Line 1: (3, 4, 7) + {6, 2, 4}t

Line 2: (-1, 5, -1) + {3, 1, 2}t

I tried creating a triangle composed of an orthogonal line to both lines (the shortest distance between the lines), a hypotenuse that connects the two known points (3, 4, 7) and (-1, 5, -1), and a leg that connects (-1, 5, -1) to the intersection of the orthogonal line on line 2. On line 1, the point (3, 4, 7) was the intersection of the orthogonal line and the hypotenuse.

I'm sorry if that doesn't make any sense, I did my best. I have no idea how to include pictures on this website, this is my first post. And this is not a homework assignment, it's a practice problem for a Multivariable Calculus class. I'm studying for a test we have next week. Any and all help is appreciated!

• Thank you all so much! That makes sense, I really appreciate it. – Jake May 27 '16 at 11:25

The brute force approach is to state the distance between two points, one a point on the first, the other a point on the second line, and then minimize: $$d(t_1, t_2) = \lVert L_1(t_1) - L_2(t_2) \rVert \quad (*)$$ where $$L_i(t_i) = a_i + t_i \, b_i$$ is the parameterized equation of line $i$.

It is a bit easier to do this for the square of the distance $$q(t_1, t_2) = d^2(t_1, t_2) = \lVert L_1(t_1) - L_2(t_2) \rVert^2 = \sum_{k=1}^3 \left[ \left( L_1(t_1) - L_2(t_2) \right)_k \right]^2$$ Then calculate where the $t$-gradient of $q$ vanishes to find candidates for local extrema. (So much for the multivariable calculus)

Finally use the found minimizing $t$ parameters to calculate the minimal distance by inserting them into equation $(*)$.

Calculation: \begin{align} q(t_1, t_2) &= (3 + 6 t_1 - (-1 + 3 t_2))^2 + (4 + 2 t_1 - (5 + 1 t_2))^2 + (7 + 4 t_1 - (-1 + 2 t_2))^2 \\ &= (4 + 6 t_1 - 3 t_2)^2 + (-1 + 2 t_1 - t_2)^2 + (8 + 4 t_1 - 2 t_2)^2 \end{align} \begin{align} 0 = \partial q / \partial t_1 &= 2(4 + 6 t_1 - 3 t_2) (6) + 2(-1 + 2 t_1 - t_2) (2) + 2(8 + 4 t_1 - 2 t_2) (4) \\ &= 48 - 4 + 64 + (72+8+32) t_1 + (-36-4-16) t_2 \\ &= 108 + 112 t_1 - 56 t_2 \\ 0 = \partial q / \partial t_2 &= 2(4 + 6 t_1 - 3 t_2) (-3) + 2(-1 + 2 t_1 - t_2) (-1) + 2(8 + 4 t_1 - 2 t_2) (-2) \\ &= -24+2-32 + (-36-4-16)t_1 + (18+2+8)t_2 \\ &= -54 -56 t_1 + 28 t_2 \end{align} The gradient has no unique solution but vanishes along the line $28 t_1 - 14 t_2 = -27$, so this means the two lines are separated by a constant distance, they are parallel.

We pick one pair, a simple one is $t_1 = 0$ which leads to $t_2 = 27/14$. This gives \begin{align} q(0,27/2) &= (4-3\cdot 27/14)^2 + (-1 - 27/14)^2 + (8-2\cdot 27/14)^2 \\ &= \frac{(-25)^2 + (-41)^2 + (58)^2}{14^2} \\ &= \frac{5670}{14^2} \end{align} which gives $d = \sqrt{5670}/14 = 5.37\dotsb$

To find the distance between the lines, take any vector between them and project onto the plane perpendicular to them: if the lines are $p + tv$ and $q+tv$, a shortest vector between the lines is

$$(I-\hat{v}\hat{v}^T)(q-p)$$

and the magnitude is the distance. I believe this is very similar to the triangle that you describe in your post.

$3$-d space is blessed with a cross product. In general try to use the cross product when possible, although it takes some getting used to. In engineering statics, for example, students are taught to think like this and it pays off for the current problem. If two lines are parallel, we can say that $$\vec r_1=\vec p_1+\vec v_1t_1$$ $$\vec r_2=\vec p_2+\vec v_1t_2$$ You might try to imagine a triangle with vertices at $\vec p_1$, $\vec p_2$, and $\vec q$, the nearest point on $\vec r_1$ to $\vec p_2$. This is a right triangle and the distance we need is $$\overline{qp_2}=\overline{p_1p_2}\sin\angle p_2p_1q=\left|\frac{(\vec p_2-\vec p_1)\times\vec v_1}{\left|\left|\vec v_1\right|\right|}\right|$$ If the two lines aren't parallel, $$\vec r_1=\vec p_1+\vec v_1t_1$$ $$\vec r_2=\vec p_2+\vec v_2t_2$$ Then we can view the lines along the line that connects the nearest points on the two lines, $\vec q_1$ and $\vec q_2$. The vector that connects the lines at the nearest points is then $\vec d=\vec q_2-\vec q_1$ and $$\left|\left|\vec d\right|\right|=\left|\vec d\cdot\frac{\vec v_1\times\vec v_2}{\left|\left|\vec v_1\times\vec v_2\right|\right|}\right|$$ and \begin{align}\vec d\cdot(\vec v_1\times\vec v_2)&=(\vec q_2-\vec q_1)\cdot(\vec v_1\times\vec v_2)=(\vec q_2-\vec q_1+\vec q_1-\vec p_1)\cdot(\vec v_1\times\vec v_2)\\ &=(\vec q_2-\vec p_1)\cdot(\vec v_1\times\vec v_2)=(\vec q_2-\vec q_2+\vec p_2-\vec p_1)\cdot(\vec v_1\times\vec v_2)\\ &=(\vec p_2-\vec p_1)\cdot(\vec v_1\times\vec v_2)\end{align} Where adding mulitples of $\vec v_1$ and $\vec v_2$ was no problem because they are orthogonal to $\vec v_1\times\vec v_2$. So the distance formula become simply $$\left|\left|\vec d\right|\right|=\left|(\vec p_2-\vec p_1)\cdot\frac{\vec v_1\times\vec v_2}{\left|\left|\vec v_1\times\vec v_2\right|\right|}\right|$$ Just thinking in terms of the cross product make this kind of problem easy to set up without having to remember lots of formulas.