Isomorphism of free modules relating to matrices I have recently encountered this question in my Abstract Algebra studies, which states:

Let $R$ be a ring with unity and for two natural numbers $ m,n \in\mathbb N $ for which the two free $R$-modules $ R^m $ and $ R^n $ are defined. We are to show that these are isomorphic as $R$-modules if and only if there exist matrices $ A \in M_{n \times m}(R) $ and $ B \in M_{m \times n}(R) $ such that $ AB = I_n $ and $ BA = I_m $

To be quite honest I cannot understand the question as I know that free modules are isomorphic iff they are of the same rank but never have I seen something like this, so I am asking here in the hopes of receiving help. Thanks to all helpers.
 A: If they are isomorphic there is an isomorphism $\varphi:R^m\to R^n$. Now choose $e_1,\dots,e_m$ a basis in $R^m$, and $f_1,\dots,f_n$ a basis in $R^n$. Then $\varphi(e_i)=\sum_{j=1}^na_{ij}f_j$ for some $a_{ij}\in R$. This way you get a matrix $A=(a_{ij})\in M_{m\times n}(R)$. Do the same for $\varphi^{-1}$ and find a matrix $B\in M_{n\times m}(R)$. Can you show now that $AB=I_m$ and $BA=I_n$?
Conversely, consider the maps $\varphi_A$, $\varphi_B$ associated to $A$, respectively $B$ (and defined as above). Can you show they are inverse one to each other?
A: Any $A$- module homomorphism $f:A^n \to A^m$ is determined by the image of the generators $e_1, \dots, e_n$ where $e_1 = (1,0,\dots,0)$ etc. Constructing a matrix where the column vectors are $f(e_1), \dots f(e_n)$. In this way $f$ is realized as matrix multiplication in the usual way. Similarly, any $m\times n$ matrix realizes an $A$-linear map from $A^m$ to $A^n$. Thus the condition about the existence of matrices $M,N$ is the same as a condition requiring $A-$module homomorphisms $f: A^m \to A^n, g: A^n \to A^m$ such that $fg = i_{A^n}, gf = i_{A^m}$, i.e. isomorphisms.
