# Base of shortest connection of two skew straight lines

During tutoring (12th grade, regular Math class), I had to explain how to find the two points $s$ and $s'$ that are the base of the perpendicular connection between two skew straight lines $g$ and $h$.

Where $g$ and $h$ are given respectively as: $$g \colon \mathbb R \to \mathbb R^3; t \mapsto \vec x = \vec x_0 + \vec v_g t$$

What I did is to calculate a normal vector to both $\left(\vec n \propto \vec v_g \times \vec v_h \right)$. Then move $h$ along $\vec n$ so that $h'$ intersects $g$. Then I would just calculate the intersection $s$ of $g$ and $h'$, and move the intersection back down to $h$, yielding $s'$.

Is there any shorter way?

-

The difference $$\vec x_g + \vec v_g s - \vec x_h - \vec v_h s'$$ must be orthogonal to both $\vec v_g$ and $\vec v_h$. This gives a pair of linear equations for $s$ and $s'$. Moreover, the determinant of the system is $\|\vec v_g\|^2 \|\vec v_h\|^2 - (\vec v_g\cdot \vec v_h)^2$, which is $0$ iff the two lines are parallel (or coincident).