how to deduce two matrices $P$ and $Q$ are square if $PQ=I_{n}$ and $QP=I_{m}$ 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.
 A: One way to see this is by thinking of an $n \times m$ matrix as a linear function $\mathbb{R}^m \to \mathbb{R}^n$. If you let $S : \mathbb{R}^m \to \mathbb{R}^n$ be the linear function whose matrix with respect to the standard basis is $P$ and $T : \mathbb{R}^n \to \mathbb{R}^m$ be the linear function with matrix $Q$, then we see that $T \circ S = \text{Id}_m$ and $S \circ T = \text{Id}_n$ means that $T$ has a two-sided inverse. Thus, $S$ must be a bijection, and therefore a vector space isomorphism. So, we see that $\mathbb{R}^m$ is isomorphic to $\mathbb{R}^n$. Thus, it must be the case that $n = m$, so $S : \mathbb{R}^m \to \mathbb{R}^m$ and its matrix form, $P$, must be an $m \times m$ matrix. Therefore, $P$ (and likewise $Q$) are square matrices.
A: 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. 
$$
