The set of real numbers and power set of the natural numbers

It's not quite correct to ask for "the function", because if there is one then there are many. Moreover, explicit bijections are highly overrated. We can write one, but it's much much oh so much easier to use the Cantor-Bernstein theorem, and simply exhibit two injections.

If you do insist on writing an actual bijection, let me identify $\mathcal P(\Bbb N)$ with infinite binary sequences (which is quite standard). Now let me describe the steps. We would like to take a binary sequence to the real number in $[0,1]$ which has this binary string as an expansion. However some numbers, e.g. $\frac12=0.1\bar0_2=0.0\bar1_2$, one sequence with finitely many $1$'s and the other has finitely many $0$'s.

  1. First enumerate all the strings which contain finitely many $0$'s the strings containing finitely many $1$'s. One can show that both sets are countably infinite, one can even enumerate them in a very nice way. Write them as $p_n$ for the $n$-th sequence with finitely many zeros and $q_n$ for the $n$-th sequence with finitely many $1$'s.

    The next step is to take $f\colon2^\Bbb N\to2^\Bbb N$ defined as: $$f(x)=\begin{cases} q_{2k} & x=p_k\\ q_{2k+1} & x=q_k\\ x &\text{otherwise}\end{cases}$$ Easily this is an injection whose range is $2^\Bbb N\setminus\{p_n\mid n\in\Bbb N\}$.

  2. Now map $x\in2^\Bbb N$ to $r\in[0,1)$ such that, $$r=\sum_{n\in\Bbb N}\frac{f(x)}{2^{n}}$$ that is the real number whose binary expansion is $f(x)$. One can show that this is a surjective function, since if a number has a binary expansion then it has one which has infinitely many $0$'s. It is also injective since if a real number one has two different binary expansions then we can show that exactly one of them has finitely many $0$'s and the other finitely many $1$'s. But since we use $f(x)$, this is impossible.

  3. Find a bijection between $[0,1)$ and $\Bbb R$. Usually one does that by first "folding $0$ in" and having a bijection between $[0,1)$ and $(0,1)$ and then using something like $\frac{2x-1}{x(x-1)}$ or a similar function for a bijection with $\Bbb R$.


Using the Cantor-Bernstein theorem is much easier.

  1. First note that that $\Bbb R$ can inject into $\mathcal P(\Bbb Q)$ by mapping $r$ to $\{q\in\Bbb Q\mid q<r\}$. Since $\Bbb Q$ is countable there is a bijection between $\cal P(\Bbb Q)$ and $\cal P(\Bbb N)$. So $\Bbb R$ injects into $\cal P(\Bbb N)$.

  2. Then note that we can map $x\in2^\Bbb N$ to the continued fraction defined by the sequence $x$. Or to a point in $[0,1]$ defined by $\sum\frac{x(n)}{3^{n+1}}$, which we can show is injective in a somewhat easier proof.

Finally, as mentioned the last part is false. From the usual axioms of modern set theory (read: $\sf ZFC$) we cannot prove nor disprove that there are no intermediate cardinalities between $\Bbb N$ and $\Bbb R$. The proof of that is difficult and require a deep understanding of modern [read: axiomatic] set theory, as well logic.

If the last part somehow confused you, perhaps my answer to this question can help, Why is the Continuum Hypothesis (not) true?.


An explicit mapping is difficult to write out. But you can see one possible way on constructing it through this argument showing that the power set of $\mathbb{Z}$ and $\mathbb{R}$ have the same cardinality. I'll start by showing $\mathbb{R}$ is uncountable and then use that idea to show that the two sets have the same cardinality.

First, we show the classic Cantor proof that $\mathbb{R}$ is uncountable. It would suffice to show that $[0,1]$ is uncountable. We assume that every real number $x\in [0,1]$ has a decimal expansion that does not end in an infinite sequence of 9's. Suppose that $\mathbb{R}$ is countable. We could then construct a bijection from $\mathbb{Z}_+$ to $[0,1]$. Writing out $x$'s decimal expansion,$$x_1 = n_{1,1}n_{1,2},\cdots,n_{1,j}$$ $$ x_2 = n_{2,1}n_{2,2},\cdots,n_{2,j}$$ and so on, where $n_{i,j}$ is some number in $\{0,1,2,3,4,5,6,7,8,9\}$. Suppose all the number appeared in the order we wrote above. Now let $y_j=1$ if $n_{j,j}=0$ and $y_j=0$ if $n_{j,j}>0$. But we now have disagreement with $y_j$ and $x_j$ at the $n$th position! So $y_{j}$ is not on our list. However, $y_j$ is a real number. Therefore, the interval $[0,1)$ is uncountable. Moreover, the reals are uncountable.

Now we define a function $f: [0,1)\rightarrow \mathbb{Z}_+$. Notice $x \in [0,1)$ has a unique binary expansion (as the previous restriction on non repeating infinite 9's is equivalent to non infinite repeating 1's). So $x=\sum_{i=1}^{\infty} \, \frac{x_i}{2^i}$, where each $x_i$ is either 0 or 1. So we have $f(x)=\{i \, \, | \, \, i \in \mathbb{Z}_+ \wedge x_i=1\}$ as an injection. Notice that we can also define an injection $g:P(\mathbb{Z}_+)\rightarrow [0,1)$ by $x_{i,n}=0$ if $i \notin n$ and $x_{i,n}=1$ if $i \in n$, where $n\in P(\mathbb{Z}_+)$. Then using the ordinary decimal expansion on $n$, we have an injection. Then by the Cantor-Schroeder-Bernstein Theorem, there is a bijective function from $P(\mathbb{Z}_+)$ and $[0,1)$. But we have injective function $h(x)=\frac{x}{2}$ from $[0,1]$ to $[0,1)$ and the injective function $i(x)=x$ from $[0,1)$ to $[0,1]$. Hence, there is a bijective function from $[0,1]$ to $[0,1)$. Therefore, there is a bijective function from $P(\mathbb{Z}_+)$ to $\mathbb{R}$. So they must have the same cardinality, but by above, $\mathbb{R}$ is uncountable. Then $P(\mathbb{Z})$ is uncountable and of the same cardinality as $\mathbb{R}$.

As for your other question, it is not known if there is a set with cardinality between that of $\mathbb{N}$ and $\mathbb{R}$. It is certainly not a trivial question and is known as the Continuum Hypothesis.