Function that maps a rational number to its numerator and denominator

359 Views Asked by At

Question: Is there a simple way to represent a function $f:\mathbb Q\to \mathbb Z^2$ that maps a rational number in lowest terms $r=\frac ab$ to the ordered pair of its numerator and denominator $(a,b)$?

By "simple", I mean anything necessary that involves just the value of $r$ itself and not actually $a$ and $b$.

This is just a question that interests me and that I'm curious about; it's not a homework problem or anything close to such. Obviously, a composition of elementary functions would be the most preferable for me, having learnt nothing past the rudiments of graduate-level algebra.

Feel free to re-tag if the tags aren't ideal.

1

There are 1 best solutions below

2
On

Sure, you could define $f:\mathbb Q\rightarrow \mathbb Z^2$ to be the function such that, if $\gcd(a,b)=1$ then $f(\frac{a}b)=(a,b)$. It's pretty clear that such a function exists. However, you're not going to be able to express it in terms of elementary functions because this $f$ would be everywhere discontinuous. This is problematic, because no composition of elementary functions is going to yield an everywhere discontinuous function.