1
$\begingroup$

This might be a really obvious question so I apologize in advance, but I'm having trouble seeing when matrices are commutative for general nxn matrices. For example, when proving tr(AB)=tr(BA), I can easily prove this in a 2x2 matrix but I'm getting confused for proving it in a nxn matrix.

I've searched online and the recurring solution that comes up is:

$$ \Sigma_{i=1}^{n} (AB)_{ii} $$ $$ = \Sigma_{i=1}^{n} \Sigma_{k=1}^{n} A_{nk}B_{kn} $$ $$ = \Sigma_{k=1}^{n} \Sigma_{i=1}^{n} B_{kn}A_{nk} $$ $$ = \Sigma_{i=1}^{n} (BA)_{ii} $$

How come we're able to switch the sums in line 3? I originally tried solving the question by trying to do TR(AB) and TR(BA) separately:

$$ \mathrm{tr}(AB) = \Sigma_{i=1}^{n} (AB)_{ii} = \Sigma_{i=1}^{n} \Sigma_{k=1}^{n} A_{nk}B_{kn} $$

$$ \mathrm{tr}(BA) = \Sigma_{i=1}^{n} (BA)_{ii} = \Sigma_{i=1}^{n} \Sigma_{k=1}^{n} B_{nk}A_{kn} $$

I would greatly appreciate it if someone could perhaps point out where my reasoning went wrong.

$\endgroup$
2
  • $\begingroup$ You can change the order of the sums, because you're summing a finite number of real numbers. $\endgroup$ – Larara Mar 8 '16 at 2:28
  • 1
    $\begingroup$ The second line is already wrong, by the way. I would suggest you try this with $3 \times 3$ matrices and write the corresponding sums out in full, comparing them with your summations. This is a kind of sanity check for what you're writing. $\endgroup$ – David Mar 8 '16 at 2:29
1
$\begingroup$

Basically, you have $$(A_{11}B_{11}+A_{12}B_{21}+\ldots)+(A_{21}B_{12}+A_{22}B_{22}+\ldots)+\ldots$$ and by simply regrouping the terms you get $$(A_{11}B_{11}+A_{21}B_{12}+\ldots)+(A_{12}B_{21}+A_{22}B_{22}+\ldots)+\ldots.$$

The products in the sum are products of scalars, thus commutative, and therefore the two double sums are equal.

If you really want to be rigorous about this, you can probably show it by induction.

$\endgroup$
2
  • $\begingroup$ OH, now I see. I was getting confused by all the notation I suppose. Sorry, now I'm realizing that this is a rather silly question. Thanks for the help! $\endgroup$ – Nikitau Mar 8 '16 at 4:33
  • $\begingroup$ Don't apologise. ;) it's not silly at all to have blind spots when you start out. $\endgroup$ – Fryie Mar 8 '16 at 4:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.