TITLE: If $AB=I_n$ and $BA=I_m$ then $n=m$.
QUESTION [10 upvotes]: Let $A, B$ matrices $n\times m$ and $m\times n$ respectively so that $AB=I_n$ and $BA=I_m$. Show that $n=m$.

REPLY [2 votes]: Hint: 
$tr(AB) = tr(BA)$; 
where $tr(A)$ is the trace of $A$ (sum of diagonal elements in a square matrix).