This is just a check on my reasoning, I guess.
So for two matrices $A, B$ to commute, the following must hold:
$$(AB)_{ij} = \sum_{k=1}^{n}a_{ik}b_{kj} = \sum_{k=1}^{n}b_{ik}a_{kj} = (BA)_{ij}$$
This can happen if for all $i, j, k$:
a. $a_{ik}=a_{kj}$ and $b_{ik}=b_{kj}$, or
b. $a_{ik}=b_{ik}$ and $a_{kj}=b_{kj}$, i.e. $A=B$, or
c. $a_{ik} = 0$ or $b_{ik} = 0$, i.e. either matrix is null.
Are there more possibilities?
Edit: I originally had (a) as "Both matrices are symmetric", but as @user1551 points out, this is not true. After fixing the summations, I see where I was mistaken. I'm not sure how to characterize (a) now.
Hm.
The summation is supposed to capture that each entry is the inner product of a row of A and a column of B (or the other way around).
– Nathan Sep 28 '15 at 16:43