MATRICES AND MATRIX OPERATIONS: Unit 20
Dr. Wlodzislaw Kostecki
The Papua New Guinea University of Technology (PNGUT)
Department of Electrical and Communication Engineering
Lae, Morobe Province
Papua New Guinea
Copyright © 2000 by Wlodzislaw Kostecki
All rights reserved
-------------------------------------------------------------------
(20) Trace of a matrix
OBJECTIVES :
• To define the trace of a square matrix.
• To specify and illustrate properties of the matrix trace.
> restart : interface(warnlevel=0) : with(linalg, inverse, trace) :
The trace of a square matrix is the sum of the elements of the principal diagonal of the matrix.
Consider a
(
×
)
matrix [
A
] given as
> A := matrix(3, 3, [a[11], a[12], a[13], a[21], a[22], a[23], a[31], a[32], a[33]]) : A = matrix(A) ;
The trace of the matrix, Trace [ A ], is
> `trace(A)` := trace(A) : Trace(A) = `trace(A)` ;
For instance, consider a
(
×
)
matrix [
A
] containing numerical elements as follows:
> A := matrix(3, 3, [4, 2, 1, 1, -1, 0, 1, 1, 3]) : A = matrix(A) ;
The trace of [ A ] is
> `trace(A)` := trace(A) : Trace(A) = `trace(A)` ;
* * *
N.B. If two square matrices, [ A ] and [ B ], are of the same order, then the trace of their sum is equal to the sum of their traces
Trace( [ A ] + [ B ] ) = Trace [ A ] + Trace [ B ]
For example, consider the matrix [ A ] as above and matrix [ B ] given as
> B := matrix(3, 3, [8, 2, 1, 1, 3, 0, 4, 2, 3]) : B = matrix(B) ;
(a) The trace of the sum matrix, Trace( [ A ] + [ B ] ) , is
> `trace(A+B)` := trace(A + B) : Trace(A + B) = `trace(A+B)` ;
(b) The sum of traces of both matrices, Trace [ A ] + Trace [ B ], is
> `trace(A)+trace(B)` := trace(A) + trace(B) : Trace(A) + Trace(B) = `trace(A)+trace(B)` ;
* * *
N.B. If two square matrices, [ A ] and [ B ], are of the same order, then the trace of their product does not depend on the order in matrix multiplication
Trace( [ A ] [ B ] ) = Trace( [ B ] [ A ] )
Exemplarily, consider the same matrices [ A ] and [ B ] that were used above.
(a) The trace of the product [ A ] [ B ] is
> `trace(AB)` := trace(evalm(A &* B)) : Trace(`A B`) = `trace(AB)` ;
(b) The trace of the product [ B ] [ A ] is
> `trace(BA)` := trace(evalm(B &* A)) : Trace(`B A`) = `trace(BA)` ;
* * *
N.B. If matrix [ B ] is an invertible matrix of the same order as matrix [ A ], then the trace of the product matrix of the inverse of [ B ] and [ A ] [ B ] is equal to the trace of [ A ]
Trace{(Inv [ B ] ) [ A ] [ B ] } = Trace [ A ]
Exemplarily, consider the same matrices [ A ] and [ B ] as before.
(a) The trace of the product matrix of the inverse of [ B ] and [ A ] [ B ] is
> `trace((inv(B) AB)` := trace(evalm(inverse(B) &* A &* B)) :
> Trace(Inv(B)*A*B) = `trace((inv(B) AB)` ;
(b) The trace of [ A ] is
> `trace(A)` := trace(A) : Trace(A) = `trace(A)` ;
* * *
Proceed to Unit (21) for " Eigenvalues and eigenvectors of matrices ".
-------------------------------------------------------------------