Any two bases of a free module have the same cardinality. I am a graduate student of Mathematics.I am interested in modules.I have some queries about free modules. Let $R$ be a commutative (unital) ring and $M$ be a free $R$-module,then:
$1.$ Are the cardinalities of any two bases of $M$ same?(If not,give a counterexample)
$2.$ If the free module has a finite basis,then is it true?
I want to know these things because I want to differentiate between vector spaces and free modules.Can someone provide me with suitable proofs and counterexamples?I have tried but my list of examples is too limited to answer these questions.Can someone help me?
 A: The statements are true for commutative rings, but fail in general for noncommutative ones.
Let $R$ be the endomorphism ring of a nonfinitely generated vector space $V$ over a field $k$; no need to invoke the axiom of choice, because you can take a vector space with basis $\{e_0,e_1,\dots,e_n,\dotsc\}$.
Then, as left modules over $R$, we have $R\cong R\oplus R$. So no, in general the cardinality of a basis in a free module is not an invariant.
Note that $R$ is a simple ring (it has no nontrivial maximal two-sided ideals) when $V$ has a countable basis, so one cannot in general reduce to ve
It is a standard exercise to show that the cardinality of a basis is indeed invariant for nonfinitely generated free modules (requires some form of choice, though).
A theorem by Leavitt states that, given any positive integer $k$, there exists a (noncommutative) ring $R$ such that $R^m\cong R^n$ as left modules if and only if $m\equiv n\pmod{k}$. The example above works for $k=1$.
Rings for which (left) finitely generated free modules invariant cardinality of bases are often called IBN (invariant basis number). Among IBN rings one finds the commutative rings and also the division rings. For the latter case, the standard proof for vector spaces over field carries over. For commutative rings one reduces to $k=R/I$, where $I$ is any maximal ideal.
Note that, in the initial example, $R$ is a simple ring (it has no nontrivial maximal two-sided ideals) when $V$ has a countable basis, so one cannot in general reduce to vector spaces like it can be done for commutative rings and this is exactly the obstruction for IBN.

W. G. Leavitt (1957), Modules without invariant basis number, Proc. Amer. Math. Soc. 8, pp. 322-328
A: 1 is in fact true (edited: when $R$ is commutative). Indeed, a basis of $M$ over $R$ becomes a $k$-basis of $M \otimes_{R}k$, where $k$ is any residue field of $R$ (eg the quotient of $R$ by a maximal ideal). So any $R$-basis of $M$ has cardinality $\dim_k (M \otimes_{R} k)$.
