## The reals as continuous image of the irrationals

In the wikipedia article about descriptive set theory I read that $\mathbb{R}$ (with its usual topology) is a Polish space, and that every Polish space

1) can be obtained as a continuous image of the Baire space $\mathcal{N}$

2) can be obtained as the image of a continuous bijection defined on a closed subset of the Baire space.

Then I learn from the wikipedia article on Baire space that it is actually homeomorphic to the irrational numbers with their usual subspace topology iherited from the real line.

So my questions:

Can we describe explicitely a surjective continuous map from the irrationals to $\mathbb{R}$?

Same for a continuous bijection from a closed subset of the irrationals to $\mathbb{R}$.

-
(Perhaps I should have posted this on MathSE instead of MO?) – Qfwfq Nov 11 at 23:24

For any irrational number $x$, let $f(x)$ be the real number arising from the integer part of $x$, together with every other digit of the rest of the expansion of $x$.

This is surjective, since one may interleave the digits of any real $y$ with any nonrepeating pattern, and thereby find an irrational $x$ with $f(x)=y$. This is continuous, since if $x_n\to x$, then $f(x_n)\to f(x)$.

-
Surely I'm being dense, but what do you mean by "taking every other digit of the expansion of $x$"? – Qfwfq Nov 11 at 23:44
I mean, for example, that $3.1415926535897932384\ldots$ maps to $3.1196387334\ldots$ – Joel David Hamkins Nov 11 at 23:47
Ok, so you meant: the integer part is the same while the $n$-th digit of the fractionary expansion is replaced by the $(2n-1)$-th digit. – Qfwfq Nov 12 at 14:15
(or: the $n$-th digit is replaced by the $\sigma(n)$-th, where $\sigma$ is any monotone function) – Qfwfq Nov 12 at 14:17
Yes, that's right. But note the slight complication that the resulting expansion may be something like $0.999999\ldots$, which means it is really $1$. – Joel David Hamkins Nov 12 at 14:26
show 1 more comment

Let $C$ be a space-filling curve, i.e. a continuous function from $\mathbb R$ onto ${\mathbb R}^2$. Then the first component $C(t)_1$ is a continuous function from $\mathbb R$ onto $\mathbb R$ that hits each real number uncountably many times. Since there are only countably many rationals, the restriction to the irrationals is also surjective.

-
 Thank you for the very clear answer to my first question. What about the second question on continuous bijection from a closed set of irrationals? – Qfwfq Nov 12 at 0:05

For the second question, remember that the subset only has to be closed in the irrationals, not as a subset of $\mathbb{R}$. With that in mind, you can take the closed subset to be the irrationals in $(-1,1)$ union some countable discrete set of irrationals. On $(-1,0)$, define $f$ by $x\mapsto \frac{1}{x}+1$; on $(0,1)$, by $x\mapsto \frac{1}{x}-1$, and on the discrete set, choose some bijection with $\mathbb{Q}$.

-

Here's another simple explicit function that maps the irrationals onto the real numbers.

Consider the continuous piece-wise linear function $f:\mathbb{R}\rightarrow\mathbb{R}$, with slope $f'(x)=-1$ or $f'(x)=+1$ according whether $\lfloor x/\sqrt 2\rfloor=0\ \mathrm{ mod} 3$, or not (like this). So $f(x)=x/3+O(1)$ as $|x|\to\infty$ and it is therefore surjective; precisely, any of its fiber has three points, and the arithmetic mean of some two of these is an odd multiple of $\sqrt{2}$. This means that the equation $f(x)=c$ has always an irrational solution, whatever is $c\in\mathbb{R}$.

-

A surjection from $\mathbb{N}^\mathbb{N}$ to $\mathbb{R}$ is given by $$f \mapsto f(0) - f(1) + \sum_{k = 2}^\infty \frac{\min(f(2k),1)-\min(f(2k+1),1)}{2^{2k-4}}$$ A homeomorphism from the irrational numbers (with the Euclidean topology) to $\mathbb{N}^\mathbb{N}$ is given by the continued-fraction expansion.

The displayed map is onto, constructively. For the continued-fraction expansion map to be constructive, we need to define irrational numbers as those reals $x \in \mathbb{R}$ for which $|x - q| > 0$ for all $q \in \mathbb{Q}$ (as opposed to those reals which are not rational).

-
 The only way I can make heads or tails of this formula is that $f$ is not an irrational number as requested by the OP, but an element of the Baire space, $f\colon\mathbb N\to\mathbb N$. Am I wrong? – Emil Jeřábek Nov 12 at 16:31 @Emil Ah! It now makes sense. – Andres Caicedo Nov 12 at 17:00 Oops, I added a comment to that effect. – Andrej Bauer Nov 12 at 17:23

Count the rational numbers as $(a_1,a_2,a_3,\ldots)$. Let $f:\mathbb R\to \mathbb R$ be defined at the nonpositive integers by $f(n)=(-1)^nn$, and on the positive integer multiples of $\sqrt 2$ by $f(n\sqrt 2)=a_n$. Let $f$ be piecewise linear between the points just defined. Then the restriction of $f$ to $\mathbb R\setminus \mathbb Q$ is a continuous surjection from the irrationals to $\mathbb R$.

-