30
$\begingroup$

I'm working with trace of matrices. Trace is defined for square matrix and there are some useful rule, i.e. $\text{tr}(AB) = \text{tr}(BA)$, with $A$ and $B$ square, and more in general trace is invariant under cyclic permutation.

I was wondering if the formula $\text{tr}(AB) = \text{tr}(BA)$ holds even if $A$ and $B$ are rectangular, namely $A$ is $n$-by-$m$ and $B$ is $m$-by-$n$.

I figured out that if one completes the involved matrices to be square by adding zero entries in the right places, then the formula still works... but I want to be sure about this!

$\endgroup$

2 Answers 2

42
$\begingroup$

Yes, it holds true. Let $A$ be a $n\times m$ and $B$ be a $m \times n$ matrix over the commutative ring $R$, we have \begin{align*} \mathrm{tr}(AB) &= \sum_{i=1}^n (AB)_{ii}\\ &=\sum_{i=1}^n \sum_{j=1}^m A_{ij}B_{ji}\\ &= \sum_{j=1}^m \sum_{i=1}^n B_{ji}A_{ij}\\ &= \sum_{j=1}^m (BA)_{jj}\\ &= \mathrm{tr}(BA) \end{align*} So you can just prove the formula by computing.

$\endgroup$
13
$\begingroup$

Yes, the cyclic invariance holds irrespective of the dimensions of the matrices. The trace of a product in either order is simply the sum of all products of corresponding entries.

$\endgroup$
1
  • 1
    $\begingroup$ For posterity: Just make sure that the matrix product exists. You obviously can't take the trace of the product if the matrices don't multiply! $\endgroup$
    – jtb
    Jan 27 at 21:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .