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?

  • 2
    $\begingroup$ Use tan/inverse tan to go between (0,1) and R. That would simplify things a fair bit. $\endgroup$
    – Spencer
    Feb 25, 2011 at 14:41
  • 6
    $\begingroup$ Use continued fractions. You only have to be mildly careful about the mild non-uniqueness of finite ones. $\endgroup$ Feb 25, 2011 at 14:44
  • $\begingroup$ @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. $\endgroup$ Feb 25, 2011 at 22:22
  • $\begingroup$ It's easy to implement Spencer's suggestion. Enumerate the set $D$ of dyadic rationals in $(0, 1)$: 1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, etc. Enumerate the set $E$ of $\{0, 1\}$-sequences that are eventually constant: after the constant sequences 000... and 111..., the rest are finite nonempty $\{0, 1\}$-words w followed by 0's if w ends in 1, or by 1's if w ends in 0. Using such enumerations, set up a bijection $E \to D$. Binary representation $(a_1, a_2, \ldots) \mapsto \sum_n a_n/2^n$ gives a bijection $2^N - E \to (0, 1) - D$ on their complements. Thus we get a bijection $2^N \to (0, 1)$. $\endgroup$
    – Todd Trimble
    Oct 12, 2015 at 21:39
  • 1
    $\begingroup$ Are the solutions here really any simpler than just implementing CSB with the easy injections each way? The proof of CSB is explicit. $\endgroup$ Apr 10 at 17:51

4 Answers 4


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.

  • 1
    $\begingroup$ Here is a nice paper, "Was Cantor surprised?", showing the earlier works of Cantor on some related ideas: maa.org/sites/default/files/pdf/pubs/AMM-March11_Cantor.pdf $\endgroup$ Dec 23, 2013 at 16:17
  • $\begingroup$ Do the interleaved blocks really go back to Dedekind? (I first saw this construction in the "Foundations" text by RL Wilder...) $\endgroup$ Oct 13, 2015 at 4:33
  • $\begingroup$ @BenjaminDickman : Yours could be a fresh MO question, perhaps... $\endgroup$ Oct 13, 2015 at 17:39
  • A set of natural numbers can denote a sequence of natural numbers like {1,2,3} denotes 1,1,1 and {2,4,6,26} denotes 2,2,2,20.
  • A sequence of natural numbers denotes a real number in a unique way using continued fraction.

For example N = {1,2,3,4,5,...} denotes the sequence 1,1,1,1,1,... which is the golden ratio.

  • $\begingroup$ This is indeed quick to write down and seems to be the kind of answer sought. You have written it down very neatly, too, but (and this isn't an attack on your answer) for me it is still more obvious that you can write reals in binary than the fact that "A sequence of natural numbers denotes a real number in a unique way using continued fraction." I don't see how one is "easier to define explicitly" than the other really. $\endgroup$
    – Spencer
    Feb 25, 2011 at 15:19
  • 8
    $\begingroup$ Rational numbers always have two continued fraction expansions (e.g. 1+1/(1+1/1) = 1+1/2) so the second bullet point is wrong. $\endgroup$ Feb 25, 2011 at 15:27
  • 2
    $\begingroup$ François' objection can be fixed by adding a 1 to every finite sequence of naturals, or by adding 1 to the last term of any finite sequence of natural numbers. In the first case one gets a bijection between P(N) and non-negative reals, in the second case a bijection between P(N) and positive reals. Now one could reserve one element of N as a bit specifying the sign of the real, and by using the two different fixes to François' objection ensure that 0 is hit preceisely once. But maybe the resulting bijection doesn't qualify as that simple any more... $\endgroup$ Feb 25, 2011 at 15:47
  • $\begingroup$ ...or just compose with log in the second case. $\endgroup$ Feb 25, 2011 at 21:15

Here's a bijection using binary sequences in four cases:

  1. For each finite $A\subset\mathbb N$, a positive integer is chosen. E.g. by adding 1 to the integer which has in its binary representation the bits at position numbers contained in the subset set to 1. (LSB has position number 1)

  2. $\mathbb N\mapsto0$.

  3. $\mathbb N\setminus\{n\}\mapsto-n$.

  4. The remaining subsets $B\subset\mathbb N$ are represented as a string of infinite symbols. An $i$th symbol has value $1$ when $i\in B$, otherwise it is $0$. Due to case 3 each string gets at least two $0$s. Before the first $0$ the string has $k$ $1$'s. The substring behind the first $0$ is used as a binary fraction for a real $x$. For subsets with even $k$ the real $\frac{k}{2}+x$ and for subsets with odd $k$ the real $-\frac{k+1}{2}+x$ is chosen. ($x < 1$ as the fraction has at least one $0$ and $x > 0$; there is only one representation for finit fractions with tailing $1$s as due to case 1 the fraction has no infinite tail in $0$'s)

