TITLE: Principal angles between subspaces
QUESTION [7 upvotes]: Let $A$, $B$ be $k$-dimensional subspaces of an Euclidean space  $V$ of dimension $\geq 2k$. How to find an orthonormal system $x_1,...,x_{2k}$ in $V$ and numbers $\phi_1,...,\phi_k \in [0,\frac{\pi}{2}]$ such that $\{x_1,...,x_k \} $ is a basis (obviously orthonormal) in $A$ and  $\{ x_1\cos \phi_1 +x_{k+1} \sin\phi_1,...,x_k\cos \phi_k +x_{2k}\sin \phi_k \} $ is a basis (orthonormal) of $B$?
I wish a proof or references. I'm not interested in the original Jordan proof from 1875.
Thanks.

REPLY [4 votes]: Start with arbitrary orthonormal bases $\vec{p}_1$, ..., $\vec{p}_k$ and $\vec{q}_1$, ..., $\vec{q}_k$ of $A$ and $B$ respectively. Let $P$ and $Q$ be the matrices with columns $\vec{p}_i$ and $\vec{q}_j$, so $A$ and $B$ are the images of $P$ and $Q$ and $P^T P = Q^T Q = \mathrm{Id}_k$.
Let $G = P^T Q$, so $G_{ij} = \vec{p}_i \cdot \vec{q}_j$. Compute the singular value decomposition $G = U^T \mathrm{diag}(\sigma_1, \sigma_2,\ldots, \sigma_k) V$. Replace $P$ by $P' := PU^T$ and $Q$ by $Q' = QV^T$, with columns $\vec{p}'_i$ and $\vec{q}'_j$. Then the $\vec{p}'_i$ and $\vec{q}'_j$ are likewise orthonormal bases of $A$ and $B$ and now we have
$$\vec{p}'_i \cdot \vec{q}'_j = \begin{cases} \sigma_j & i =j \\ 0 & i \neq j \\ \end{cases}.$$
Since singular values are nonnegative by definition and $\sigma_j$ is the dot product of two unit vectors, we have $0 \leq \sigma_j \leq 1$. Assuming $A \cap B=(0)$, which I believe the OP intended, we have $\sigma_j < 1$.
Let $\theta_j = \cos^{-1} (\sigma_j)$, so $0 < \theta_j \leq \tfrac{\pi}{2}$. So $\theta_j$ is the angle between $\vec{p}'_j$ and $\vec{q}'_j$. Put 
$$\vec{q}'_j = (\cos \theta_j) \vec{p}'_j + (\sin \theta_j) \vec{r}_j. $$
Then $\vec{p}'_1$, ..., $\vec{p}'_k$, $\vec{r}_1$, ..., $\vec{r}_k$ is orthonormal and  $\vec{q}'_j$ is a linear combination of $\vec{p}'_j$ and $\vec{r}_j$ as desired.