The trace of a square real matrix is the sum of its diagonal entries.
We denote the function which associates a
matrix with its trace by $\tr: \R ^{n \times
n} \to \R $.
The trace of $A \in \R ^{n \times n}$ is
\[
\tr A = \sum_{i = 1}^{n} A_{ii}.
\]
The trace is a linear function on the vector space of $n \times n$ real matrices.
\[ \begin{aligned} \tr C = \sum_{i = 1}^{n} C_{ii} &= \sum_{i = 1}^{n} \alpha A_{ii} + \beta B_{ii} \\ &= \alpha \sum_{i = 1}^{n} A_{ii} + \beta \sum_{i = 1}^{n} B_{ii} \\ &= \alpha \tr A + \beta \tr B. \end{aligned} \]
\[ \trp{AB} = \trp{BA}. \]
In other words, “matrices commute under the trace operator.”