# Is there a smooth strictly-increasing bijection $\mathbb{R} \to (0, 1)$ that maps $\mathbb{Q}$ onto $\mathbb{Q}\cap(0, 1)$?

I noticed that none of the "nice" sigmoid functions I know of sends rationals to rationals.

I set out to find a sigmoid function that maps rationals into rationals. I did find one, but it is not smooth. I wonder if such a function exists, and if not, what is the connection between this non-existence and the requirement that it and its inverse map rationals to rationals.

The function $$x \mapsto \begin{cases} \frac{1}{2 (1 - x)} &, \text {if} \ \ x < 0 \\ \frac{2 x + 1}{2 (1 + x)} &, \text {if} \ \ x \geq 0 \end{cases}$$ is a strictly increasing bijection from $$\mathbb{R}$$ onto $$(0, 1)$$, and it maps $$\mathbb{Q}$$ into $$\mathbb{Q}\cap(0, 1)$$.

Furthermore, its inverse

$$y \mapsto \begin{cases} \frac{2 y - 1}{2 y} &, \text {if} \ \ 0 < y < \frac{1}{2} \\ \frac{2 y - 1}{2 (1 - y)} &, \text {if} \ \ \frac{1}{2} \leq y < 1 \end{cases}$$

maps $$\mathbb{Q}\cap(0, 1)$$ into $$\mathbb{Q}$$.

Therefore, the restriction of this function to $$\mathbb{Q}$$ is a monotone bijection from $$\mathbb{Q}$$ onto $$\mathbb{Q}\cap(0, 1)$$.

The original function (over $$\mathbb{R}$$) is not smooth, however: its second derivative does not exist at $$x = 0$$.

Does there exist a smooth monotone bijection from $$\mathbb{R}$$ onto $$(0, 1)$$ whose restriction to $$\mathbb{Q}$$ maps $$\mathbb{Q}$$ onto $$\mathbb{Q}\cap(0, 1)$$? Is it possible to write down a formula for it?

EDIT: Below is the function one gets if one subtracts $$\frac{1}{2}$$ from the expressions in the original definition.

$$x \mapsto \begin{cases} \frac{x}{2 (1 - x)} &, \text {if} \ \ x < 0 \\ \frac{x}{2 (1 + x)} &, \text {if} \ \ x \geq 0 \end{cases}$$

(Informally, this "translates" the graph of the function down by $$\frac{1}{2}$$, so that the function's value at $$0$$ is $$0$$.)

This "translate" of the original function more clearly shows its symmetry.

EDIT2: I realized after the fact that the word "monotone" in the phrase "smooth monotone bijection" is probably redundant. I cannot envision a smooth bijection on $$\mathbb{R}$$ that fails to be monotone. (The sign of the first derivative must remain bounded away from zero if the function is going to be injective.)

• The remark in this answer is I think relevant (although I can't say I've completely understood it)! The dense subset you want in the target is something like the pre-image of $\Bbb Q \cap (0, 1)$ under a smooth monotone sigmoid function. This question also has a lot of related material. Commented May 24, 2022 at 23:21
• It seems to me that this is relevant: ams.org/journals/tran/1925-027-01/S0002-9947-1925-1501300-2/… Commented May 24, 2022 at 23:39
• This is a very special case of a general result in differential topology: Given two dense countable subsets in a smooth manifold, there is a diffeomorphism of the manifold that carries one of the subsets bijectively to the other. Commented May 24, 2022 at 23:53
• The expression for the $x$-coordinate in the rational parameterization of the unit circle, i.e. the map $t \mapsto \frac{1-t^{2}}{1+t^{2}}$, gives a rational bijection from $(-\infty, 0]$ to $(-1,1]$. Using this to construct the function $f\left(t\right)=\operatorname{sgn}\left(t\right)\cdot\left(1-\frac{1-t^{2}}{1+t^{2}}\right)$ gives a $\mathcal{C}^1$ bijection that maps $(-\infty, \infty)\cap\mathbb{Q}$ to $(-2,2)\cap\mathbb{Q}$. Note that $f'(0)=0$ but $f''(0)$ does not exist. Just mention this to show the derivative must not be strictly positive, it can sometimes be $0$. Commented May 29, 2022 at 14:43

First of all, by taking any diffeomorphism between $${\mathbb R}$$ and $$(0,1)$$ and using it to send $${\mathbb Q}$$ to a subset $$B\subset {\mathbb R}$$, the problem reduces to the following:

Given two countable dense subsets $$A, B\subset {\mathbb R}$$, find a diffeomorphism $$f: {\mathbb R}\to {\mathbb R}$$ such that $$f(A)=B$$.

Remark. A diffeomorphism between smooth manifolds is smooth map with smooth inverse. In the setting of maps between open intervals in $${\mathbb R}$$, diffeomorphisms are bijective functions which are infinitely differentiable and have infinitely differentiable inverses.

This turns out to be always possible. One can even find a real-analytic diffeomorphism with this property. Even more, there exists an entire holomorphic function $$h: {\mathbb C}\to {\mathbb C}$$ which restricts to a diffeomorphism $$f: {\mathbb R}\to {\mathbb R}$$ such that $$f(A)=B$$.

This result has a long and interesting history. It is usually attributed to

Franklin, P., Analytic transformations of everywhere dense point sets., Transactions A. M. S. 27, 91-100 (1925). ZBL51.0166.01.

Barth, K. F.; Schneider, W. J., Entire functions mapping countable dense subsets of the reals onto each other monotonically, J. Lond. Math. Soc., II. Ser. 2, 620-626 (1970). ZBL0201.09203.

The same result holds in higher dimensions, see

Morayne, Michał, Measure preserving analytic diffeomorphisms of countable dense sets in $${\mathbb C}^n$$ and $${\mathbb{R}}^n$$, Colloq. Math. 52, 93-98 (1987). ZBL0627.28012.

and even for Banach manifolds:

Dobrowolski, T., On smooth countable dense homogeneity, Bull. Acad. Pol. Sci., Sér. Sci. Math. Astron. Phys. 24, 627-634 (1976). ZBL0332.58005.

When I have more time I will add a sketch of a proof for existence of $$C^\infty$$ diffeomorphisms from a smooth manifold $$M$$ to itself mapping given dense countable subset $$A\subset M$$ to another given dense countable subset $$B\subset M$$.

• Thank you! I skimmed the paper by Barth and Schneider. From what I read, they clearly answer the matter of existence in the affirmative. Nonetheless, I was not able to determine whether the proof provided any way of constructing such a function. This is in part because their proof depends on proofs that appeared elsewhere. At any rate, judging by the level of generality of the theorems in this paper, it would be really surprising to me if from them one could extract a way to construct the desired function.
– kjo
Commented May 25, 2022 at 20:02