Find a bijection function from $\mathbb{R}\to\mathbb{R}\backslash\mathbb{Z}$

I need to find bijection $$f:\mathbb{R}\to\mathbb{R}\backslash\mathbb{Z}$$ Such a function exists, because the two sets have the same cardinality, but I can't find an explicit one, any ideas?

-
How do you know the sets have the same cardinality? You should be able to use that to find an explicit bijection. –  Chris Eagle Dec 2 '12 at 14:45
If you can find a bijection between $[0, 1)$ and $(0, 1)$ then you are done since you can glue these pieces together to form $\mathbb{R}$ and $\mathbb{R} \setminus \mathbb{Z}$. –  WimC Dec 2 '12 at 14:53
You are right, but the exercise is to prove that the sets have the same cardinality, not using the Cantor–Bernstein theorem, but to find an explicit function. –  Denis Turov Dec 2 '12 at 15:00
Cantor-Bernstein gives an explicit function! –  Chris Eagle Dec 2 '12 at 15:26

Hint: Fix $a_n$ as a sequence of irrational numbers, and write $\mathbb Z=\{z_n\mid n\in\mathbb N\}$. Define a function which sends $a_n$ to $a_{2n}$; $z_n$ to $a_{2n+1}$; and $x$ to itself otherwise.

-
Thanks Asaf! But to fix $a_{n}$, irrational numbers should be countable. How do I define the sequence properly? –  Denis Turov Dec 2 '12 at 15:17
@Denis: The irrational numbers are not countable, of course. But does that mean that there is no countable sequence of irrational numbers?? $k+\pi$ for $k\in\mathbb N$, for example? Square roots of square-free integers? And so on and so forth... –  Asaf Karagila Dec 2 '12 at 15:19
OK, you mean not to map all the irrational numbers as sequence, but to choose one specific irrational sequence like $k+\pi$ ? –  Denis Turov Dec 2 '12 at 15:26
@Denis: Hence the term "Fix $a_n$ as a sequence of irrational numbers", and not "Fix $a_n$ as a sequence of the irrational numbers". –  Asaf Karagila Dec 2 '12 at 15:27
I see! Thanks, very elegant solution. –  Denis Turov Dec 2 '12 at 15:33
1. Take $f:(0,1)\to(0,1]$ to be the inclusion map and define $g:(0,1]\to(0,1)$ by $g(x)=x/2$. These are injections.
2. Find a proof of the Cantor-Bernstein theorem which doesn't use the axiom of choice.
3. Follow the proof using $f$ and $g$ to produce a bijection $h:(0,1)\to(0,1]$.
4. Using translations of $h$ you get a bijection $\Bbb R\setminus\Bbb Z\to\Bbb R$.
-
Yes, I didn't think to use the algorithm of the proof to find the explicit function. Thanks! –  Denis Turov Dec 2 '12 at 15:34