Line along shortest distance between two skew lines We have points $A(1,-1,1),B(6,-3,1),C(2,-1,5),D(5,1,1)$
We also have a line $p$ that goes through the edges $AD$ and $BC$ perpendicularly.
Find the equation of this line:
My try:
$$AD = (4,2,0)$$
$$BC = (-4,2,4)$$
$$s = (s_1,s_2,s_3)$$
Then we know that(*...scalar product):
$$s*AD = 0$$
$$s*BC = 0$$
From this two equations we get: $$4s_1+2s_2+0s_3 = 0 = -4s_1+2s_2+4s_3 $$
$$ 4s_1+2s_2+0s_3 = 0\\-4s_1+2s_2+4s_3 = 0\\
 \text{We add both equations together }\implies 4s_2 + 4 s_3 = 0 \implies 4s_2 = -4s_3\implies s_2 = -s_3$$
Then we get:
$$4s_1 = 4s_3\implies s_1 = s_3$$
However, when I plug this back into the equation I get zero at the end, which is not correct.
The solution is $p:x - 3 = \frac{y}{-2} = \frac{z-1}{2}$
 A: We have $AD=(2,1,0)$ and $BC=(-2,1,2)$. Direction of $p$ can be found by taking cross-product. This will be found as $(1,-2,2)$.
Now we find a point on $p$. A point on $BC$ is given by $(2,-1,5)+t(-2,1,2)$. A point on $AD$ is given by $(1,-1,1)+s(2,1,0)$.
From a specific point on $BC$, if we travel along $p$, we will arrive at a specific point on $AD$. The second point satisfies
$$(1,-1,1)+s(2,1,0)=(2,-1,5)+t(-2,1,2)+r(1,-2,2)$$
This is a system of linear equations in $r,s,t$ which can be solved easily. The intersection point is indeed found as $(3,0,1)$. Thus $$p : \frac{x-3}{1}=\frac{y-0}{-2}=\frac{z-1}{2}$$
A: Here is another way you can do it -
Points on line $BC$ is given by $(6-2s, -3 + s, 1 + 2s)$ and points on line $AD$ is given by $(1 + 2t, t - 1, 1)$
For some $s$ and $t$, there is a line $p$ that passes through those points on the lines (say $M$ on AD, $N$ on $BC$) perpendicular to both $AD$ and $BC$.
$\vec {MN} = (5-2s-2t, -2 + s - t, 2s)$
$(5-2s-2t, -2 + s - t, 2s) \cdot (2,1,0) = 0 \implies 3s + 5t = 8$
Similarly, $(5-2s-2t, -2 + s - t, 2s) \cdot (-2,1,2) = 0$
$\implies 3s + t = 4$
So $s = t = 1$
Plugging in $\vec{MN}$, we have vector of line $p$ as $(1, -2, 2)$
Point $M$ on line $AD = (3, 0, 1)$
So equation of line $p = (3,0,1) + (1, -2 ,2) t$
or $\displaystyle \frac{x-3}{1} = \frac{y}{-2} = \frac{z-1}{2}$
A: Another method
line $AD:(1,-1,1)+t (4,2,0)$ generic point on $AD$ is $P=(1+4t,-1+2t,1)$
line $BC:(6,-3,1)+u(-4,2,4)$ point on $BC$ is $Q=(6-4u,-3+2u,1+4u)$
$$PQ^2=f(t,u)=(-2 t+2 u-2)^2+(-4 t-4 u+5)^2+16 u^2$$
minimum distance is when
$$\frac{\partial f}{\partial t}=0;\;\frac{\partial f}{\partial u}=0$$
that is
$$
\begin{cases}
5 t+3 u=4\\
t+3 u=2\\
\end{cases}\to t=u=\frac12
$$
So the points having minimum distance on the two lines are
$$P_0=(3,0,1);\;Q_0=(4, -2, 3)$$
and the line $P_0Q_0$ has parametric equation
$$(x,y,z)=(3, 0, 1) + v (1, -2, 2)$$
or
$$
\begin{cases}
2 x=6-y\\
y=1-z\\
\end{cases}
$$
