Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

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 was working on a set of problems involving finding the shortest distance between two skew lines, which was fine, but then parallel lines showed up. In essence this should be much easier to solve since I do not need to do any cross products. However I quickly got stuck.

Two lines are defined by the following parametric equations: $x=6t$, $y=3+8t$, $z=-1+2t$ and $x=2+3s$, $y=4s$, $z=1+s$ which can be represented as $\vec{a}=\begin{pmatrix} 6t \\ 8t+3 \\2t-1 \end{pmatrix}$ and $\vec{b}=\begin{pmatrix} 2+3s \\ 4s \\1+s \end{pmatrix}$ respectively. Therefore the line between the two is defined by the vector $$\vec{c}=\begin{pmatrix} 6t-3s-2 \\ 8t-4s+3 \\2t-s-2 \end{pmatrix}$$

Since the shortest line between the two lines is perpendicular to both, $\vec a \cdot\vec c=\vec b \cdot\vec c=0$. However , I have tried this and it seems overly complicated for such an easy problem. My initial thought was to find the distance between the initial coordinates of the parametric equations, but those points could be any points on the line. Does anyone have any suggestion on how to continue?

share|cite|improve this question
up vote 5 down vote accepted

Take any two points, one on each line, and form the difference vector $\bf w$ of these points. Then find the projection ${\bf v}_\parallel$ of $\bf w$ onto the direction vector ${\bf v}$ of one of the lines: $$ {\bf v}_\parallel = {{\bf v}\cdot{\bf w}\over ||{\bf v}||^2}{\bf v}. $$ Then the norm of the vector $$ {\bf v}_\perp = {\bf w}-{\bf v_\parallel} $$ is the minimum distance you're seeking.

share|cite|improve this answer
That $v$ at the end... do you cross multiply it? – CodyBugstein Nov 10 '14 at 12:52

Pick a fixed base point on one of the lines, call it $P_0.$ Let one vector $\vec{u}$ be from $P_0$ to another point in the same line (that is, subtract coordinates). Let a second vector $\vec{v}$ be from $P_0$ to any point in the other line. Take $\vec{w}$ to be $\vec{w} = \vec{u} \times \vec{v}.$ So then we take $\vec{t} = \vec{u} \times \vec{w},$ which, if started from $P_0,$ points to the other line orthogonally. It is not necessarily the correct length, but the point $Q_0$ on the other line where the line beginning at $P_0$ in direction $\vec{t}$ hits it is the closest point on the other line to $P_0.$

share|cite|improve this answer

Having read all of your answers they have inspired me to find an alternate solution to those already provided.

As has been mentioned, since the lines are parallel, any arbitrary point on the line will do. For the purpose of this answer let us choose a point on the line defined by vector $\vec a$ when $t=0$. Let us name this point $A(0,3,-1)$. Now that we have a fixed point and a line we can more easily find the shortest distance between the two. Let the line segment connecting point $A$ and vector $\vec b$ be defined as $\vec{v}=\begin{pmatrix} 3s+2 \\ 4s-3 \\s+2 \end{pmatrix}$. Since the shortest distance between the point and the line is when $\vec v$ is orthogonal to $\vec b$, $\vec v \cdot \vec b=0$. Since the direction vector of $\vec b$ is simply $\vec{b}=\begin{pmatrix} 3 \\ 4 \\1 \end{pmatrix}$, $$\begin{pmatrix} 3s+2 \\ 4s-3 \\s+2 \end{pmatrix}\cdot \begin{pmatrix} 3 \\ 4 \\1 \end{pmatrix}=0$$ Therefore $s={2\over 13}$. Now by plugging in $s$ into $\vec v$ we get $\vec{v}=\begin{pmatrix} {32\over 13} \\ {-31\over 13} \\{28\over 13} \end{pmatrix}$ whereas $|\vec v |=\sqrt {213\over 13}={\sqrt{2769}\over13}$ which is the answer.

share|cite|improve this answer
Nice. Perhaps the simplest method here. – David Mitra Jan 3 '12 at 0:45
Can you explain why $v$ has $(2, 3, 2)$? – CodyBugstein Nov 10 '14 at 12:47

since the shortest distance between the two can be realized at any point on one of the lines, we fix a point on one of the lines and minimize, say $$f(t)=|a(t)-b(0)|^2=|(6t-2,8t+3,2t-2)|^2$$ $$=104t^2+16t+17$$ this has a minimum where $f'(t)=208t+16=0$, so $t=-1/13$ and $f(-1/13)=213/13$. this gives a minimum distance of $\sqrt{213/13}$.

share|cite|improve this answer
$f(-1/13)$ should be $213/13$. – David Mitra Jan 3 '12 at 0:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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