R is a commutative ring with $1\ne 0$ and $R^m \cong R^n$, then $m=n$ [duplicate]

If $R$ is a commutative ring with $1\ne 0$ and $R^m \cong R^n$ as direct sums of $R$-modules, then $m=n$.

There is a hint to this problem (I don't know how to use it): Reduce this to the case of a field.

I noticed that there was a similar question. But as a beginner of commutative algebra, I don't know if my question is closely related to that one. Thanks in advance!


Asume $R^m \cong R^n$ as $R$-modules. $\mathfrak{m} \subset R$ be a maximal ideal, $R/\mathfrak{m}$ the residue field.

Tensoring with $R/\mathfrak{m}$, we get $R^m \otimes R/\mathfrak{m} \cong R^n \otimes R/\mathfrak{m}$, hence $R^m/\mathfrak{m} R^m \cong R^n/\mathfrak{m} R^n$. Both of these are finite dimensional vector spaces over $R/\mathfrak{m}$ of dimension $m$ and $n$ respectively.

Hence, by classification of finite dimensional vector spaces, $m = n$.