Let $G_1 = \{v_1 + \lambda w_1 | \lambda \in \mathbb{R}\} \subseteq \mathbb{R}^n, G_2 = \{\{v_2 + \mu w_2 |\mu \in \mathbb{R}\}\subseteq \mathbb{R}^n$, with $v_1, v_2, w_1, w_2 \in \mathbb{R}$ be two skew lines, derive a formula for $d(G_1,G_2)= \inf_{P \in G_1, P'\in G_2} \| \vec{PP'}\|$.
My attempt:
Let $P,P'$ be true arbitrary points on $G_1$ and $G_2$ respectively, then $\vec{PP'} = v_2 + \mu w_2 - v_1 - \lambda w_1$
Now my idea was to take the norm $$\|\vec{PP'}\| = (\langle v_2 + \mu w_2 - v_1 - \lambda_1, v_2 + \mu w_2 - v_1 - \lambda w_1 \rangle)^{1/2}$$
, and maximize this with respect to $\lambda$ and $\mu$.
However I get really messy equations and I'm not able to solve for $\lambda$ and $\mu$ which makes me think that there must be an easier approach. Can anybody help please?
Note that I cannot use the fact that two points that are orthogonal to each other are the two points for $d(G_1,G_2)$.