Construct an Injection between the set of rationals $\mathbb{Q}$ and the set of all integers $ \mathbb{Z}$

601 Views Asked by At

Construct an Injection between the set of rationals $\mathbb{Q}$ and the set of all integers $\mathbb{Z}$ .

Answer:

Define $ f: \mathbb{Q} \to \mathbb{N} \ $ by $ \ f\left(\frac{p}{q}\right)=|p-q|+1 \ $ , where $ \gcd(p,q)=1$

Clearly $f$ is an injection.

Next, define $ g: \mathbb{N} \to \mathbb{Z}$ by $ g(n)=n $

Then $ g $ is also an injection.

1

There are 1 best solutions below

0
On BEST ANSWER

Your $f$ is not an injection. There are many pairs of coprime numbers $p, q$ with the same value for $|p - q|$ (famously so when $p$ and $q$ are both prime and $|p-q|= 2$: such pairs are called twin primes). For a specific example, with your definition of $f$, $f(5/3) = 3 = f(13/11)$.