Let $M$ be a finitely generated module over a principal Ideal domain $R$. Show that there exists an $R$-module homomorphism $f: R^m\rightarrow R^n$ such that $M\simeq \frac{R^n}{\operatorname{Im}(f)}$, where $\operatorname{Im}(f)$ denotes the image of $f$.
Can anyone help me to write its proof? I have no ideas about it.
Just to clarify: You are supposed to show the existence of two natural numbers $n$ and $m$ together with a map $f \colon R^m \rightarrow R^n$ such that $M \cong R^n/\text{im}(f)$. What we will show is, that $n$ can be taken as the number of generators of $M$ (works as $M$ is finitely generated) and $m$ can be taken as the number of generators of the image of $f$ (in particular we need to argue that this image is free).
Since $M$ is finitely generated, say by $n$ elements, we have a surjection $g \colon R^n \rightarrow M$ and therefore we get $M \cong R^n/\text{ker}(g)$. Now the kernel is a submodule of a free module over a pid and therefore free of say rank $m$. Thus there is a morphism $f \colon R^m \rightarrow R^n$ given by the composition of the isomorphism of the kernel to $R^m$ and the inclusion $i \colon \text{ker}(g) \rightarrow R^n$, such that $M \cong R^n/\text{im}(f)$.