[Math] Shortest Distance between Two Parallel Lines in 3D

3danalytic geometrygeometrylinear algebra

On Wikipedia, I found the following explanation for the distance between two skew lines:

According to me, the logic of the formula should work for parallel lines too. I was trying to tweak the formula (specifically, the unit vector n) to determine the distance between two parallel lines in 3D. As explained there, since we cannot use the cross product of the direction vectors of the parallel lines to find n, I tried to find n using the dot product (x, y, z) · b (or d) = 0, and found values of x, y and z which satisfied the equation. I then substituted n in the formula for d given at the end. However, I always get answers different from those that are found using other formulae (like those on http://goo.gl/4DTDdq or https://goo.gl/WrVGh6).

So, I wanted to know whether I am doing something wrong in determining n. According to me, I should be able to use the same formula (after changing n accordingly for parallel lines) — it makes sense to me geometrically — but it always gives me a different answer.

Best Answer

You can obtain a vector perpendicular to the given parallel lines and lying in the same plane by the product $\mathbf{b}\times((\mathbf{c}-\mathbf{a})\times\mathbf{b})$. Of course to get a unit vector $\mathbf{n}$ you must divide that by its length. So in the end one obtains: $$ d={\mathbf{b}\times((\mathbf{c}-\mathbf{a})\times\mathbf{b}) \over |\mathbf{b}\times((\mathbf{c}-\mathbf{a})\times\mathbf{b})|} \cdot(\mathbf{c}-\mathbf{a})= {|(\mathbf{c}-\mathbf{a})\times\mathbf{b}|^2 \over |\mathbf{b}|\ |(\mathbf{c}-\mathbf{a})\times\mathbf{b}|}= {|(\mathbf{c}-\mathbf{a})\times\mathbf{b}| \over |\mathbf{b}|}, $$ where I used the well known identity $(\mathbf{x}\times\mathbf{y})\cdot\mathbf{z}=(\mathbf{z}\times\mathbf{x})\cdot\mathbf{y}$ and in the denominator I took into account that the length of the cross product of two perpendicular vectors is equal to the product of their lengths.