# Only 1 by 1 Matrices Generally Commute Under Multiplication

## Theorem

Let $R$ be a commutative ring.

Let $\mathcal M_{m \times n}$ be the set of all $m \times n$ matrices over $R$.

Then under conventional matrix multiplication:

- $\mathbf {A B} = \mathbf {B A}$ for all $\mathbf A \in \mathcal M_{m \times n}, \; \mathbf B \in \mathcal M_{n \times p}$ if and only if $p = m = n = 1$.

## Proof

Consider $p \ne m$.

Then $\mathbf {AB}$ is defined, but $\mathbf {BA}$ is not.

So:

- $p \ne m \implies \mathbf {AB} \ne \mathbf {BA}$

Now consider $p = m$, and $m \ne n$.

Then $\mathbf {A B}$ is an $m \times m$ matrix, while $\mathbf {BA}$ is an $n \times n$ matrix.

$p \ne m \implies \mathbf {AB} \ne \mathbf {BA}$ regardless of whether $m = n$ is true or not.

Hence:

- $p \ne m \lor m \ne n \implies \mathbf {AB} \ne \mathbf {BA}$

Now consider $p = m$, $m = n$, and $n \ne 1$.

It remains to be proved that:

- $\mathbf {AB} \ne \mathbf {BA}$

This is demonstrated in Matrix Multiplication on Square Matrices over Ring with Unity is not Commutative.

Hence we have that $p \ne m \lor m \ne n \implies \mathbf {AB} \ne \mathbf {BA}$ regardless of whether $n = 1$ is true or not, so it is easily seen that:

- $p \ne m \lor m \ne n \lor n \ne 1 \implies \exists \mathbf A \in \mathcal M_{m \times n}, \mathbf B \in \mathcal M_{n \times p}: \mathbf {AB} \ne \mathbf {BA} \dashv \vdash \\ \left(\forall \mathbf A \in \mathcal M_{m \times n}, \mathbf B \in \mathcal M_{n \times p}: \mathbf {AB} = \mathbf {BA}\right) \implies \lnot \left({p \ne m \lor m \ne n \lor n \ne 1}\right)$

by Rule of Transposition. The existential quantifier is needed here because there exist square matrices that commute under matrix multiplication, e.g. the unit matrix.

- $\lnot \left({p \ne m \lor m \ne n \lor n \ne 1}\right) \dashv \vdash p = m \land m = n \land n = 1$

by a generalization of De Morgan's Law.

Finally, by the properties of an equivalence relation:

- $(1): \quad \paren {\forall \mathbf A \in \mathcal M_{m \times n}, \mathbf B \in \mathcal M_{n \times p}: \mathbf {AB} = \mathbf {BA} } \implies p = m = n = 1$

Now to prove the converse:

Let $\mathbf A \in \mathcal M_{m \times n}$, $\mathbf B \in \mathcal M_{n \times p}$, and suppose that $p = m = n = 1$, then because $R$ is a commutative ring:

- $\mathbf {AB} = A_{11} B_{11} = B_{11} A_{11} = \mathbf {BA}$

and so

- $(2): \quad p = m = n = 1 \implies \paren {\forall \mathbf A \in \mathcal M_{m \times n}, \mathbf B \in \mathcal M_{n \times p}: \mathbf {AB} = \mathbf {BA} }$

Combining $(1)$ and $(2)$ yields the result.

$\blacksquare$