The trace of a matrix written as for some square matrix is the sum of it's diagonal entries.
Formally we can define the trace of a matrix as follows: