If you had two matrices $P$ and $Q$ where $P$ is an $n\times m$ matrix and $Q$ is an $m \times n$ matrix both with integer entries satisfying:
$$PQ = I_{n} \text{ and } QP = I_{m}$$
How would you prove that $n=m$? I read somewhere that because $\mathbb{Z} \subset \mathbb{Q} $ you can think of the matrices with entries over $\mathbb{Q}$ so that makes $P=Q^{-1}$ but I don't understand how that conclusion has been made.
One way is to see it as a rank thing: an operator cannot increase rank. So $PQ=I_n$ tells you that the ranks of $P$ and $Q$ are at least $n$; thus $m\geq n$. The other equality gives you $m\leq n$.
Another, direct proof, can be obtained by taking the trace. The equality $\operatorname{Tr}(AB)=\operatorname{Tr}(BA)$ holds whenever $AB$ and $BA $ make sense. Thus $$ n=\operatorname{Tr}(I_n)=\operatorname{Tr}(PQ)=\operatorname{Tr}(QP)=\operatorname{Tr}(I_m)=m. $$