An $R$-module $M$ is free if and only if it has a basis I know there are several equivalent definitions of free module. One of which is as follows:

An $R$-module $M$ is free if and only if it has a basis.

This is not too clear to me why the above statement is true. The definition that I'm familiar with is:
$M$ is free if there exists an isomorphic to $R^n$ for some $n$.
I have already went through the arguments made in the link, but I'm still having trouble understanding. Can somebody try to explain (or formally prove) why the statement is true?
 A: I will proof $M$ is a free $R$-Module (according to your definition) if and only if it has a basis.
"$\Longrightarrow$": Let $M \cong R^n$ for some $n \in \mathbb{N}.$ Consider the standard-basis $e_i$ of $R^n$ for $i=1,...,n$ and call the isomorphism $\varphi$. We now want to show that the images under $\varphi$ of the $e_i$ form a basis of $M$. Let $m \in M$. By surjectivity of $\varphi$ we have a $r \in R^n$ with $\varphi(r)=m$. Since the $e_i$ form a basis of $R^n$ we have that $r= \sum_{i=1}^n r_ie_i, r_i \in R$ and thus $$m= \sum_{i=1}^n r_i. \varphi(e_i).$$ This shows that the images generate $M$. We now want to show the linear independence. Let $a_i \in R$ with $\sum_{i=1}^n a_i.\varphi(e_i)=0$. We obtain by injectivity and $R$-linearity of $\varphi$ that $$0=\sum_{i=1}^na_ie_i$$ and since this is already a basis this implies that $a_i=0$ for all $i=1,...,n$.
"$\Longleftarrow$": Let $M$ have a basis $m_i, i=1,...,n$. We define $$\psi: \begin{cases}
M \to R^n \\
\sum_{i=1}^n r_i.m_i \to \sum_{i=1}^n r_ie_i.
\end{cases}$$
This map is well defined and $R$-linear. It remains to show that this map is bijective. This however follows since we know that the $e_i$ form a basis of $R^n$.
