Matrix multiplication in general is not commutative. Here is an example:
Let \(A, B \in \mathbb{R}^{2 \times 2}\):
Then:
When Is 2×2 Matrix Multiplication Commutative?
So you get four equations:
You might note that (I) is the same as (IV). So you have these equations:
Case #1: a ≠ d and e ≠ h
Now (I) and (II) are essentially the same. So we only demand that \(bg = cf\) and \(a \neq d\) and \(e \neq h\) for commutative matrix multiplication of \(2 \times 2\) matrices.
Case #2.1: a = d
So you end up with: \((e = h \text{ and } bg = cf)\) or \((b = c = 0)\)
Case #2.2: e = h
So you end up with: \((a = d \text{ and } bg = cf)\) or \((f = g = 0)\)
Special Cases
Matrix multiplication is always commutative if:
- One matrix is the Identity matrix
- One matrix is the Zero matrix
- Both matrices are \(2 \times 2\) rotation matrices (basically case #2)
- Both matrices are Diagonal matrices
Simultaneous Diagonalization
Two matrices \(A, B \in \mathbb{R}^{n \times n}\) are called simultaneously diagonalizable if and only if one matrix \(S \in \mathbb{R}^{n \times n}\) exists, such that \(D_A = S^{-1} \cdot A \cdot S\) and \(D_B = S^{-1} \cdot B \cdot S\) where \(D_A\) and \(D_B\) are diagonal matrices.
Theorem: If \(A, B \in \mathbb{R}^{n \times n}\) are simultaneously diagonalizable, then \(A \cdot B = B \cdot A\).
Proof: Since A and B are simultaneously diagonalizable, a matrix \(S \in \mathbb{R}^{n \times n}\) exists such that \(D_A = S^{-1} \cdot A \cdot S\) and \(D_B = S^{-1} \cdot B \cdot S\) where \(D_A\) and \(D_B\) are diagonal matrices.
Note: The converse is not true: \(A \cdot B = B \cdot A \nRightarrow A, B\) are simultaneously diagonalizable.
Proof by counterexample:
but \(\begin{pmatrix}0 & 1 \\ 0 & 0\end{pmatrix}\) is not diagonalizable. \(\blacksquare\)
See Also
- When is matrix multiplication commutative? on math.stackexchange.com