Trace
by Siddhant Dixit 20BCS123
Indian Institute of Information Technology Dharwad
INDEX
What is Trace?
Example
Properties
Algorithm
MATLAB Code
WHAT IS
TRACE?
In linear algebra, the trace of a matrix A, denoted tr(A),
is defined to be the sum of elements on the main
diagonal (from the upper left to the lower right) of A.
where denotes the entry on the ith row and ith column of A.
The trace is only defined for a square matrix (n × n).
The trace of an n × n matrix A is defined as
Example
Properties
for all square matrices A and B, and all scalars c
A matrix and its transpose have the same trace
This follows immediately from the fact that transposing a square matrix does not
affect elements along the main diagonal.
Properties
The matrices in a trace of a product can be switched without changing the result:
If A is an m × n matrix and B is an n × m matrix, then
Algorithm
Traverse the matrix along the main diagonal and keep adding to the sum.
for i = 1 : ord
t_sum = t_sum + matrix(i , i);
end
Time Complexity O(n) where n is order of the matrix
Auxiliary Space O(1)
MATLAB Code
Special Regards
Dr. Anand Barangi
Presented By
Siddhant Dixit
20BCS123

Trace of Matrix - Linear Algebra