The concept of angles between lines (in the plane or in space), between two planes (dihedral angle) or between a line and a plane can be generalized to arbitrary dimensions. This generalization was first discussed by Camille Jordan. For any pair of flats in a Euclidean space of arbitrary dimension one can define a set of mutual angles which are invariant under isometric transformation of the Euclidean space. If the flats do not intersect, their shortest distance is one more invariant. These angles are called canonical or principal. The concept of angles can be generalized to pairs of flats in a finite-dimensional inner product space over the complex numbers.
Let
F
G
k
l
n
En
F
G
F
G
G
G
F
F
G
x1,...,x\rho,
y1,...,y\sigma,
z1,...,z\tau,
u1,...,u\upsilon,
v1,...,v\alpha,
w1,...,w\alpha
En
F
G
x1=0,...,x\rho=0,
u1=0,...,u\upsilon=0,
v1=0,...,v\alpha=0
and
x1=0,...,x\rho=0,
z1=0,...,z\tau=0,
v1\cos\theta1+w1\sin\theta1=0,...,v\alpha\cos\theta\alpha+w\alpha\sin\theta\alpha=0
with
0<\thetai<\pi/2,i=1,...,\alpha
\thetai
F
G
The non-negative integers
\rho,\sigma,\tau,\upsilon,\alpha
\rho+\sigma+\tau+\upsilon+2\alpha=n,
\sigma+\tau+\alpha=k,
\sigma+\upsilon+\alpha=\ell.
For these equations to determine the five non-negative integers completely, besides the dimensions
n,k
\ell
\alpha
\thetai
\sigma
yi
F
G
\sigma
F\capG
\thetai
\sigma
0
F\capG
Jordan's proof applies essentially unaltered when
En
n
Cn
Cn
Now let
F
G
n
F
G
\xi
\hat\xi
\xi
\haty1,...,\haty\sigma,
\hatw1,...,\hatw\alpha,
\hatz1,...,\hatz\tau
F
\haty1,...,\haty\sigma,
\hatw'1,...,\hatw'\alpha,
\hatu1,...,\hatu\upsilon
G
\hatw'i=\hatwi\cos\thetai+\hatvi\sin\thetai, i=1,...,\alpha.
Being related to canonical coordinates, these basic vectors may be called canonical.
When
ai,i=1,...,k
F
bi,i=1,...,l
G
\langleai,bj\rangle
i
j
\begin{align} &\langle\hatyi,\hatyi\rangle=1,&&i=1,...,\sigma,\\ &\langle\hatwi,\hatw'i\rangle=\cos\thetai,&&i=1,...,\alpha. \end{align}
With the above ordering of the basic vectors, the matrix of the inner products
\langleai,bj\rangle
(a'i,i=1,...,k)
(b'i,i=1,...,\ell)
F
G
(a'i)
(ai)
(b'i)
(bi)
\langlea'i,b'j\rangle
\langleai,bi\rangle
\hatyi
\hatwi
\hatw'i
\hatvi
\hatwi
\thetai
\hatw'i
\hatvi
A singular value
1
\cos0
0
F\capG
0
\cos\pi/2
F\capG\bot
F\bot\capG
\bot
The variational characterization of singular values and vectors implies as a special case a variational characterization of the angles between subspaces and their associated canonical vectors. This characterization includes the angles
0
\pi/2
Let
V
l{U},l{W}
\dim(l{U})=k\leq\dim(l{W}):=\ell
k
0\le\theta1\le\theta2\le … \le\thetak\le\pi/2
\theta1:=min\left\{\arccos\left(\left.
|\langleu,w\rangle| | |
\|u\|\|w\| |
\right)\right|u\inl{U},w\inl{W}\right\}=\angle(u1,w1),
where
\langle ⋅ , ⋅ \rangle
\| ⋅ \|
u1
w1
The other principal angles and vectors are then defined recursively via
\thetai:=min\left\{\left.\arccos\left(
|\langleu,w\rangle| | |
\|u\|\|w\| |
\right)\right|u\inl{U},~w\inl{W},~u\perpuj,~w\perpwj \forallj\in\{1,\ldots,i-1\}\right\}.
This means that the principal angles
(\theta1,\ldots,\thetak)
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
l{U}
l{W}
l{U}
l{W}
\theta1=\theta2=0
\theta1=0
u1
w1
l{U}\capl{W}
\theta2>0
l{U}
l{W}
l{U}\capl{W}
\theta2>0
In 4-dimensional real coordinate space R4, let the two-dimensional subspace
l{U}
u1=(1,0,0,0)
u2=(0,1,0,0)
l{W}
2} | |
w | |
1=(1,0,0,a)/\sqrt{1+a |
2} | |
w | |
2=(0,1,b,0)/\sqrt{1+b |
a
b
|a|<|b|
u1
w1
\theta1
2} | |
\cos(\theta | |
1)=1/\sqrt{1+a |
u2
w2
\theta2
2}. | |
\cos(\theta | |
2)=1/\sqrt{1+b |
To construct a pair of subspaces with any given set of
k
\theta1,\ldots,\thetak
2k
l{U}
(e1,\ldots,ek)
(e1,\ldots,en)
n\geq2k
l{W}
(\cos(\theta1)e1+\sin(\theta1)ek+1,\ldots,\cos(\thetak)ek+\sin(\thetak)e2k).
\pi/2
\pi/2
0
\pi/2
l{U}
l{W}
l{U}
l{W}\perp
\pi/2
The notion of the angles and some of the variational properties can be naturally extended to arbitrary inner products and subspaces with infinite dimensions.
Historically, the principal angles and vectors first appear in the context of canonical correlation and were originally computed using SVD of corresponding covariance matrices. However, as first noticed in, the canonical correlation is related to the cosine of the principal angles, which is ill-conditioned for small angles, leading to very inaccurate computation of highly correlated principal vectors in finite precision computer arithmetic. The sine-based algorithm fixes this issue, but creates a new problem of very inaccurate computation of highly uncorrelated principal vectors, since the sine function is ill-conditioned for angles close to /2. To produce accurate principal vectors in computer arithmetic for the full range of the principal angles, the combined technique first compute all principal angles and vectors using the classical cosine-based approach, and then recomputes the principal angles smaller than /4 and the corresponding principal vectors using the sine-based approach. The combined technique is implemented in open-source libraries Octave[1] and SciPy[2] and contributed [3] and [4] to MATLAB.