[Math] Distance of two lines in $\mathbb{R}^3$

vector analysisvectors

Using vector methods show that the distance between two non parallel lines $l_1$ and $l_2$ is given by $$d=\frac{|(\overrightarrow{v}_1 – \overrightarrow{v}_2) \cdot (\overrightarrow{ a}_1 \times \overrightarrow{a}_2)|}{||\overrightarrow{a}_1 \times \overrightarrow{a}_2||}$$ where $\vec{v}_1$ and $\vec{v}_2$ are random points of $l_1$ and $l_2$ respectively, and $\vec{a}_1$ and $\vec{a}_2$ are the directions of $l_1$ and $l_2$.

HINT:
We consider the plane that contains $l_1$ and is parallel to $l_2$. Show that $\frac{\vec{a}_1 \times \vec{a}_2}{\|\vec{a}_1 \times \vec{a}_2\|}$ is unit perpendicular to that plane. Then take the projection of $\vec{v}_2-\vec{v}_1$ to that perpendicular direction.

How can the plane that contains $l_1$ be parallel to $l_2$ while the line $l_1$ is non parallel to $l_2$??

$$$$

EDIT:

We consider the plane that contains $l_1$ and is parallel to $l_2$. That means that the plane passes through the point $\overrightarrow{v}_1$ and has as parallel vector the vector $\overrightarrow{a}$.

To find the distance between the two lines, we have to find the distance between the points $\overrightarrow{v}_1$ and $\overrightarrow{v}_2$.

The vectors $\overrightarrow{a}_1$ and $\overrightarrow{a}_2$ produce the plane, so the vector $\overrightarrow{a}_1 \times \overrightarrow{a}_2$ is perpendicular to the plane.

So, the unit perpendicular vector to the plane is $\frac{\overrightarrow{a}_1 \times \overrightarrow{a}_2}{||\overrightarrow{a}_1 \times \overrightarrow{a}_2||}$.

A vector from the plane to the point $\overrightarrow{v}_2$ is $\overrightarrow{v}_2-\overrightarrow{v}_1$.

The distance that we are looking for the length of the projection of this vector onto the normal vector to the plane.

So, $$d=\frac{|(\overrightarrow{v}_1 – \overrightarrow{v}_2) \cdot (\overrightarrow{ a}_1 \times \overrightarrow{a}_2)|}{||\overrightarrow{a}_1 \times \overrightarrow{a}_2||}$$

Is this correct?? Could I improve something at the formulation??

Best Answer

enter image description here

Given two lines in ${\mathbb{R}^3}$ by:

$$\begin{gathered} X = P + r \cdot U \hfill \\ Y = Q + s \cdot V \hfill \\ \end{gathered} $$

Here we use $P,Q \in {\mathbb{R}^3}$ as "starting" points and $U,V \in {\mathbb{R}^3}$ as directions. We take the blue line for our first paramtrization and the orange one for second. Both lines have edges of the cube in common, but different ones. Blue line has bottom face and orange line has top face from the cube in common. So these planes are parallel to each other. Because lines have different directions, they aren't parallel.

We want to calculate the shortest distance of the two given lines. The distance of two arbitrary points (here the red segment) seems not to have shortest lenght. The green segment looks much better.

But what can we say about the green segment? The cube help's us to find the answer quickly: The green segment is that edge of the cube, that joines the blue line with the orange one and is perpendicular with both lines. This makes the green segment very special. But why?

There is one very good reason. From the given directions $U,V \in {\mathbb{R}^3}$ we can build the vector or cross product $U \times V$ and we know the dots from $U \times V$ with $U$ and from $U \times V$ with $V$ are zero. That is $U \times V \bot U$ and $U \times V \bot V$. This is important for our calculation. Let's go:

The red segment starts in point $X$ from the blue line and ends in point $Y$ from the orange line. We write for direction vector from $X$ towards $Y$: $$\begin{gathered} \overrightarrow {XY} = Y - X \hfill \\ \overrightarrow {XY} = s \cdot V - r \cdot U + \overrightarrow {PQ} \hfill \\ \end{gathered} $$ And of course, here $\overrightarrow {PQ} = Q - P$ is the vector which starts in $P$ and ends in $Q$.

