Linear Algebra
Intermediate

Trace of a Matrix

Sum of the diagonal entries of a square matrix.

Formula

tr(A)=iaii\text{tr}(A) = \sum_i a_{ii}

Variables

a_{ii}Diagonal entries

Example

The trace of [[1,2],[3,4]] is 1 + 4 = 5.

Did You Know?

The trace — the sum of the diagonal — equals the sum of all the eigenvalues.