$f\left(\frac{a}{b}\right)=a+\frac{a}{b},b>0$ and $\operatorname{gcd}(a,b)=1$, show $f$ is injective but not surjective. Problem 5. (6 points.) We write each rational number uniquely as a fraction $\frac{a}{b}$, where $a, b \in \mathbb{Z}$ with $b>0$ and $\operatorname{gcd}(a, b)=1 .$ Then we define the function $f: \mathbb{Q} \longrightarrow \mathbb{Q}$ as follows:
$$
f\left(\frac{a}{b}\right)=a+\frac{a}{b} \text { . }
$$
Prove that $f$ is injective but not surjective.
$f\left(\frac{a}{b}\right)=a+\frac{a}{b},b>0$ and $\operatorname{gcd}(a,b)=1$, show $f$ is injective but not surjective.
My idea is let $f\left(\frac{a}{b}\right) = f\left(\frac{c}{d}\right)$ and trying to find $(a-c)\cdot(b-d)=0$ but no matter how I try, I just stuck at here. Really hope someone can help me with it! Thanks!
 A: When you are trying to show injectivity, I think you will find it easier to suppose you have $\frac{a}{b} \neq \frac{c}{d}$ and show $f(\frac{a}{b}) \neq f(\frac{c}{d})$.
For the map not being surjective, remember that $a \in \mathbb{Z}$ - therefore $a \geq 1, a = 0, a \leq -1$. What ranges of values does the function map to when $a$ meets these conditions?
A: Let $\frac a{\gcd(a,c)} =a'; \frac c{\gcd(c,d)}=c'; \frac b{\gcd(b,d)}=b'; \frac d{\gcd(b,d)}= d'$.  As $a$ and $b$ have no factors in common neither to $a'$ and $b'$ and similarly $c',d'$ have no factors in common (other than $1$).  And as we have factored out the common divisor $a'$ and $c'$ have no factors in common other than $1$ and $b'$ and $d'$ don't either.
So $f(\frac ab)=f(\frac cd)$
$a + \frac ab = c+\frac cd$. Multiply both sides by $bd$ to get
$bda + ad = bcd + bc$.  Divide both sides by $\gcd(a,c)\cdot \gcd(b,d)$ to get
$bd'a' + a'd' = bc'd' + b'c'$
$d'$ is a factor of the LHS and $d'$ is a factor of $bc'd'$ on the RHS so $d'$ must be a factor of $b'c'$ but $d',c'$ have now factors in common so $d'$ must be a factor of $b'$.
$ba' + a' = bc' + (\frac {b'}{d'})c'$.
!!!! NOW !!!!!
$(\frac {b'}{d'})$ is factor of $b'$ and $b'$ is a factor of $b$ so $(\frac {b'}{d'})$ divides the RHS so it must divide the LHS but it divides $ba'$ so it must also divide $a'$.
BUT $a'$ and $b'$ have no factors other than $1$ is common!!!! So $(\frac {b'}{d'}) = \pm 1$
And as $b' > 0; d' > 0$ so $\frac {b'}{d'} = 1$ and $b' = d'$.
And so $b = b'\gcd(b,d) = d'\gcd(b,d) = d$.
.....
Okay that was long but... back to the beginning.
$a + \frac ab =a+\frac ad = c+\frac cd$
$a(1+\frac 1d)=c(1 + \frac 1d)$.  $d> 0$ so $1+\frac 1d\ne 0$.
So $a = c$.
So $\frac ab = \frac cd$.
A: Consider the bijection between $\mathbb{Q}$ and the set of $\mathcal{P}$ pairs $(a,b)$ of relatively prime integers, $b>0$. Then the corresponding map from $\mathcal{P}$ to itself is
$$(a,b) \mapsto (a(b+1), b)$$
with partially defined inverse
$$(c,b)\mapsto (c\colon (b+1), b)$$
on the subset of pairs $(c,b)$ of $\mathcal{P}$ such that $b+1 \mid c$.
