You are on page 1of 11

The Trace of a Matrix

Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 1 / 11
The trace of a square matrix
n×n
A = [a
ij
] is
trace(A) = tr(A) =
n

i=1
a
ii
.
For example,
tr
_
_
_
_
_
¸
¸
_
5 3 5
4 −1 2
−3 8 7
_
¸
¸
_
_
_
_
_
= 5 −1 + 7 = 11.
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 2 / 11
Some Simple Facts about Trace
Suppose k, k
1
, . . . , k
m
∈ R and A, A
1
, . . . , A
m
are each n ×n matrices.
Then
1
tr(A) = tr(A

)
2
tr(kA) = k · tr(A)
3
tr(A
1
+A
2
) = tr(A
1
) + tr(A
2
)
4
tr(

m
i=1
k
i
A
i
) =

m
i=1
k
i
· tr(A
i
)
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 3 / 11
Result A.17:
(a) tr(AB) = tr(BA). This is known as the cyclic property of the trace.
(b) If
m×n
A = [a
ij
], then
tr(A

A) =
m

i=1
n

j=1
a
2
ij
.
Proof of Result A.17: HW problem.
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 4 / 11
Suppose A is an m ×n matrix of rank r. Prove that there exist matrices
m×r
B and
r×n
C such that
A = BC and rank(B) = rank(C) = r.
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 5 / 11
Proof:
Let B = [b
1
, . . . , b
r
] where b
1
, . . . , b
r
form a basis for C(A).
Because b
1
, . . . , b
r
form a basis, they are LI so that rank(B) = r.
Let c
j
be the vector of the coefficients of the linear combination of
b
1
, . . . , b
r
that gives the jth column of A.
Then A = BC, where C = [c
1
, . . . , c
n
].
Finally, note that
r = rank(A) = rank(BC) ≤ rank(C) ≤ r ⇒rank(C) = r.
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 6 / 11
Suppose A is an n ×n matrix such that AA = kA for some k ∈ R.
Prove that tr(A) = k · rank(A).
(Note that this result implies the trace of an idempotent matrix is equal
to its rank.)
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 7 / 11
Proof:
Let r = rank(A). Let
n×r
B and
r×n
C be matrices of rank r such that A = BC.
Then
BCBC = AA = kA = kBC = B(k
r×r
I )C.
Now B of full column rank implies CBC = k
r×r
I C, and
C of full row rank implies CB = k
r×r
I .
Thus,
tr(A) = tr(BC) = tr(CB) = tr(k
r×r
I ) = k · tr(
r×r
I ) = k · r = k · rank(A). 2
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 8 / 11
Prove that tr(I −P
X
) = n −rank(X).
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 9 / 11
Proof:
We know I −P
X
is idempotent. Thus, tr(I −P
X
) = rank(I −P
X
).
We know I −P
X
is the orthogonal projection matrix onto
C(X)

= N(X

).
Thus, C(I −P
X
) = N(X

), which has dimension n −rank(X).
Thus, rank(I −P
X
) = n −rank(X).
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 10 / 11
Alternate Proof:
Because P
X
is idempotent, tr(P
X
) = rank(P
X
).
Now note that rank(P
X
) = rank(X) because
rank(P
X
) = rank(X(X

X)

X

) ≤ rank(X) = rank(P
X
X) ≤ rank(P
X
).
(This also follows from C(X) = C(P
X
).)
Thus, tr(I −P
X
) = tr(I) −tr(P
X
) = n −tr(P
X
) = n −rank(X).
Copyright c 2012 Dan Nettleton (Iowa State University) Statistics 611 11 / 11