# Trace of a square matrix

2010 Mathematics Subject Classification: Primary: 15A15 [MSN][ZBL] $\newcommand{\tr}{\mathop{\mathrm{tr}}} \newcommand{\Tr}{\mathop{\mathrm{Tr}}} \newcommand{\Sp}{\mathop{\mathrm{Sp}}} \newcommand{\End}{\mathop{\mathrm{End}}}$
The sum of the entries on the main diagonal of this matrix. The trace of a matrix $A = [a_{ij}]$ is denoted by $\tr A$, $\Tr A$ or $\Sp A$: $$\tr A = \sum_{i=0}^n a_{ii}$$ Let $A$ be a square matrix of order $n$ over a field $k$. The trace of $A$ coincides with the sum of the roots of the characteristic polynomial of $A$. If $k$ is a field of characteristic 0, then the $n$ traces $\tr A, \ldots \tr A^n$ uniquely determine the characteristic polynomial of $A$. In particular, $A$ is nilpotent if and only if $\tr A^m = 0$ for all $m=1,\ldots,n$.
If $A$ and $B$ are square matrices of the same order over $k$, and $\alpha,\beta \in k$, then $$\tr(\alpha A + \beta B) = \alpha \tr A + \beta \tr B, \quad \tr AB = \tr BA,$$ while if $\det B \neq 0$, $$\label{eq:a1} \tr(BAB^{-1}) = \tr A.$$ The trace of the tensor (Kronecker) product of square matrices over a field is equal to the product of the traces of the factors.
The trace of a product of matrices $A \in \mathbb{R}^{n \times m}$, $B \in \mathbb{R}^{m \times n}$ with a resulting square matrix is equal to the sum over all components of a hadamard product of $A$ and $B^T$: $$\tr(AB) = \sum_{i=1}^n \sum_{j=1}^n (A \circ B^T)_{i,j}.$$