Lecture 49 · Week 13· 19:37
The spectral theorem
Orthogonal and unitary matrices, symmetric and Hermitian operators.
Saved in this browser only. No account needed.
TranscriptThe full text of the lecture. Click any sentence to play the video from there.
Today: diagonalising with right angles
Welcome back. This week brings together two big themes of the course: eigenvalues, and inner products. Today we prove one of the most useful results in linear algebra, the spectral theorem. Recall diagonalisation, from lecture thirty nine. A equals P D P inverse, where the columns of P are eigenvectors of A, and D holds the matching eigenvalues. Two things can go wrong. There may be too few eigenvectors. And even when there are enough, P inverse takes work to find, and the eigenvectors can meet at awkward angles. For the matrix with the rows one, three, and zero, four, the two eigenvector lines meet at forty five degrees.
Now suppose the eigenvectors are orthonormal. Then P has orthonormal columns, so P transpose P is the identity, and the inverse of P is simply its transpose. We call such a matrix Q, and A equals Q D Q transpose. For which matrices does this happen? Today's answer: for real matrices, exactly the symmetric ones. Take the matrix with the rows seven, two, and two, four. Its eigenvector lines meet at a right angle. Here is the plan. First, the matrices with orthonormal columns: orthogonal and unitary matrices. Then self-adjoint operators, and their real eigenvalues. Then the spectral theorem, with its proof. Then an example, which you can also explore on the website. And finally, the spectral decomposition.
Orthogonal and unitary matrices
In lecture forty seven, we saw that a real matrix Q has orthonormal columns exactly when Q transpose Q is the identity. The square case gets its own name. A real n by n matrix Q is orthogonal if Q transpose Q is the identity matrix. A complex n by n matrix Q is unitary if Q star Q is the identity, where Q star is the conjugate transpose. The name is a little misleading: the columns of an orthogonal matrix are not just orthogonal, but orthonormal. And a real orthogonal matrix is also unitary, since Q star is Q transpose when Q is real.
Here are five equivalent statements, for a real n by n matrix Q. Q is orthogonal. Its columns are an orthonormal basis of R n. Q is invertible, and its inverse is Q transpose. Q keeps dot products. And Q keeps lengths. Let's see why. Parts a and b say the same thing, because n orthonormal vectors in R n are a basis. For part c, a one-sided inverse of a square matrix is already an inverse, by lecture sixteen. For part d, write the dot product as a matrix product. Q x dot Q y is Q x, transposed, times Q y. That is x transpose, times Q transpose Q, times y. And Q transpose Q is the identity, so this is x transpose y, the dot product of x and y.
Part d gives part e, by taking y equal to x. Conversely, lengths determine dot products: four times x dot y is the length of x plus y, squared, minus the length of x minus y, squared. Apply this to Q x and Q y: since Q x plus or minus Q y is Q times x plus or minus y, part e gives Q x dot Q y equals x dot y. And part d gives back part a. The entry of Q transpose Q in row j, column k is Q e j, dot Q e k. By part d, that is e j dot e k, which is the entry of the identity. So an orthogonal matrix moves the plane, or space, rigidly: no length and no angle changes. And part c is what makes these matrices pleasant to compute with: inverting one costs nothing.
In the plane, take the rotation by an angle theta. Its first column is cos theta, sin theta, and its second column is minus sin theta, cos theta. The reflection has the same first column, and the opposite second column. In both, each column has length one, since cos squared plus sin squared is one, and the two columns are orthogonal. The unit square goes to a unit square, turned, or turned over. These are all the orthogonal two by two matrices. The rotation has determinant one, and the reflection minus one. Permutation matrices are orthogonal too: their columns are the standard basis vectors, in a new order.
Two more facts. First, the determinant of an orthogonal matrix is one or minus one. Indeed, one is the determinant of Q transpose Q, which is the determinant of Q, squared. For a unitary matrix, the same idea gives a determinant of absolute value one. Second, every eigenvalue, even a complex one, has absolute value one. If Q v equals lambda v, with v not zero, take lengths: the length of v equals the length of Q v, which is the absolute value of lambda, times the length of v. A rigid motion can fix a direction or reverse it, but it cannot stretch it. And the inverse of an orthogonal matrix, and the product of two, are orthogonal again. For a product, Q one Q two, transposed, times Q one Q two, is Q two transpose, times Q one transpose Q one, times Q two, which is the identity. The same proofs work for unitary matrices, with star in place of transpose.
Self-adjoint operators
Now the matrices of the theorem. From lecture fifteen, A x dot y equals x dot A transpose y. So when A is symmetric, A can move from one side of the dot product to the other. For a complex matrix, the same works with the conjugate transpose. If A star equals A, then A moves across the inner product. Such a matrix is called Hermitian. This makes sense in every inner product space. Throughout today, V is a finite dimensional inner product space, over the real or the complex numbers. An operator T on V is self-adjoint if the inner product of T u with v equals the inner product of u with T v, for all u and v. Over the real numbers, it is also called symmetric, and over the complex numbers, Hermitian.
How do we recognise one? Take an orthonormal basis, q one up to q n, and let A be the matrix of T in this basis. By lecture forty seven, the entry in row j, column k is the inner product of T q k with q j. If T is self-adjoint, move T across. This gives the inner product of q k with T q j, which is the complex conjugate of the entry in row k, column j. So A star equals A. Over the real numbers, A is symmetric. The converse follows by expanding vectors in the basis. In particular, the map that sends x to A x is self-adjoint on R n exactly when A is symmetric, and on C n exactly when A is Hermitian.
But the basis must be orthonormal. Take the diagonal matrix with entries four and one, and the basis b one, b two, where b one is the vector (one, zero), and b two is the vector (one, one). In this basis, the same map has the matrix with the rows four, three, and zero, one, which is not symmetric. Now the heart of the matter: the inner product forces the eigenvalues to be real, and the eigenvectors to be orthogonal. Here is the theorem. Let T be self-adjoint. Part a: every eigenvalue of T is real. Part b: eigenvectors for different eigenvalues are orthogonal. Proof of part a. Let T v equal lambda v, with v not zero. Then lambda times the inner product of v with itself is the inner product of T v with v. Move T across: this is the inner product of v with T v, that is, of v with lambda v.
In the second slot, a scalar comes out conjugated, so this is lambda bar, times the inner product of v with itself. Since v is not zero, that inner product is positive, and we can divide by it. So lambda equals lambda bar: lambda is real. Part b. Let T u be lambda one u, and T v be lambda two v. The same move gives lambda one times the inner product of u and v, equals lambda two bar times it. By part a, lambda two bar is lambda two. So lambda one minus lambda two, times the inner product, is zero. Since lambda one and lambda two are different, the inner product is zero. Part c is the key fact for real matrices. If A is a real symmetric n by n matrix, its characteristic polynomial splits into linear factors over the real numbers. In particular, A has a real eigenvalue.
Why? Regard A as a complex matrix. Since A is real and symmetric, A star equals A, so the map that sends x to A x is self-adjoint on C n. Over the complex numbers, the characteristic polynomial splits, by lecture forty one. Each root is an eigenvalue, and by part a, it is real. Compare the quarter turn, which has no real eigenvalue at all. A symmetric matrix can never behave like that: all its complex eigenvalues lie on the real line.
The spectral theorem
Here is the main theorem. Let V be a nonzero, finite dimensional inner product space, over the real or the complex numbers, and let T be a self-adjoint operator on V. Then V has an orthonormal basis consisting of eigenvectors of T, and all eigenvalues of T are real. In such a basis, the matrix of T is diagonal, with the real eigenvalues lambda one up to lambda n on the diagonal. The proof is by induction on the dimension n, and it is the most demanding part of today. It is worth pausing, or rewatching it slowly.
Step one: find one eigenvector. Over the complex numbers, every operator has an eigenvalue, by lecture forty one. Over the real numbers, the matrix of T in an orthonormal basis is real and symmetric, so it has a real eigenvalue, by part c. Either way, we get a real eigenvalue, lambda one, and an eigenvector, which we divide by its norm. Call it q one. If n is one, q one alone is an orthonormal basis, and we are done. Step two. Let U be the line spanned by q one, and take its orthogonal complement, U perp. The key claim: T maps U perp into itself. Take w in U perp. The inner product of T w with q one equals the inner product of w with T q one, which is lambda one bar, times the inner product of w with q one. And that is zero. So T w is orthogonal to q one: it stays in U perp.
Step three. So T restricts to an operator on U perp, and the restriction is still self-adjoint, because its inner products are those of T. U perp has dimension n minus one, so by the induction hypothesis, it has an orthonormal basis of eigenvectors, q two up to q n. Step four. Each of these lies in U perp, so it is orthogonal to q one. Together, q one up to q n are n orthonormal eigenvectors, in an n dimensional space. So they form an orthonormal basis of V, and the theorem is proved. Notice that self-adjointness was used twice: once to get a real eigenvalue, and once to keep U perp invariant. Without it, step two fails. For the matrix with the rows one, three, and zero, four, e one is an eigenvector, but its orthogonal complement is the line of e two, and e two goes to the vector (three, four), which leaves that line.
For matrices, the theorem reads like this. If A is a real symmetric n by n matrix, then A equals Q D Q transpose, with Q orthogonal and D real and diagonal. The columns of Q are orthonormal eigenvectors, in the order of the eigenvalues in D. And a Hermitian matrix is Q D Q star, with Q unitary. Indeed, the map that sends x to A x is self-adjoint, so the theorem gives an orthonormal basis of eigenvectors. Put them into Q. Then A equals Q D Q inverse, by lecture thirty nine, and the inverse of Q is its transpose. The converse holds too. If A equals Q D Q transpose, then A transpose is Q D transpose Q transpose, and D transpose is D, so this is A again. So a real matrix can be diagonalised with an orthonormal basis of eigenvectors exactly when it is symmetric.
An example
Let's diagonalise one. Take A with the rows seven, two, and two, four. It is symmetric, so the theorem applies. The characteristic polynomial is seven minus t, times four minus t, minus two times two. That is t squared, minus eleven t, plus twenty four, which factors as t minus eight, times t minus three. So the eigenvalues are eight and three. For eight, A minus eight I has the rows minus one, two, and two, minus four. So x one equals two x two, and an eigenvector is the vector (two, one).
For three, A minus three I has the rows four, two, and two, one. So x two equals minus two x one, and an eigenvector is the vector (minus one, two). Their dot product is minus two plus two, which is zero, just as part b promised. Both have length root five, so we divide each by root five. So Q is one over root five, times the matrix with the columns two, one, and minus one, two. D is diagonal, with the entries eight and three. And A equals Q D Q transpose.
Let's check. Q times D is one over root five, times the matrix with the rows sixteen, minus three, and eight, six. Times Q transpose, entry by entry: sixteen times two, plus three, is thirty five. Sixteen minus six is ten. Sixteen minus six is ten again. And eight plus twelve is twenty. So Q D Q transpose is one fifth of the matrix with the rows thirty five, ten, and ten, twenty. That is exactly A. The determinant of Q is one, so Q is a rotation, by about twenty seven degrees. That gives a picture of what A does.
Read Q D Q transpose from the right. Q transpose turns q one and q two onto the axes. D stretches the axes, by eight and by three. And Q turns everything back. So A stretches the plane by eight along q one, and by three along q two, at right angles. The unit circle becomes an ellipse, with its axes along the two eigenvector lines. In general, the recipe is this. Find the eigenvalues; they are all real. For each one, find a basis of its eigenspace, and make it orthonormal with Gram Schmidt. Put all these vectors into Q, and the matching eigenvalues, in the same order, into D.
Vectors from different eigenspaces are orthogonal automatically, by part b, so Gram Schmidt is needed only inside an eigenspace of dimension two or more. Example eleven point one point thirteen, in the book, does this for a three by three matrix with a repeated eigenvalue.
Try it yourself
You can explore this yourself, on this lecture's page at Open Semester dot com. You set the entries of a two by two matrix A, and you see its eigenvector lines, and what it does to the unit circle. Here is our example, with the rows seven, two, and two, four. Step through it. Q transpose turns q one and q two onto the axes, D stretches them by eight and by three, and Q turns them back. The circle has become the ellipse. Now change the entry off the diagonal, in both places at once. The eigenvalues and the eigenvectors move, but the two eigenvector lines always stay at right angles.
Switch off the symmetry, and change only the bottom left entry. Now the eigenvector lines can meet at other angles. With the rows one, three, and zero, four, from the start of the lecture, they meet at forty five degrees. And with a negative entry there, the eigenvalues can become complex, and there are no real eigenvector lines at all. A symmetric matrix never does this. Try your own matrices.
The spectral decomposition, and a summary
Finally, multiply out Q D Q transpose, column times row. The result is the spectral decomposition: A is lambda one, q one, q one transpose, plus and so on, up to lambda n, q n, q n transpose. Each q j, q j transpose is the matrix of the orthogonal projection onto the line through q j, from lecture forty six. So a symmetric matrix is a sum of projections onto perpendicular lines, each weighted by its eigenvalue. In our example, the eigenvalues are eight and three, with the unit eigenvectors q one and q two that we found. So A is eight times q one, q one transpose, plus three times q two, q two transpose.
To find q one, q one transpose, multiply the column q one by the row q one transpose. Each has the factor one over root five, and together they give one fifth. The top left entry is two times two, which is four. Next to it is two times one, which is two. The other two entries come the same way, so q one, q one transpose is one fifth times the matrix with rows four, two, and two, one. In the same way, q two, q two transpose is one fifth times the matrix with rows one, minus two, and minus two, four. Putting both matrices into the sum gives a sum we can add entry by entry. Let's check the top left corner: eight times four fifths, plus three times one fifth, is thirty five fifths, which is seven, the top left entry of A. The other entries check the same way.
The decomposition also makes powers easy. A to the k is the same sum, with each lambda j raised to the power k. Let's sum up. An orthogonal matrix has orthonormal columns. It keeps lengths and angles, its inverse is its transpose, and its eigenvalues have absolute value one. A self-adjoint operator has real eigenvalues, and its eigenvectors for different eigenvalues are orthogonal. In an orthonormal basis, its matrix is symmetric, or Hermitian.
The spectral theorem: a self-adjoint operator has an orthonormal basis of eigenvectors. So every real symmetric matrix is Q D Q transpose, and these are the only real matrices of this form. It is the foundation of the next three lectures: quadratic forms, and the singular value decomposition. Before the next lecture, read section eleven point one of the course book, try the problems on sheet thirteen about orthogonal matrices and the spectral theorem, and do the lecture check on this lecture's page at Open Semester dot com. Next time, quadratic forms, and the shape of an ellipse. See you there.
In this lecture
Materials
Try it
A symmetric matrix and the unit circle
Set the entries of A with the sliders, or pick an example, and step through the picture. For a symmetric A = QDQT, read from the right: QT turns the eigenvectors q1, q2 onto the axes, D stretches the axes by the eigenvalues, and Q turns everything back. The unit circle becomes an ellipse with its axes on the two eigenvector lines, which always meet at right angles. Choose "Any matrix" to move c on its own: the lines can meet at other angles, or disappear when the eigenvalues become complex.
Check yourself
3 questions, from warm-up to stretch
Work each one out on paper, type your answer and press Check. Stuck? Open a hint; the worked solution is there when you need it.
- Question 1 of 3 Warm-up
The matrix is orthogonal. Find , and the top right entry of .
Hint 1 of 2
is orthogonal exactly when its columns are orthonormal (Proposition 11.1.2), and then .
Hint 2 of 2
The columns and must have dot product : . For , transpose and read off its top right entry.
Worked solution
- The columns must be orthonormal (Proposition 11.1.2). Orthogonality: , so .
- Check the length of the second column: .
- Since , the top right entry is . Here : is a rotation.
- Question 2 of 3 Core
Orthogonally diagonalise . Find its eigenvalues , the entry in the unit eigenvector for , and the top left entry of in the spectral decomposition.
Hint 1 of 2
is symmetric, so (Corollary 11.1.10). Start with .
Hint 2 of 2
. For , solve with . Then has top left entry .
Worked solution
- , so and , both real as Theorem 11.1.8 promises.
- gives , an eigenvector of length , so and . For , gives , orthogonal to .
- , and .
- , so . Check: adding gives .
- Question 3 of 3 Stretch
Let . For which can be written as , with orthogonal and diagonal? For that , find the largest eigenvalue of . Finally, with instead: does have an orthonormal basis of eigenvectors of ?
Hint 1 of 2
A real matrix is with orthogonal and diagonal exactly when it is symmetric (Proposition 11.1.11).
Hint 2 of 2
So , and then . For , find both eigenvector lines of and check whether they are at right angles.
Worked solution
- By Proposition 11.1.11, a real matrix is with orthogonal and diagonal exactly when it is symmetric, so .
- Then , so the eigenvalues are and , and . (Eigenvectors and : orthogonal, as Theorem 11.1.8(b) says.)
- With the matrix is triangular, with eigenvalues and . gives the line of , and gives the line of .
- . Every eigenvector lies on one of these two lines, so an orthonormal basis of eigenvectors would need one vector from each line at right angles, which is impossible. The answer is No: with distinct eigenvalues is diagonalisable, but not orthogonally.
How did it go?