Trace of Product of Matrices

From ProofWiki
Jump to navigation Jump to search

Theorem

Let $\struct {R, +, \circ}$ be a commutative ring.

Let $\mathbf A = \sqbrk a_{m n}$ be an $m \times n$ matrix over $R$.

Let $\mathbf B = \sqbrk b_{n m}$ be an $n \times m$ matrix over $R$.

Then:

$\map \tr {\mathbf A \mathbf B} = \map \tr {\mathbf B \mathbf A}$

where $\map \tr {\mathbf A}$ denotes the trace of $\mathbf A$.


Proof

Let $\mathbf A \mathbf B = \mathbf C = \sqbrk c_m$.

Let $\mathbf B \mathbf A = \mathbf D = \sqbrk d_n$.


Then by definition of matrix products:

\(\ds \forall i, j \in \closedint 1 m: \, \) \(\ds c_{i j}\) \(=\) \(\ds \sum_{k \mathop = 1}^n a_{i k} \circ b_{k j}\)
\(\ds \forall i, j \in \closedint 1 n: \, \) \(\ds d_{i j}\) \(=\) \(\ds \sum_{k \mathop = 1}^m b_{i k} \circ a_{k j}\)


Therefore:

\(\ds \map \tr {\mathbf A \mathbf B}\) \(=\) \(\ds \sum_{j \mathop = 1}^m c_{jj}\) Definition of Trace of Matrix
\(\ds \) \(=\) \(\ds \sum_{j \mathop = 1}^m \sum_{k \mathop = 1}^n a_{j k} \circ b_{k j}\)
\(\ds \) \(=\) \(\ds \sum_{k \mathop = 1}^n \sum_{j \mathop = 1}^m a_{j k} \circ b_{k j}\) Exchange of Order of Indexed Summations
\(\ds \) \(=\) \(\ds \sum_{k \mathop = 1}^n \sum_{j \mathop = 1}^m b_{k j} \circ a_{j k}\) $\circ$ is commutative
\(\ds \) \(=\) \(\ds \sum_{k \mathop = 1}^n d_{kk}\)
\(\ds \) \(=\) \(\ds \map \tr {\mathbf B \mathbf A}\) Definition of Trace of Matrix

$\blacksquare$