Finding perpendicular lines in $\mathbb R^4$ Let $$g=\begin{pmatrix}2\\-5\\-3\\-3\end{pmatrix}+\mathbb R\begin{pmatrix}1\\2\\3\\4\end{pmatrix}$$ and $$h=\begin{pmatrix}1\\-3\\0\\-1\end{pmatrix}+\mathbb R\begin{pmatrix}2\\3\\4\\5\end{pmatrix}.$$

*

*Find all lines that are perpendicular to both $g$ and $h$.

*Find the smallest affine subspace in $\mathbb R^4$ that contains both $g$ and $h$.


As for 1: One can easily see that the two lines are skew. Now, if $v_g$ and $v_h$ are the direction vectors of the lines I am first interested in a base of $U^\perp$ where $U=\langle v_g,v_h\rangle$. I got $$U^\perp=\left\langle\begin{pmatrix}2\\-3\\0\\1\end{pmatrix},\begin{pmatrix}-1\\1\\1\\-1\end{pmatrix}\right\rangle=:\langle v_1,v_2\rangle.$$ So now we should get two perpendecular lines $$l_1=p_1+\mathbb R v_1\quad\text{ and }\quad l_2=p_2+\mathbb R v_2$$ and need to find $p_1$ and $p_2$.
We can parametrize $g$ via
$$
\vec{P}_{\lambda}=\left(\begin{array}{c}
2+\lambda\\
-5+2\lambda\\
-3+3\lambda\\
-3+4\lambda
\end{array}\right)
$$
and $h$ via
$$
\vec{G}_{\mu}=\left(\begin{array}{c}
1+2\mu\\
-3+3\mu\\
4\mu\\
-1+5\mu
\end{array}\right).
$$
So the connection of $g$ and $h$ has the direction vector
$$
v=\overrightarrow{P_{\lambda}G_{\mu}}=\left(\begin{array}{c}
-1+2\mu-\lambda\\
2+3\mu-2\lambda\\
3+4\mu-3\lambda\\
2+5\mu-4\lambda
\end{array}\right).
$$
The condition $v\perp g$ and $v\perp h$ yields
$$
\left\langle \left(\begin{array}{c}
-1+2\mu-\lambda\\
2+3\mu-2\lambda\\
3+4\mu-3\lambda\\
2+5\mu-4\lambda
\end{array}\right),\left(\begin{array}{c}
1\\
2\\
3\\
4
\end{array}\right)\right\rangle =0=\left\langle \left(\begin{array}{c}
-1+2\mu-\lambda\\
2+3\mu-2\lambda\\
3+4\mu-3\lambda\\
2+5\mu-4\lambda
\end{array}\right),\left(\begin{array}{c}
2\\
3\\
4\\
5
\end{array}\right)\right\rangle 
$$
and thus,
$$
20+40\mu-30\lambda=0\,\,\,\,\,\,\,\,\,\,\text{and}\,\,\,\,\,\,\,\,\,26+54\mu-40\lambda=0.
$$
The solution of this system of linear equations is given by $\mu=1$
and $\lambda=2.$ With that, we find
\begin{align*}
l_{1} & =\vec{P}_{2}+\mathbb{R}\overrightarrow{P_{2}G_{1}}\\
 & =\left(\begin{array}{c}
4\\
-1\\
3\\
5
\end{array}\right)+\mathbb{R}\left(\begin{array}{c}
-1\\
1\\
1\\
-1
\end{array}\right).
\end{align*}
Is this correct so far? But how do I get the second one?
As for 2: For the smallest subspace that contains both $g$ and $h$ I would take $g+v$ where $v$ is the direction vector between $g$ and $h$ as mentioned above. Does this make sense?
 A: Question 1
Your answer to the first question starting at We can parametrize $g$ via... looks good and you found the unique solution line.
The first part is wrong. You indeed computed well $U^\perp$. This space is of dimension $2$. That doesn't mean that there is two solutions. But just that the direction of the solutions belong to $U^\perp$.
Question 2
The smallest affine subspace is the one passing through $P_g$ and having for direction $Vect\{\vec{P_g P_h}, v_g,v_h\}$. This is an affine hyperplane.
The equation of such an affine hyperplane is
$$ax+by+cz+dt+e=0$$ and you need to find $a,b,c,d,e$. Which can be done by writing that $\vec{P_g P_h}, v_g,v_h$ belong to the associated vector hyperplane $ax+by+cz+dt=0$ while $P_g$ belongs to the affine hyperplane.
Leading (if I avoided computation mistakes...) to the equations
$$\begin{cases}
x &+2y &+3z &+4t & &= 0\\
2x &+3y &+4z &+5t & &=0\\
-x &+2y &+3z &+2t & &=0\\
2x &-5y &-3z &-3t &+ e &=0\\
\end{cases}$$
And finally to the affine hyperplane of equation
$$-x +3y-3z+t+11=0$$
