# Simple bijection between reals and sets of natural numbers

Using the Cantor–Bernstein–Schröder theorem, it is easy to prove that there exists a bijection between the set of reals and the power set of the natural numbers. However, it turns out to be difficult to explicitly state such a bijection, especially if the aim is to find a bijection that is as simple to state as possible.

The simplest explicit bijection that I could come up with can be defined as follows:

I actually define a bijection from the reals to binary sequences (i.e. sequences of 0s and 1s). Since there is a trivial canonical bijection between binary sequences and the power set of natural numbers, this can easily be modified to a bijection from reals to the power set of natural numbers.

We say that a binary sequence has an infinite tail iff from some term onwards all terms in the sequence are 0s or all are 1s.

For every real x between 0 and 1 there are either one or two binary sequences that qualify as binary representations of x. If there are two binary representations of x, then both of them have an infinite tail, one in 0s and the other in 1s.

Let [x] denote the integer part of a real x.

Now the bijection f is defined on a real x by distinguishing four cases:

1. x-[x] has two binary representations and [x] is non-negative: Then f(x) is set to be the sequence starting with [x] many 1s followed by one 0 and the binary representation of x-[x] that has an infinite tail in 0s.

2. x-[x] has two binary representations and [x] is negative: Then f(x) is set to be the sequence starting with -[x]-1 many 1s followed by one 0 and the binary represenation of x-[x] that has an infinite tail in 1s.

3. x-[x] has one binary representation and [x] is non-negative: Then f(x) is set to be the sequence starting with 1 followed by [x] many 1s, one 0 and the binary representation of x-[x].

4. x-[x] has one binary representation and [x] is negative: Then f(x) is set to be the sequence starting with 0 followed by -[x]-1 many 1s, one 0 and the binary representation of x-[x].

So the idea is that for the reals with two binary representation, you use the choice between the two as an indication of sign, whereas for the reals with just one binary represenation, the sign has to be mentioned in a separate bit.

Is there a bijection from the reals to the power set of the natural numbers that is easier to define explicitly then the one just presented?

-
Use tan/inverse tan to go between (0,1) and R. That would simplify things a fair bit. –  Spencer Feb 25 '11 at 14:41
Use continued fractions. You only have to be mildly careful about the mild non-uniqueness of finite ones. –  Qiaochu Yuan Feb 25 '11 at 14:44
@Spencer: As far as I can see, it is not so easy to explicitly state a bijection between P(N) and (0,1). The simple bijections are either between P(N) and [0,1) or between P(N) and (0,1], but tan cannot biject such half-open intervals to R. –  Marcos Cramer Feb 25 '11 at 22:22

I think this question is more interesting than it appears at first glance.

The answer depends partly on how you define a real number. For example, a standard way to define real numbers is by means of Dedekind cuts. Then, assuming that the standard zigzag bijection between the rationals and the integers is taken for granted, the problem reduces to finding an explicit bijection between certain sets of integers (those corresponding to Dedekind cuts) and all sets of integers. I haven't ever seen anyone attempt to do this directly.

As you've posed the problem, you seem to take binary representations of reals for granted. Then the basic difficulty is the annoying dichotomy between finite sets and infinite sets. (Using continued fractions, as others have suggested, does not help much here, because you're still stuck with the annoying finite/infinite issue.) Reals between 0 and 1 are easily put in bijection with infinite sets of integers, by disallowing binary representations that end with repeating 0's. Letting $\cal I$ denote the family of all infinite sets of integers, we now want to find a bijection $\phi$ between $\cal I$ and $2^{\mathbb N}$. One simple way to do this is to let $\phi(x) = x$ unless $x$ is cofinite, since there are only countably many cofinite sets of integers, and then pick your favorite bijection between one copy of $\mathbb N$ and two copies of $\mathbb N$ to biject cofinite sets with finite/cofinite sets.

If you want all reals, rather than just reals between 0 and 1, then you'll need to modify the above construction, but I think the main finite/infinite sticking point will remain the same whatever you try to do. In particular, if I understand your construction correctly, your use of a $\pm$ sign can be thought of as implementing the necessary bijection between one copy of $\mathbb N$ and two copies of $\mathbb N$.

By the way, a related question is to find an explicit bijection between $(0,1)$ and $(0,1) \times (0,1)$. Interleaving binary representations is the standard approach, but one must be careful about reals with two different binary representations. To fix this problem, disallow representations that end with repeating 0's, and break up a binary representation into blocks, where a block consists of a single 1, preceded by a (possibly empty) string of consecutive 0's. Then interleave blocks of digits instead of single digits. I think this construction may go back to Dedekind.

-
Here is a nice paper, "Was Cantor surprized?", showing the earlier works of Cantor on some related ideas: maa.org/sites/default/files/pdf/pubs/AMM-March11_Cantor.pdf –  Amir Asghari Dec 23 '13 at 16:17