Case 4 is borrowed from Marcos Cramer and for the separation into finite and infinite subsets I followed Timothy Chow.

  • $\begingroup$ Please use LaTeX markup for formulas. $\endgroup$
    – Stefan Kohl
    Oct 14, 2015 at 20:48

A simple modification to IEEE 754 binary floating point storage format allows another bijection from $\mathcal P(\mathbb N_0) \rightarrow \mathbb R$.


  • a special code for zero
  • a sign bit
  • a binary coded base 2 exponent and
  • a binary coded mantissa used with the hidden bit convention

of IEEE 754 specification modified by

  • a unique zero representation,
  • a dynamic exponent length with an exponent sign rather than a bias and
  • an infinite long fraction combined with differential decoding of a bit sequence from finite or cofinite subsets to handle the two representations of binary fractions,

leads to the following bijection.

For any subset $P \subseteq \mathbb N_0$ a bit sequence $\lbrace p_{-1},p_0, p_1, \dotsc \rbrace$ with bit values $p_i \mapsto \begin{cases} 1 : & i \in P\\ 0 : & \text{otherwise} \end{cases}$ is used. As the two sorts of constant tails in $0$s or in $1$s complicate the bijection to binary numbers as a first step the $p_i$ sequences are mapped to sequences $\lbrace b_0, b_1, \dotsc \rbrace$ to get rid of all infinite tails in $1$s. Here it is done with a differential decoding for finite and cofinite sets only: $$ b_i= \begin{cases} p_{i-1} \oplus p_i : & \text{for finite or cofinite } P\\ p_i : & \text{otherwise} \end{cases} $$ For $P \ne \emptyset$ there is a first bit $b_k$ with value $1$.

The bijection from $\mathcal P(\mathbb N_0) \rightarrow \mathbb R$ has two cases: \begin{equation} P \mapsto \begin{cases} 0 :& P = \emptyset\\ r = (-1)^{\sigma} {2^{(-1)^\xi E}} (1 + M) :& P \ne \emptyset \end{cases} \end{equation} with \begin{align} \sigma &= b_{2k+1}\\ \xi &= b_{2k}\\ E &= \sum_{i = 0}^{2k-1} b_{2k-1-i}2^i\\ M &= \sum_{i=1}^\infty \ b_{2k+1+i} 2^{-i}\\ \end{align}


Notes to the exponent

For $k = 0$ the sum for $E$ is empty. I.e. $E = 0$ and $\xi = b_0 = 1$ has only one option. For $k > 0$ the exponent $E$ is in the range $2^{k-1} ,\dotsc, 2^k - 1$. The ranges for different $k$ don't overlap and cover all positive integers.

Notes to the inverse function

Starting with a real $r \ne 0$ the values $\sigma$, $\xi$, $E$ and $M$ are exactly determined as $M$ has to be chosen form $[0, 1)$. The size of $E$ defines $k$. $M$ is expressed as a binary fraction with a tail in $0$s if it is a finite binary fraction. By means of the found $k$ the bit values used for $E$, $\xi$, $\sigma$ and $M$ can be mapped to the $b_i$ sequence bits. If $M$ is finite then the differential decoding can be reversed with differential encoding starting with $p_{-1} = 0$ recursively $p_i = p_{i-1} \oplus b_i$. And if $M$ is an infinite fraction then $p_i = b_i$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.