In linear algebra, the trace of a square matrix A, denoted tr(A), is the sum of the elements on its main diagonal,