# The Spectral Theorem

Theorem. (Schur) If A is an matrix, then there is a unitary matrix U such that is upper triangular. (Recall that a matrix is upper triangular if the entries below the main diagonal are 0.)

Proof. Use induction on n, the size of A. If A is , it's already upper triangular, so there's nothing to do.

Take , and assume the result is true for matrices.

Over the complex numbers, the characteristic polynomial of A must have at least one root, so A has an eigenvalue and a corresponding eigenvector :

By dividing by its length, I can assume .

Build a basis with as the first vector, then use Gram-Schmidt to construct an orthonormal basis with as the first vector:

Let

Since the columns are orthonormal, U is unitary. Then

The issue here is why the first column of the last matrix is what it is. To see this, notice that is the matrix of the linear transformation relative to . But

so this is the first column of .

The matrix B is , so by induction I can find a unitary matrix V such that is upper triangular. Then

is unitary, and

is upper triangular.

This completes the induction step.

Theorem. ( The Spectral Theorem) If A is Hermitian, then there is a unitary matrix U and a diagonal matrix D such that

(Note that since U is unitary, .)

Proof. Find a unitary matrix U such that , where T is upper triangular. Then since ,

But then . T is upper triangular, (the conjugate transpose) is lower triangular, so T must be diagonal.

Corollary. ( The Principal Axis Theorem) If A is a real symmetric matrix, there is an orthogonal matrix O and a diagonal matrix D such that

(Note that since O is orthogonal, .)

Proof. Real symmetric matrices are Hermitian and real orthogonal matrices are unitary, so the result follows from the Spectral Theorem.

I showed earlier that for a Hermitian matrix (or in the real case, a symmetric matrix), eigenvectors corresponding to different eigenvalues are perpendicular. Consequently, if I have an Hermitian matrix (or in the real case, an symmetric matrix) with n different eigenvalues, the corresponding eigenvectors form an orthogonal basis. I can get an orthonormal basis --- and hence, a unitary diagonalizing matrix (or in the real case, an orthogonal diagonalizing matrix) --- by simply dividing each vector by its length.

Things are a little more complicated if I have fewer than n eigenvalues. The Spectral Theorem guarantees that I'll have n independent eigenvectors, but some eigenvalues will have several eigenvectors. In this case, I'd need to use Gram-Schmidt on the eigenvectors for each eigenvalue to get an orthogonal set of eigenvectors for each eigenvalue. Eigenvectors corresponding to different eigenvalues are still perpendicular by the result cited earlier, so the orthogonal sets for the eigenvalues fit together to form an orthogonal basis. As before, I get an orthonormal basis by dividing each vector by its length.

To keep the computations simple, I'll stick to the first case (n different eigenvalues) in the examples below.

Example. Let

Find an orthogonal matrices O which diagonalizes A. Find and the corresponding diagonal matrix.

The characteristic polynomial is

The eigenvalues are and .

For , the eigenvector matrix is

This gives the independent eigenvectors and . Dividing them by their lengths, I get and .

For , the eigenvector matrix is

This gives the independent eigenvector . Dividing it by its length, I get .

Thus, the orthogonal diagonalizing matrix is

Then

The diagonal matrix is

Example. Let

Find a unitary matrix U which diagonalizes A.

Since A is Hermitian, the Spectral Theorem applies.

The characteristic polynomial is

The eigenvalues are 4 and -2.

For , partial row reduction gives

(Since this is a matrix, I know that the second row must be a multiple of the first.)

An eigenvector must satisfy

I can get a solution by swapping the -1 and the and negating the -1 to give 1: is an eigenvector for .

For , partial row reduction gives

Using the same technique as I used for , I see that is an eigenvector for .

The result I proved earlier says that these eigenvectors are automatically perpendicular. Check by taking their complex dot product:

Find the lengths of the eigenvectors:

Finally, U is constructed using these normalized vectors as the columns: