Find a Orthogonal Transformation that sends a plane into another Consider $\mathbb{R}^n$.
Define $U=\{x\in\mathbb{R}^n|x=\lambda_1u_1+\lambda_2u_2, u_i\in\mathbb{R}^n, \lambda_i\in\mathbb{R}\}$
and $V=\{x\in\mathbb{R}^n|x=\lambda_1v_1+\lambda_2v_2, v_i\in\mathbb{R}^n, \lambda_i\in\mathbb{R}\}$
Find an orthogonal transformation $T$ that satisfies "$TU = V$" where this means that $T$ sends any $u\in U$ to some $v\in V$ 
Is there a closed form expression for $T$ that can be obtained from $u_i$ and $v_i$?
If not, how can I find it numerically?
 A: Without loss of generality, we can assume that $u_1\perp u_2$ and $v_1\perp v_2$ and $\|u_1\|=\|u_2\|=\|v_1\|=\|v_2\|=1.$ (We can use the Gram-Schmidt process or the QR decomposition to achieve this.)
Now we define the matrix $A\in \mathbb{R}^{2\times 2}$ as follows:
$$
A=
\begin{pmatrix} & u_1^T & \\ & u_2^T & \end{pmatrix}
\begin{pmatrix}  & \\ v_1 & v_2 \\ & \end{pmatrix}
$$
We create the singular-value decomposition of $A$:
$$
A=S_U\Sigma S_V^T
$$
with orthogonal matrices $S_U$ and $S_V$ and a diagonal matrix $\Sigma.$ We define new bases of $U$ and $V$ as follows:
$$
\begin{pmatrix}  & \\ \hat u_1 & \hat u_2 \\ & \end{pmatrix}
=\begin{pmatrix}  & \\ u_1 & u_2 \\ & \end{pmatrix}\cdot S_U
\;\;\mbox{and}\;\;
\begin{pmatrix}  & \\ \hat v_1 & \hat v_2 \\ & \end{pmatrix}
=\begin{pmatrix}  & \\ v_1 & v_2 \\ & \end{pmatrix}\cdot S_V.
$$
As $S_U$ and $S_V$ are orthogonal, we still have orthonormal bases of $U$ and $V:$ $\hat u_1\perp \hat u_2$ and $\hat v_1\perp \hat v_2$ and $\|\hat u_1\|=\|\hat u_2\|=\|\hat v_1\|=\|\hat v_2\|=1.$
In addition, we have 
$$
\begin{pmatrix} & \hat u_1^T & \\ & \hat u_2^T & \end{pmatrix}
\begin{pmatrix}  & \\ \hat v_1 & \hat v_2 \\ & \end{pmatrix}
=
S_U^T
\begin{pmatrix} & u_1^T & \\ & u_2^T & \end{pmatrix}
\begin{pmatrix}  & \\ v_1 & v_2 \\ & \end{pmatrix}
S_V
=
S_U^T A S_V = \Sigma
$$
which means that $\hat u_1 \perp \hat v_2$ and $\hat u_2 \perp \hat v_1$ ($\Sigma$ is a diagonal matrix).
We can now use Householder matrices to send $\hat u_1$ to $\hat v_1$ (or $-\hat v_1$) and $\hat u_2$ to $\hat v_2$ (or $-\hat v_2$).
We define
$$
H_1 = I-2\frac{(\hat u_1\pm\hat v_1)(\hat u_1\pm\hat v_1)^T}{(\hat u_1\pm\hat v_1)^T(\hat u_1\pm\hat v_1)} \\
H_2 = I-2\frac{(\hat u_2\pm\hat v_2)(\hat u_2\pm\hat v_2)^T}{(\hat u_2\pm\hat v_2)^T(\hat u_2\pm\hat v_2)}
$$
(use the appropriate sign to maximize the denominator and to avoid division by zero) and
$$
T=H_1H_2
$$
$H_1$ does not change $\hat u_2$ and $\hat v_2$, it maps $\hat u_1$ to $\hat v_1$ and the other way round. $H_2$ does not change $\hat u_1$ and $\hat v_1$, it maps $\hat u_2$ to $\hat v_2$ and the other way round. Thus, $T$ has all required properties.
