A well-defined map from rational numbers to integers

1.6k Views Asked by At

I am trying to come up with a well-defined map from $\mathbb{Q}$$\to$ $\mathbb{Z}$

i.e. find a map $f$ such that it maps $\frac{a}{b}$ $\epsilon$ $\mathbb{Q}$ to an integer in $\mathbb{Z}$. I tried a couple of things, and unfortunately, they did not work.

The one that I recently came up with is the given map:

$f$($\frac{a}{b}$)= $\frac{a+b}{gcd(a,b)}$

However, I just do not see how I can prove that this is indeed a well-defined map. All I am doing at this stage is randomly plugging numbers to see if this works.

Is this map well-defined? If yes, can someone help me prove it? If not, is there a well-defined map from $\mathbb{Q}$$\to$ $\mathbb{Z}$ $?$

2

There are 2 best solutions below

1
On BEST ANSWER

Yes, your map is well-defined. Suppose that $\frac ab=\frac cd$. Let $m=\frac a{\gcd(a,b)}$ and let $n=\frac b{\gcd(a,b)}$. Then there are integers $\alpha$ and $\beta$ such that $a=\alpha m$, $b=\alpha n$, $c=\beta m$, and $d=\beta n$. Then$$\frac{a+b}{\gcd(a,b)}=\frac{\alpha m+\alpha n}{\gcd(\alpha m,\alpha n)}=\frac{m+n}{\gcd(m,n)}$$and$$\frac{c+d}{\gcd(c,d)}=\frac{\beta m+\beta n}{\gcd(\beta m,\beta n)}=\frac{m+n}{\gcd(m,n)}.$$So$$\frac{a+b}{\gcd(a,b)}=\frac{c+d}{\gcd(c,d)}.$$

5
On

Both the sets are countably infinite therefore such a mapping definately exists. One of many possible maps is as follows.
Let's represent the rational numbers as $$ s\frac{p}{q} $$ p,q belong to natural numbers and the GCD of p and q is 1 and s belongs to set {1,-1}. Then we define $$ f: Q\rightarrow Z $$ $$f(s\frac{p}{q})=s2^p3^q$$ Done!