If $R$ is a commutative ring, and $A \in M_{n \times m}(R)$, $B \in M_{m \times n}(R)$ with the property that $AB = I_n$ and $BA = I_m$, prove that $n = m$.
I’m aware of a proof involving traces in the case that $R$ is a field of characteristic zero, but cannot think of / know of a proof for this more general case.