## Sunday, 13 January 2013

### Matrix Trace, Determinants and Eigenvalues

This is the start of a quick series of posts showing some powerful properties (and proofs) of matrix eigenvalues. It is assumed that the reader can calculate eigenvectors/values.

However, the series refers to some basic algebra and matrix properties that, while used everywhere, usually don't have accessible or comprehensive  proofs available on the Internet (You can find them in good linear algebra textbooks). It is also a good place to show some neat tricks for sagemath.
There are better and more comprehensive proofs out there, but these are a good start.

We will start today with matrix traces and determinants, and their relationship to matrix eigenvalues. Basically we will be proving that for any n x n matrix, the eigenvalues add up to the sum of the diagonal elements, and multiply up to the determinant of the matrix.

First, let's look at a simple property of polynomial equations, using an order 3 equation as an example.
If a polynomial P(x) has a series of solutions (λ123), it can be written as: Note the first line where a python list comprehension was used to generate a list of subscripted variables. Also note that the variable wasn't called lambda as this is a reserved keyword in python.
Unfortunately sagemath doesn't seem to order the expanded polynomial by powers of x, but it should be clear that the x(n-1) coefficient (the x2 term in this example) equals the sum of the roots, and the constant term equals the product of the roots. These rules hold for polynomials of any order.

Now let's look at how this applies to the characteristic polynomial of matrices:
The characteristic polynomial of a given matrix M, is given by the determinant of
M - λI, and the solutions of this polynomial are the eigenvalues of M. Note the use of a list comprehension again, to create a list of indexed variables m.

Now we could take the determinant of this matrix in sagemath and expand and collect on x. However, sagemath comes with a matrix method that returns the characteristic polynomial directly that we will use instead.

Before we do this, it should be clear that if x is set to zero in the matrix above, the constant term of the characteristic polynomial equals the determinant of the original matrix M.

Expanding the characteristic polynomial and taking the x2 term
it can be seen that this term equals the sum of the diagonal elements, otherwise called the trace of a matrix (ignoring signs).

Combining this with our polynomial rules from above, we end up proving the following matrix properties:

The trace of the matrix equals the sum of the eigenvalues.
And:

The product of the eigenvalues equals the determinant of the original matrix.

We will use these properties in the next couple of posts to show some more advanced properties of matrices.