For the green segment we use point $A$ from the blue line as starting point and $B$ from the orange line as ending point. And we write $\overrightarrow {AB} = B - A$ as usual for direction.

But, do you remember? $\overrightarrow {AB} $ has same direction as $U \times V$! We can say this more precise:

$$\overrightarrow {AB} = t \cdot U \times V$$ for a number $t \in \mathbb{R}$.

And now, we want the direction $\overrightarrow {XY} $ to be $\overrightarrow {AB} $. Well that is

$$\begin{gathered} \overrightarrow {AB} = \overrightarrow {XY} \hfill \\ \hfill \\ t \cdot U \times V = s \cdot V - r \cdot U + \overrightarrow {PQ} \hfill \\ \end{gathered}$$

Why are we doing this? We want to find that number $t \in \mathbb{R}$. And in less than a second, we are done. Applying the dot with $U \times V$ in last equation gives instantly: $$\begin{gathered} t \cdot \left( {U \times V \cdot U \times V} \right) = s \cdot \left( {V \cdot U \times V} \right) - r \cdot \left( {U \cdot U \times V} \right) + \overrightarrow {PQ} \cdot U \times V \hfill \\ \hfill \\ t \cdot {\left\| {U \times V} \right\|^2} = \overrightarrow {PQ} \cdot U \times V \hfill \\ \end{gathered} $$

because $U \cdot U \times V = V \cdot U \times V = 0$. At this point we can't calculate on without an assumption. To eliminate for $t$ we have to divide with ${\left\| {U \times V} \right\|^2}$. If the directions $U,V \in {\mathbb{R}^3}$ for our lines are linear independent, then $U \times V \ne \vec 0$ and has a length different from zero. So we get for $t$:

$$t = \frac{{\overrightarrow {PQ} \cdot U \times V}}{{{{\left\| {U \times V} \right\|}^2}}}$$

And also we get the shape for $$\overrightarrow {AB} = \frac{{\overrightarrow {PQ} \cdot U \times V}}{{{{\left\| {U \times V} \right\|}^2}}} \cdot U \times V$$

What about the length for this $\overrightarrow {AB} $? Here it is:

$$\begin{gathered} \overrightarrow {AB} \cdot \overrightarrow {AB} = {\left\| {\overrightarrow {AB} } \right\|^2} = \frac{{\overrightarrow {PQ} \cdot U \times V}}{{{{\left\| {U \times V} \right\|}^2}}} \cdot \frac{{\overrightarrow {PQ} \cdot U \times V}}{{{{\left\| {U \times V} \right\|}^2}}} \cdot {\left\| {U \times V} \right\|^2} \hfill \\ \hfill \\ {\left\| {\overrightarrow {AB} } \right\|^2} = \frac{{{{\left( {\overrightarrow {PQ} \cdot U \times V} \right)}^2}}}{{{{\left\| {U \times V} \right\|}^2}}} \hfill \\ \hfill \\ \left\| {\overrightarrow {AB} } \right\| = \frac{{\left| {\overrightarrow {PQ} \cdot U \times V} \right|}}{{\left\| {U \times V} \right\|}} \hfill \\ \end{gathered} $$

And if we re-write: $\overrightarrow {PQ} = Q - P$

$$\left\| {\overrightarrow {AB} } \right\| = \frac{{\left| {(Q - P) \cdot U \times V} \right|}}{{\left\| {U \times V} \right\|}}$$

So: Given two lines in $\phi ,\psi \subset {\mathbb{R}^3}$ with points $P,Q \in {\mathbb{R}^3}$ and directions $U,V \in {\mathbb{R}^3}$, that are of shape: $$\begin{gathered} \phi = P + r \cdot U \hfill \\ \psi = Q + s \cdot V \hfill \\ \end{gathered}$$ then, if $U$ and $V$ are linear independent, their distance is given by:

$$d(\phi ,\psi ) = \frac{{\left| {(Q - P) \cdot U \times V} \right|}}{{\left\| {U \times V} \right\|}}$$

In my opinion it's important to make a difference between points and vectors. Because points are no vectors. Points can not be added. The difference between two points is a vector. And if I add to a point a vector I get a point. In your formula I would replace "vectors" $\overrightarrow {{v_1}} ,\overrightarrow {{v_2}} $ by points, because these are points. And points didn't have overarrows.

Thank you for listening!

Related Question