Angles between flats explained

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.

Jordan's definition

Let

F

and

G

be flats of dimensions

k

and

l

in the

n

-dimensional Euclidean space

En

. By definition, a translation of

F

or

G

does not alter their mutual angles. If

F

and

G

do not intersect, they will do so upon any translation of

G

which maps some point in

G

to some point in

F

. It can therefore be assumed without loss of generality that

F

and

G

intersect.

x1,...,x\rho,

y1,...,y\sigma,

z1,...,z\tau,

u1,...,u\upsilon,

v1,...,v\alpha,

w1,...,w\alpha

in

En

can then be defined such that

F

and

G

are described, respectively, by the sets of equations

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

. Jordan calls these coordinates canonical. By definition, the angles

\thetai

are the angles between

F

and

G

.

The non-negative integers

\rho,\sigma,\tau,\upsilon,\alpha

are constrained by

\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

and

\ell

and the number

\alpha

of angles

\thetai

, the non-negative integer

\sigma

must be given. This is the number of coordinates

yi

, whose corresponding axes are those lying entirely within both

F

and

G

. The integer

\sigma

is thus the dimension of

F\capG

. The set of angles

\thetai

may be supplemented with

\sigma

angles

0

to indicate that

F\capG

has that dimension.

Jordan's proof applies essentially unaltered when

En

is replaced with the

n

-dimensional inner product space

Cn

over the complex numbers. (For angles between subspaces, the generalization to

Cn

is discussed by Galántai and Hegedũs in terms of the below variational characterization.)

Angles between subspaces

Now let

F

and

G

be subspaces of the

n

-dimensional inner product space over the real or complex numbers. Geometrically,

F

and

G

are flats, so Jordan's definition of mutual angles applies. When for any canonical coordinate

\xi

the symbol

\hat\xi

denotes the unit vector of the

\xi

axis, the vectors

\haty1,...,\haty\sigma,

\hatw1,...,\hatw\alpha,

\hatz1,...,\hatz\tau

form an orthonormal basis for

F

and the vectors

\haty1,...,\haty\sigma,

\hatw'1,...,\hatw'\alpha,

\hatu1,...,\hatu\upsilon

form an orthonormal basis for

G

, where

\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

denote the canonical basic vectors for

F

and

bi,i=1,...,l

the canonical basic vectors for

G

then the inner product

\langleai,bj\rangle

vanishes for any pair of

i

and

j

except the following ones.

\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

is thus diagonal. In other words, if

(a'i,i=1,...,k)

and

(b'i,i=1,...,\ell)

are arbitrary orthonormal bases in

F

and

G

then the real, orthogonal or unitary transformations from the basis

(a'i)

to the basis

(ai)

and from the basis

(b'i)

to the basis

(bi)

realize a singular value decomposition of the matrix of inner products

\langlea'i,b'j\rangle

. The diagonal matrix elements

\langleai,bi\rangle

are the singular values of the latter matrix. By the uniqueness of the singular value decomposition, the vectors

\hatyi

are then unique up to a real, orthogonal or unitary transformation among them, and the vectors

\hatwi

and

\hatw'i

(and hence

\hatvi

) are unique up to equal real, orthogonal or unitary transformations applied simultaneously to the sets of the vectors

\hatwi

associated with a common value of

\thetai

and to the corresponding sets of vectors

\hatw'i

(and hence to the corresponding sets of

\hatvi

).

A singular value

1

can be interpreted as

\cos0

corresponding to the angles

0

introduced above and associated with

F\capG

and a singular value

0

can be interpreted as

\cos\pi/2

corresponding to right angles between the orthogonal spaces

F\capG\bot

and

F\bot\capG

, where superscript

\bot

denotes the orthogonal complement.

Variational characterization

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

and

\pi/2

introduced above and orders the angles by increasing value. It can be given the form of the below alternative definition. In this context, it is customary to talk of principal angles and vectors.

Definition

Let

V

be an inner product space. Given two subspaces

l{U},l{W}

with

\dim(l{U})=k\leq\dim(l{W}):=\ell

, there exists then a sequence of

k

angles

0\le\theta1\le\theta2\le\le\thetak\le\pi/2

called the principal angles, the first one defined as

\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

is the inner product and

\|\|

the induced norm. The vectors

u1

and

w1

are the corresponding principal vectors.

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)

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

l{U}

and

l{W}

generate a set of two angles. In a three-dimensional Euclidean space, the subspaces

l{U}

and

l{W}

are either identical, or their intersection forms a line. In the former case, both

\theta1=\theta2=0

. In the latter case, only

\theta1=0

, where vectors

u1

and

w1

are on the line of the intersection

l{U}\capl{W}

and have the same direction. The angle

\theta2>0

will be the angle between the subspaces

l{U}

and

l{W}

in the orthogonal complement to

l{U}\capl{W}

. Imagining the angle between two planes in 3D, one intuitively thinks of the largest angle,

\theta2>0

.

Algebraic example

In 4-dimensional real coordinate space R4, let the two-dimensional subspace

l{U}

be spanned by

u1=(1,0,0,0)

and

u2=(0,1,0,0)

, and let the two-dimensional subspace

l{W}

be spanned by
2}
w
1=(1,0,0,a)/\sqrt{1+a
and
2}
w
2=(0,1,b,0)/\sqrt{1+b
with some real

a

and

b

such that

|a|<|b|

. Then

u1

and

w1

are, in fact, the pair of principal vectors corresponding to the angle

\theta1

with
2}
\cos(\theta
1)=1/\sqrt{1+a
, and

u2

and

w2

are the principal vectors corresponding to the angle

\theta2

with
2}.
\cos(\theta
2)=1/\sqrt{1+b

To construct a pair of subspaces with any given set of

k

angles

\theta1,\ldots,\thetak

in a

2k

(or larger) dimensional Euclidean space, take a subspace

l{U}

with an orthonormal basis

(e1,\ldots,ek)

and complete it to an orthonormal basis

(e1,\ldots,en)

of the Euclidean space, where

n\geq2k

. Then, an orthonormal basis of the other subspace

l{W}

is, e.g.,

(\cos(\theta1)e1+\sin(\theta1)ek+1,\ldots,\cos(\thetak)ek+\sin(\thetak)e2k).

Basic properties

\pi/2

, there is at least one vector in one subspace perpendicular to the other subspace.

\pi/2

, the subspaces are orthogonal.

Advanced properties

0

and

\pi/2

) angles between two subspaces are the same as the non-trivial angles between their orthogonal complements.

l{U}

and

l{W}

and the corresponding non-trivial angles between the subspaces

l{U}

and

l{W}\perp

sum up to

\pi/2

.

Extensions

The notion of the angles and some of the variational properties can be naturally extended to arbitrary inner products and subspaces with infinite dimensions.

Computation

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.

See also

References

  1. https://octave.sourceforge.io/octave/function/subspace.html Octave function subspace
  2. https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.subspace_angles.html SciPy linear-algebra function subspace_angles
  3. https://www.mathworks.com/matlabcentral/fileexchange/54-subspace-m MATLAB FileExchange function subspace
  4. https://www.mathworks.com/matlabcentral/fileexchange/55-subspacea-m MATLAB FileExchange function subspacea

[5]

[6]

[7]

[8]