# Principal angles

In linear algebra (mathematics), the principal angles, also called canonical angles, provide information about the relative position of two subspaces of an inner product space. The concept was first introduced by Jordan in 1875.

## Definition

Let $V$ be an inner product space. Given two subspaces $\mathcal{U},\mathcal{W}$ with $\operatorname{dim}(\mathcal{U})=k\leq \operatorname{dim}(\mathcal{W}):=l$, there exists then a sequence of $k$ angles $0 \le \theta_1 \le \theta_2 \le \ldots \le \theta_k \le \pi/2$ called the principal angles, the first one defined as

$\theta_1:=\min \left\{ \arccos \left( \left. \frac{ |\langle u,w\rangle| }{\|u\| \|w\|}\right) \right| u\in \mathcal{U}, w\in \mathcal{W}\right\}=\angle(u_1,w_1),$

where $\langle \cdot , \cdot \rangle$ is the inner product and $\|\cdot\|$ the induced norm. The vectors $u_1$ and $w_1$ are the corresponding principal vectors.

The other principal angles and vectors are then defined recursively via

$\theta_i:=\min \left\{ \left. \arccos \left( \frac{ |\langle u,w\rangle| }{\|u\| \|w\|}\right) \right| u\in \mathcal{U},~w\in \mathcal{W},~u\perp u_j,~w \perp w_j \quad \forall j\in \{1,\ldots,i-1\} \right\}.$

This means that the principal angles $(\theta_1,\ldots \theta_k)$ form a set of minimized angles between the two subspaces, and the principal vectors in each subspace are orthogonal to each other.

## Examples

### Geometric Example

Geometrically, subspaces are flats (points, lines, planes etc.) that include the origin, thus any two subspaces intersect at least in the origin. Two two-dimensional subspaces $\mathcal{U}$ and $\mathcal{W}$ generate a set of two angles. In a three-dimensional Euclidean space, the subspaces $\mathcal{U}$ and $\mathcal{W}$ are either identical, or their intersection forms a line. In the former case, both $\theta_1=\theta_2=0$. In the latter case, only $\theta_1=0$, where vectors $u_1$ and $w_1$ are on the line of the intersection $\mathcal{U}\cap\mathcal{W}$ and have the same direction. The angle $\theta_2>0$ will be the angle between the subspaces $\mathcal{U}$ and $\mathcal{W}$ in the orthogonal complement to $\mathcal{U}\cap\mathcal{W}$. Imagining the angle between two planes in 3D, one intuitively thinks of the largest angle, $\theta_2>0$.

### Algebraic Example

In 4-dimensional real coordinate space R4, let the two-dimensional subspace $\mathcal{U}$ be spanned by $u_1=(1,0,0,0)$ and $u_2=(0,1,0,0)$, while the two-dimensional subspace $\mathcal{W}$ be spanned by $w_1=(1,0,0,a)/\sqrt{1+a^2}$ and $w_2=(0,1,b,0)/\sqrt{1+b^2}$ with some real $a$ and $b$ such that $|a|<|b|$. Then $u_1$ and $w_1$ are, in fact, the pair of principal vectors corresponding to the angle $\theta_1$ with $\cos(\theta_1)=1/\sqrt{1+a^2}$, and $u_2$ and $w_2$ are the principal vectors corresponding to the angle $\theta_2$ with $\cos(\theta_2)=1/\sqrt{1+b^2}$

To construct a pair of subspaces with any given set of $k$ angles $\theta_1,\ldots,\theta_k$ in a $2k$ (or larger) dimensional Euclidean space, take a subspace $\mathcal{U}$ with an orthonormal basis $(e_1,\ldots,e_k)$ and complete it to an orthonormal basis $(e_1,\ldots, e_n)$ of the Euclidean space, where $n\geq 2k$. Then, an orthonormal basis of the other subspace $\mathcal{W}$ is, e.g.,

$(\cos(\theta_1)e_1+\sin(\theta_1)e_{k+1},\ldots,\cos(\theta_k)e_k+\sin(\theta_k)e_{2k}).$

## Basic Properties

If the largest angle is zero, one subspace is a subset of the other.

If the smallest angle is zero, the subspaces intersect at least in a line.

The number of angles equal to zero is the dimension of the space where the two subspaces intersect.