0

I'm having difficulty trying to think of a bijective function that can map the set of natural numbers to the set of rational numbers. Is such a function even possible?

A function I thought up is f(x) : x/2 this function is injective but not surjective I believe?

Asaf Karagila
  • 393,674
yomama
  • 1
  • Alternatively, speaking solely for functions $\mathbb{N} \to \mathbb{Q}$, you have, in essence, the Cantor pairing function (Wikipedia), which can be visualized in a map to the positive rationals as so. Adjusting as necessary to all rationals is trivial. – PrincessEev Oct 01 '22 at 05:28
  • @PrincessEev is a mapping of rationals to naturals the same as a mapping of naturals to rationals? – yomama Oct 01 '22 at 05:28
  • 1
    They're not, but being a bijection they are necessarily invertible, so unless you really must go $\mathbb{N} \to \mathbb{Q}$, either direction will suffice for this purpose. – PrincessEev Oct 01 '22 at 05:29
  • 1
    And yes, you are correct that $f(x)=x/2$ is not at all sufficient. It is injective, trivially, but definitely not surjective ($f(x)$ is never equal to $1/3$, for instance). – PrincessEev Oct 01 '22 at 05:31
  • @PrincessEev I went through all the answers in the post you linked, and unfortunately i understood very little. Is there not a simple function to map the naturals to rationals? – yomama Oct 01 '22 at 06:01
  • Just because one exists need not mean a simple one exists. After all, you're dealing with the naturals (very "simple" objects) and the rationals (which are a lot more complicated, on top of having to deal with issues like the top and bottom being coprime to avoid double-counting, among others). I don't see a reason why a simple bijection should exist. – PrincessEev Oct 01 '22 at 06:58
  • Arguably, the simplest such function is given by the Stern-Brocot tree, which is, er, well, go read and decide for yourself whether you'd call it simple. – Ivan Neretin Oct 01 '22 at 08:22

0 Answers0