Lecture 43 · Week 11· 18:05
Polynomials of matrices
Cayley–Hamilton theorem.
Saved in this browser only. No account needed.
TranscriptThe full text of the lecture. Click any sentence to play the video from there.
Today: a matrix in its own polynomial
Welcome back. In Lecture 40 we multiplied a matrix by itself again and again, to follow Markov chains and recurrences. Today we combine those powers into polynomials, and we meet one of the most surprising facts in linear algebra. Take the matrix A with rows one, two, and three, four. Its trace is five, and its determinant is minus two. So by the two by two formula from Lecture 38, its characteristic polynomial is t squared, minus five t, minus two. Now let us do something strange. We put the matrix itself in place of t. Then t squared becomes A squared, five t becomes five A, and the constant two becomes two times the identity.
A squared has rows seven, ten, and fifteen, twenty two. Five A has rows five, ten, and fifteen, twenty. In the first entry, seven minus five minus two is zero. In the second, ten minus ten is zero. Then fifteen minus fifteen is zero, and twenty two minus twenty minus two is zero. Every entry is zero. The matrix is a root of its own characteristic polynomial. This is the Cayley Hamilton theorem, and it holds for every square matrix, over every field. Here is the plan. First, what it means to put a matrix into a polynomial, and the rules this follows. Then, what such a polynomial does to eigenvectors. Then the theorem and its proof. And finally two uses: inverses, and high powers without the work.
Polynomials of a matrix
Here is the definition. Let A be an n by n matrix over a field F, and let f be a polynomial: c zero, plus c one t, up to c d t to the d. Then f of A is c zero times the identity, plus c one A, up to c d A to the d. Each power of t becomes the same power of A. The constant term becomes a multiple of the identity, because A to the zero is I. In the same way, for a linear map T from V to itself, f of T is c zero times the identity map, plus c one T, up to c d T to the d. For example, take f of t equal to t squared, minus three t, plus two, and the same matrix A. Then f of A is A squared, minus three A, plus two I. In the first row, seven minus three plus two is six, and ten minus six is four. In the second row, fifteen minus nine is six, and twenty two minus twelve plus two is twelve.
But f also factors, as t minus one, times t minus two. So we multiply A minus I by A minus two I. A minus I has rows zero, two, and three, three. A minus two I has rows minus one, two, and three, two. Row by column, the first row of the product is six, four, and the second row is six, twelve. It is the same matrix. That is no accident. Here are the rules. For polynomials f and g and a scalar c, f plus g at A is f of A plus g of A, and c f at A is c times f of A. And the product f g at A is f of A times g of A.
The product rule is the interesting one. Multiply f of A by g of A term by term. Each term is a scalar times A to the j, times a scalar times A to the k. Scalars move past matrices, and A to the j times A to the k is A to the j plus k. So we get exactly the terms of the product f g, with A in place of t. Since f g equals g f, the rule has a consequence: f of A and g of A always commute. In particular, every polynomial in A commutes with A itself. Be careful: this works because only one matrix is involved. For two matrices, A B is usually not B A, so A plus B, squared, is usually not A squared plus two A B plus B squared.
Two more rules. If P is invertible, f of P A P inverse is P times f of A, times P inverse, because the inner factors P inverse P cancel in every power. And f of a diagonal matrix is diagonal, with the entries f of d one, up to f of d n. For a map, the rules are the same, and in any basis, the matrix of f of T is f of the matrix of T.
What a polynomial does to eigenvectors
What does f of A do to an eigenvector? Suppose A v equals lambda v, with v not zero. In Lecture 37 we saw that A to the k, times v, is lambda to the k, times v. So in f of A times v, each term A to the k v becomes lambda to the k v. Adding up the terms, f of A times v is f of lambda, times v. So every eigenvector of A is an eigenvector of f of A, and its eigenvalue lambda becomes f of lambda. Let us watch this for our matrix. Its eigenvalues are five plus or minus root thirty three, over two. We will not need their values: call them lambda one and lambda two, with eigenvectors v one and v two. Since the eigenvalues are the roots of the characteristic polynomial, it factors as t minus lambda one, times t minus lambda two.
Apply the first factor, A minus lambda one I. It multiplies v one by lambda one minus lambda one, which is zero: the first eigenvector collapses to the origin. And it multiplies v two by lambda two minus lambda one, which is not zero, so v two stays on its own line. Now apply the second factor, A minus lambda two I. Along v two it multiplies by lambda two minus lambda two, which is zero again. So the product of the two factors sends both v one and v two to zero. They form a basis of R two, and a matrix that sends every vector of a basis to zero sends every vector to zero. So the characteristic polynomial at A is the zero matrix.
The same works for every diagonalisable matrix. If A equals P D P inverse, then p A of A is P times p A of D, times P inverse. And p A of D is diagonal, with the entries p A of lambda one, up to p A of lambda n. Every one of these entries is zero, because the eigenvalues are the roots of the characteristic polynomial. So p A of D is the zero matrix, and so is p A of A. But not every matrix is diagonalisable. The shear from Lecture 39 has only one line of eigenvectors. Yet its characteristic polynomial is one minus t, squared, and S minus I has rows zero, one, and zero, zero, whose square is the zero matrix. Something more general is going on.
The Cayley–Hamilton theorem
Here is the theorem. Let A be an n by n matrix over a field F. Then p A of A is the zero matrix. And for a linear map T from a nonzero finite dimensional space V to itself, p T of T is the zero map. In words: put the matrix in place of t in its own characteristic polynomial, and you always get zero. Diagonalisable or not, and over every field. For two by two matrices we can check it by hand. With entries a, b, c, d, the characteristic polynomial is t squared, minus a plus d, times t, plus a d minus b c.
Compute A squared, and subtract a plus d, times A. In the first entry, a squared plus b c, minus a squared minus a d, leaves b c minus a d. Off the diagonal, everything cancels. And the last entry also leaves b c minus a d. So A squared minus the trace times A is minus the determinant times I, and adding the determinant times I gives the zero matrix. Here is a picture of it. The quarter turn R has characteristic polynomial t squared plus one, so the theorem says R squared plus I is zero. Indeed, turning twice by a quarter turn is a half turn, which sends every vector to its negative: R squared is minus I.
Now a warning. It is tempting to prove the theorem in one line: put A in place of t inside the determinant, and get the determinant of A minus A, which is zero. But that zero is a number, not a matrix, and putting a matrix inside a determinant is not what f of A means. The same shortcut with the trace shows that it proves nothing. The polynomial g of t equal to the trace of A minus t I is the trace of A, minus n t. Putting A inside the trace would give the trace of the zero matrix, which is zero. But g of A is the trace of A times I, minus n A. For our matrix it is five I minus two A, with rows three, minus four, and minus six, minus three. That is not zero, so the shortcut fails.
The proof
Now the proof. It is the most demanding part of this lecture, so it is worth pausing or rewatching it slowly. Here is where it leads: we will show that p A of A is the zero matrix. That one fact is what gives us inverses and high powers of A in the next part. The idea is to use the adjugate from Lecture 36. First, a reminder of what the adjugate is. For a square matrix M, take the cofactor of every entry: plus or minus the determinant of what is left when its row and column are removed. Put the cofactors in a matrix and transpose it. That is the adjugate of M. For a two by two matrix with rows a, b, and c, d, the adjugate has rows d, minus b, and minus c, a: the diagonal entries swap, and the other two change sign. Recall the theorem. For an n by n matrix over a field, with n at least two, the matrix times its adjugate is its determinant times the identity. It holds over every field, so also over the field of rational functions in t, as in Lecture 38.
Apply it to A minus t I. Its determinant is p A of t, so A minus t I, times its adjugate, is p A of t times I. The entries of the adjugate are cofactors: plus or minus determinants of n minus one by n minus one pieces of A minus t I. So they are polynomials in t of degree at most n minus one. Group them by powers of t. The adjugate splits into Q zero, plus Q one t, up to Q n minus one, t to the n minus one, where each Q k is an ordinary matrix over F.
For our matrix, the adjugate of A minus t I has rows four minus t, minus two, and minus three, one minus t. It splits into Q zero, with rows four, minus two, and minus three, one, plus t times Q one, which is minus the identity. Now write p A of t as c zero, plus c one t, up to c n t to the n. Multiply out the left side, and compare the coefficients of each power of t. Both sides are matrices of polynomials, and equal polynomials have equal coefficients. The constant terms give A Q zero equals c zero I. For each power t to the k in between, A Q k, minus Q k minus one, equals c k I. And the top power gives minus Q n minus one equals c n I.
Let us bring our matrix back. We found Q zero, and Q one, which is minus the identity. Its characteristic polynomial is minus two, minus five t, plus t squared, so c zero is minus two, c one is minus five, and c two is one. Now check the three equations. A times Q zero has rows minus two, zero, and zero, minus two. That is minus two I. A Q one minus Q zero is minus A minus Q zero, which is minus five I. And minus Q one is I. The right sides are minus two, minus five and one: exactly the coefficients c zero, c one and c two. Here is the key step. Multiply the equation for t to the k, on the left, by A to the k, and add all the equations. On the right we get c zero I, plus c one A, up to c n A to the n. That is p A of A.
On the left, A Q zero comes first. Next comes A squared Q one, minus A Q zero, which cancels the first term. Every new term cancels the one before it, and the last one, minus A to the n, Q n minus one, cancels what is left. Everything cancels, so p A of A is the zero matrix. This is the goal we set at the start of the proof: p A of A is the zero matrix. That is the Cayley Hamilton theorem, and it is the tool we use in the next part. Notice what made this work. We compared coefficients first, while t was still a variable, and only then put in powers of A. We never put a matrix inside a determinant.
Two loose ends. For n equal to one, A is a single number a, its characteristic polynomial is a minus t, and a I minus A is zero. And for a map T, in any basis, the matrix of p T of T is p A of A, where A is the matrix of T. That is zero, so p T of T is the zero map.
Using the theorem: inverses and powers
The Cayley Hamilton theorem we just proved has two quick uses. The first is inverses. The constant term c zero of the characteristic polynomial is the determinant of A, by Lecture 38. If it is not zero, move c zero I to the other side. Then A comes out in front of what is left: A times c one I, plus c two A, up to c n A to the n minus one, is minus c zero I. So A inverse is minus one over the determinant, times that bracket: a polynomial in A of degree n minus one. For our matrix, the theorem says that A squared minus five A minus two I is zero. So A times A minus five I is two I, and A inverse is one half of A minus five I. That is one half of the matrix with rows minus four, two, and three, minus one. The two by two inverse formula gives the same matrix.
The second use is powers. From the theorem, A squared is five A plus two I. Multiply by A: A cubed is five A squared plus two A. Replace A squared again, and A cubed is twenty seven A plus ten I. Each step works the same way. A to the fourth is twenty seven A squared plus ten A, which is one hundred forty five A plus fifty four I. And A to the fifth is seven hundred seventy nine A plus two hundred ninety I. So A to the fifth has rows one thousand sixty nine, one thousand five hundred fifty eight, and two thousand three hundred thirty seven, three thousand four hundred six, with no matrix multiplication at all.
Let us look back at how we got here. We started with the matrix A and nothing else. Its trace five and determinant minus two gave its characteristic polynomial, t squared, minus five t, minus two. The Cayley Hamilton theorem turned that polynomial into one matrix equation: A squared equals five A plus two I. Every power after that came from the same move, replacing A squared again and again. We never needed the eigenvalues, with their square roots of thirty three, and we never diagonalised A. That is the payoff of the proof: the theorem is proved once, and then computations like these are arithmetic with a few numbers. In general, divide a polynomial f by p A, as in long division at school. This gives f equals q times p A, plus a remainder r, of degree less than n.
Then f of A is q of A times p A of A, plus r of A. The first part is q of A times the zero matrix, so f of A is r of A. Every polynomial in an n by n matrix A equals a polynomial in A of degree less than n. So all the powers of A lie in the span of I, A, up to A to the n minus one. That span has dimension at most n, while the space of all n by n matrices has dimension n squared.
Summary
To sum up. A polynomial of a matrix is a combination of its powers, and it follows the rules of polynomials: sums, multiples and products. An eigenvector of A for lambda is an eigenvector of f of A, for f of lambda. The Cayley Hamilton theorem: every square matrix is a root of its own characteristic polynomial. The proof compared the coefficients of the adjugate identity, and added up the equations so that everything cancelled.
And it lets us write inverses and powers of an n by n matrix as polynomials of degree less than n. One last question. The two by two identity matrix has characteristic polynomial one minus t, squared. But already I minus I is zero, a polynomial of degree one. So the characteristic polynomial is not always the smallest polynomial that gives zero. Before the next lecture, read section nine point three of the course book, try the problems on sheet eleven about polynomials of matrices and the Cayley Hamilton theorem, and do the lecture check on this lecture's page at Open Semester dot com. Next time, we look for that smallest polynomial, the minimal polynomial, and it tells us exactly when a matrix can be diagonalised. See you there.
In this lecture
Materials
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
Let . By the Cayley–Hamilton theorem, for two numbers and . Find and , and then the entry of in row , column .
Hint 1 of 2
For a matrix, (Corollary 8.2.6). The theorem says ; solve that for .
Hint 2 of 2
Here and , so .
Worked solution
- By Corollary 8.2.6, . Here and , so .
- By the Cayley–Hamilton theorem, , so : and .
- So , and .
- Check by multiplying out: .
- Question 2 of 3 Core
Let . Use the Cayley–Hamilton theorem to write , as in Corollary 9.3.17. Find and , and the entry of in row , column .
Hint 1 of 2
Find from the trace and the determinant, write , move the constant term to the other side and take out in front of what is left.
Hint 2 of 2
and , so , that is .
Worked solution
- By Corollary 8.2.6, , since and .
- By the Cayley–Hamilton theorem, . Moving to the other side and taking out in front: .
- Dividing by : , so : and .
- So , and .
- Check: . The inverse formula (Theorem 3.5.6) gives the same matrix.
- Question 3 of 3 Stretch
Let . Use the Cayley–Hamilton theorem, step by step as in the lecture, to write . Find and , and the entry of in row , column .
Hint 1 of 2
and , so and the theorem gives .
Hint 2 of 2
Multiply by and replace each time: , then . Keep going to .
Worked solution
- By Corollary 8.2.6, , since and . By the Cayley–Hamilton theorem, .
- Multiply by and replace by each time: , , , and . So and .
- Then , so .
- The same answer by division (Corollary 9.3.18): , so .
- Check by multiplying out: , , and .
How did it go?