The trace of a square matrix M, usually written tr M ,is the sum of the terms on the diagonal, and has the following properties:

  • It is linear: for all numbers a,b and any 2 n x n matrices M and N, tr (a*M +b*N)=a*tr(M) + b*tr(N)
  • For any 2 n x n matrics A and B, tr (AB)=tr(BA). Note that since we are dealing with matrices, this isn't immediately obvious, since matrix multiplication does not commute.

The first statement should be fairly obvious. The proof of the second is fairly easy too. Using summation convention, we have:
tr(A)=aii, thus tr(AB)=(AB)ii
(AB)ij=aikbkj
hence

tr(AB)=aikbki
      =bkiaik
      =(BA)ii
      =tr(BA)

But i hear you asking, "Why should I care?" Here's one reason this might matter. Consider the following the problem. You are given a matrix M that you are told represents a rotation with respect to a certain basis. The question is, what is the angle of the rotation. You know that in the right basis, the matrix for a rotation by θ is

N= |cos θ  sin θ|
   |-sin θ cos θ|
However, we are probably not in the right basis. But if you remember your change of basis formula, you will know that there exists a non singular matrix S such that M = S-1NS
Further more, tr(M)=tr(S-1NS)=tr(NSS-1), using the property of trace; thus tr(M)=tr(N), and therefore tr(M)=2 cos θ
Using inverse trigonometric functions, we may thus find θ (modulo π)

More generally, this shows that the trace of the matrix of an endomorphism is independant of the basis we are using, it therefore makes sense to talk about the trace of an endomorphism.

I can still hear some people wondering why on earth they should care about trace, or for that matter why they should care about matrices. A quick answer would be that matrices are very useful in 3D graphics (among other things) i.e. in Quake and we all care about that!