(1) Choose an infinite countable set of irrational numbers in $(0,1)$, call them $(r_n)_{n\geqslant0}$.
(2) Enumerate the rational numbers in $(0,1)$ as $(q_n)_{n\geqslant0}$.
(3) Define $f$ by $f(q_n)=r_{2n+1}$ for every $n\geqslant0$, $f(r_n)=r_{2n}$ for every $n\geqslant0$, and $f(x)=x$ for every irrational number $x$ which does not appear in the sequence $(r_n)_{n\geqslant0}$.
Let me suggest you take it from here and show that $f$ is a bijection between $(0,1)$ and $(0,1)\setminus\mathbb Q$.
The nicest trick in the book is to find a bijection between $\mathbb R$ and $\mathbb{N^N}$, in this case we are practically done. Why?
$$\mathbb{(N^N)^N\sim N^{N\times N}\sim N^N}$$
And the bijections above are easy to calculate (I will leave those to you, the first bijection is a simple Currying, and for the second you can use Cantor's pairing function).
So if we can find a nice bijection between the real numbers the infinite sequences of natural numbers we are about done. Now, we know that $\mathbb{N^N}$ can be identified with the real numbers, in fact continued fractions form a bijection between the irrationals and $\mathbb{N^N}$.
We first need to handle the rational numbers, but that much is not very difficult. Take an enumeration of the rationals (e.g. Calkin-Wilf tree) in $(0,1)$, suppose $q_i$ is the $i$-th rational in the enumeration; now we take a sequence of irrationals, e.g. $r_n = \frac1{\sqrt{n^2+1}}$, and we define the following function:
$$h(x)=\begin{cases} r_{2n} & \exists n: x=r_n\\ r_{2n+1} & \exists n: x=q_n \\ x &\text{otherwise}\end{cases}$$
Now we can finally describe a list of bijections which, when composed, give us a bijection between $\mathbb R$ and $\mathbb{R^N}$.
- $\mathbb{R^N\to (0,1)^N}$ by any bijection of this sort.
- $\mathbb{(0,1)^N\to \left((0,1)\setminus Q\right)^N}$ by the encoding given by $h$.
- $\mathbb{\left((0,1)\setminus Q\right)^N\to \left(N^N\right)^N}$ by continued fractions.
- $\mathbb{\left(N^N\right)^N\to N^{N\times N}}$ by Currying.
- $\mathbb{N^{N\times N}\to N^N}$ by a pairing function.
- $\mathbb{N^N\to (0,1)\setminus Q}$ by decoding the continued fractions.
- $\mathbb{(0,1)\setminus Q\to (0,1)}$ by the decoding of $h$, i.e. $h^{-1}$.
- $\mathbb{(0,1)\to R}$ by any bijection of this sort, e.g. the inverse of the bijection used for the first step.
Best Answer
Hint. Use Hilbert's Hotel to lodge some numbers in $(0,1)$; then deal with the two newcomers $0$ and $1$.
That is: find a sequence $x_1,x_2,\ldots,x_n,\ldots$ of numbers in $(0,1)$, all distinct. Map $x_1$ to $0$; map $x_2$ to $1$. Map $x_3$ to $x_1$. Map $x_4$ to $x_2$. And so on. As for the rest of the numbers in $(0,1)$, well, they can just stay where they are...