In linear algebra, the trace of an n × n square matrix A is defined to be the sum of the elements on the main diagonal (the diagonal from the upper left to the lower right) of A. tr ( A ) = ∑ i = 1 n a i i = a 11 + a 22 + ⋯ + a n n {displaystyle operatorname {tr} (mathbf {A} )=sum _{i=1}^{n}a_{ii}=a_{11}+a_{22}+dots +a_{nn}} tr ( A + B ) = tr ( A ) + tr ( B ) tr ( c A ) = c tr ( A ) {displaystyle {egin{aligned}operatorname {tr} (mathbf {A} +mathbf {B} )&=operatorname {tr} (mathbf {A} )+operatorname {tr} (mathbf {B} )\operatorname {tr} (cmathbf {A} )&=coperatorname {tr} (mathbf {A} )end{aligned}}} tr ( A B ) = tr ( B A ) {displaystyle operatorname {tr} (mathbf {A} mathbf {B} )=operatorname {tr} (mathbf {B} mathbf {A} )} tr ( A B C D ) = tr ( B C D A ) = tr ( C D A B ) = tr ( D A B C ) . {displaystyle operatorname {tr} (mathbf {A} mathbf {B} mathbf {C} mathbf {D} )=operatorname {tr} (mathbf {B} mathbf {C} mathbf {D} mathbf {A} )=operatorname {tr} (mathbf {C} mathbf {D} mathbf {A} mathbf {B} )=operatorname {tr} (mathbf {D} mathbf {A} mathbf {B} mathbf {C} ).} tr ( A ) = ∑ i = 1 k d i λ i {displaystyle operatorname {tr} (mathbf {A} )=sum _{i=1}^{k}d_{i}lambda _{i}} tr ( A ) = ∑ i λ i {displaystyle operatorname {tr} (mathbf {A} )=sum _{i}lambda _{i}} In linear algebra, the trace of an n × n square matrix A is defined to be the sum of the elements on the main diagonal (the diagonal from the upper left to the lower right) of A. The trace of a matrix is the sum of the (complex) eigenvalues, and it is invariant with respect to a change of basis. This characterization can be used to define the trace of a linear operator in general. The trace is only defined for a square matrix (n × n). The trace (often abbreviated to tr) is related to the derivative of the determinant (see Jacobi's formula). The trace of an n × n square matrix A is defined as:34 where aii denotes the entry on the ith row and ith column of A. Let A be a matrix, with