The Trace of a Square Matrix

Let A = (a(i,j)) be a n x n matrix. The trace of A is defined by

trace(A) = a(1,1) + a(2,2) + ... + a(n,n),


using the MATLAB notation a(i,j) for the ij-th entry of the matrix A. Thus in words, the trace of A is the sum of the elements on the main diagonal.

Hence, trace : M(n,n) ---> |R where M(n,n) is the vector space of all n x n matrices with real numbers as entries.

Lemma : trace : M(n,n) ---> |R is a linear transformation, e.g.,

(i) trace(A + B) = trace(A) + trace(B),

(ii) trace(cA) = c trace(A).

Proof of (i): A + B = (a(i,j) + b(i,j)). Thus

trace(A + B) = (a(1,1) + b(1,1)) + (a(2,2) + b(2,2)) + ... + (a(n,n) + b(n,n)) =
(a(1,1) + ... + a(n,n)) + (b(1,1) + ... + b(n,n)) = trace(A) + trace(B).

Proof of (ii): cA = (ca(i,j)) so that

trace(cA) = (ca(1,1)) + (ca(2,2)) + ... + (ca(n,n)) = c(a(1,1) + a(2,2) + ... + a(n,n)) = c trace(A).

---------------------------

Perhaps more interestingly, the trace has the following properties with regard to matrix multiplication. I asked you to check in a specific case, that trace(AB) does not equal the product of the numbers trace(A)*trace(B).

Yet it is a remarkable fact, proved by interchanging the order of summation, that

trace(AB) = trace(BA)


despite the fact that the matrix products AB and BA are generally not equal.

In some contexts of theoretical physics or mathematics, we form the trace free part of an n x n matrix as follows: given A in M(n,n), form

D = A - (trace(A)/n)In.


Lemma: With D defined as above, trace(D) = 0.

Proof: This all relies on the linearity of the trace and the elementary fact that trace(In) = n. Now just calculate:

trace(D) = trace(A - (trace(A)/n)In) = trace(A) - trace((trace(A)/n)In) = trace(A) - (trace(A)/n)trace(In) =
trace(A) - (trace(A)/n)n = trace(A) - trace(A) = 0.