we define below.

Let $\mathbf{A} \in \operatorname{Gr}(k,n)$ and $\mathbf{B} \in \operatorname{Gr}(l,n)$ respectively. Let $r \coloneqq \min (k,l)$. The $i$th *principal vectors* $(p_{i},q_{i})$, $i=1,\dots,r$, are defined recursively as solutions to the optimization problem$$\begin{tabular}
[c]{rcl}maximize &  & $p^{\mathsf{T}}q$\\
subject to 
&  & $p\in \mathbf{A},\; p^{\mathsf{T}}p_{1}=\dots=p^{\mathsf{T}}p_{i-1}=0,\;\lVert p\rVert=1,$\\
&  & $q\in \mathbf{B}, \; q^{\mathsf{T}}q_{1}=\dots=q^{\mathsf{T}}q_{i-1}=0,\;\lVert q\rVert=1,$\end{tabular}$$ for $i=1,\dots,r$. The *principal angles* are then defined by$$\cos\theta_{i}=p_{i}^\mathsf{T}q_{i}, \quad i = 1,\dots,r.$$ Clearly $0\le \theta_{1}\leq\dots\leq\theta_r \le \pi/2$. We will let $\theta_i(\mathbf{A},\mathbf{B})$ denote the $i$th principal angle between $\mathbf{A} \in \operatorname{Gr}(k,n)$ and $\mathbf{B} \in \operatorname{Gr}(l,n)$.

Principal vectors and principal angles may be readily computed using <span style="font-variant:small-caps;">qr</span> and <span style="font-variant:small-caps;">svd</span> [@BG; @GVL]. Let $A = [a_1,\dots,a_k]$ and $B =[ b_1,\dots, b_l]$ be orthonormal bases and let $$\label{eq:svd}
A^\mathsf{T} B = U\Sigma V^\mathsf{T}$$ be the full <span style="font-variant:small-caps;">svd</span> of $A^\mathsf{T} B$, i.e., $U \in \operatorname{O}(k)$, $V \in \operatorname{O}(l)$, $\Sigma = \left[\begin{smallmatrix}\Sigma_1 & 0 \\ 0 & 0 \end{smallmatrix}\right]\in \mathbb{R}^{k \times l}$ with $\Sigma_1 = \operatorname{diag}(\sigma_1,\dots,\sigma_r) \in \mathbb{R}^{r \times r}$ where $\sigma_1 \ge \dots \ge \sigma_{r} \ge 0$.

The principal angles $\theta_{1}\leq\dots\leq\theta_{r}$ are given by $$\label{eq:angles}
\theta_i = \cos^{-1} \sigma_i, \quad i = 1,\dots,r.$$ It is customary to write $A^\mathsf{T} B = U (\cos\Theta) V^\mathsf{T}$, where $\Theta = \operatorname{diag}(\theta_1,\dots,\theta_{r},1,\dots,1) \in \mathbb{R}^{k 