Let $p$ be a prime number and define $\mathbb{Z}_{(p)}=\{\frac{m}{n}:m,n \in \mathbb{Z}, n \not\in p\mathbb{Z}\}$.
Let $M$ be a $\mathbb{Z}$-module and define an equivalence relation $\sim$ in $M \times (\mathbb{Z} \backslash p\mathbb{Z})$ by $(m,r) \sim (m',r') \iff sr'm=srm'$ for some $s \in \mathbb{Z} \backslash p\mathbb{Z}$.
Denote by $\frac{m}{r}$ the equivalence class that contains $(m,r)$.
Define $M_p=\{\frac{m}{r}: m \in M, r \in \mathbb{Z} \backslash p\mathbb{Z}\}$ the set of these equivalence classes.
We know that $M_p$ is a $\mathbb{Z}_{(p)}$-module with respect to the usual operations $+$ and $\cdot$ (like how we sum and multiply two fractions).
Define $\alpha_p:M \rightarrow M_p$ by $m \mapsto \frac{m}{1}$, which is a homomorphism of $\mathbb{Z}$-modules.
Let $N$ be a $\mathbb{Z}_{(p)}$-module and $\alpha:M \rightarrow N$ a homomorphism of $\mathbb{Z}$-modules.
Prove that there exists a unique homomorphism of $\mathbb{Z}_{(p)}$-modules $\beta:M_p \rightarrow N$ such that $\beta(\frac{m}{r})=\frac{1}{r}\alpha(m)$.
My attempt:
Existence: Let $\beta:M_p \rightarrow N$ be defined as $\beta(\frac{m}{r})=\frac{1}{r}\alpha(m)$.
Then $\beta$ is well defined and is a homomorphism of $\mathbb{Z}_{(p)}$-modules (easy to check).
So this proves existence.
For uniqueness I have no idea, can someone help me trying to figure out how to do it, please?
Thanks!
The question here is in fact the following:
This is a kind of universal property of the module of fractions. (Of course, one can define $\beta$ as you did and thus showing the existence.)