Elementary geometry question: How to calculate distance between two skew lines? I am helping someone with highschool maths but I got stacked in a elementary geometry problem.
I am given the equation of two straigh lines in the space $r\equiv \begin{cases} x=1 \\ y=1 \\z=\lambda -2 \end{cases}$ and $s\equiv\begin{cases} x=\mu \\ y=\mu -1 \\ z=-1\end{cases}$ and asked for some calculations. First I am asked the relative position of them so I get they are skew lines. After that I am asked for the distance between the two lines. In order to get the distance I have to calculate the line that is perpendicular to both of them in the "skewing" point, check the points where it touches the other two lines (sorry, not sure about the word in English) and calculate the module of this vector.
Im having trouble calculating the perpendicular line. I know I can get the director vector using vectorial product, but  I'm not sure how to find a point so that I can build the line.
 A: The first line is parallel to the z axis and goes through the point $(1,1,0)$. The second line is contained in the plane $z=-1$ so the first line is perpendicular to the plane where the second one is contained.
Therefore you can just work in the plane $z=-1$ and consider the second line of equation $y=x-1$. In this plane, the trace of the first line is the point $(1,1)$, so you just have to find the distance between the line $y=x-1$ and this point.
Now the line perpendicular to $y=x-1$ and going through $(1,1)$ has equation $y=-x+2$.
The intersection point between both lines is the point $(3/2,1/2)$. Finally the distance is: $d=\sqrt{(1-3/2)^2+(1-1/2)^2}=\sqrt{2}/2$.
A: $\def\v{\mathbf v}\def\d{\mathbf d}$
The general expression can be computed as follows. Let the lines be given as:
$$
x=x_i+a_it,\quad y=y_i+b_it,\quad z=z_i+c_it
$$
with $i=1,2$.
Then the vector perpendicular to both given lines can be found from:
$$
\v_3=\v_1\times\v_2=\begin{vmatrix}
i&j&k\\
a_1&b_1&c_1\\
a_2&b_2&c_2\\
\end{vmatrix}
=(b_1c_2-c_1b_2,c_1a_2-a_1c_2,a_1b_2-b_1c_2).
$$
Now the distance $D$ between the lines can be found as the projection of the vector
$$
\d=(x_2-x_1,y_2-y_1,z_2-z_1)
$$
onto $\v_3$:
$$
D=\frac{|\v_3\cdot\d|}{|\v_3|}=\frac{|(b_1c_2-c_1b_2)(x_2-x_1)
+(c_1a_2-a_1c_2)(y_2-y_1)+(a_1b_2-b_1c_2)(z_2-z_1)|}{\sqrt{(b_1c_2-c_1b_2)^2+(c_1a_2-a_1c_2)^2+(a_1b_2-b_1c_2)^2}}.
$$
