# Monotonic bijections of rational numbers

How can one characterize monotonic bijections from $\mathbb{Q}$ to $\mathbb{Q}$? It is easy to see that piecewise linear functions which are strictly monotonic and surjective will do the trick, but are these functions already all monotonic bijections of the rationals, or are there also "curved" ones? Classical curved bijections of the reals like $x^3$ are of no help, because, for example, 2 has no preimage in $\mathbb{Q}$.

The context of this question is the transformation of random variables and the degrees of freedom associated with these transformations, or more specific, what kind of results valid for continuous random variables can be transferred to rational random variables, and which results are sensitive to the special structure of the reals.

-
There are loads of non-monotonic continuous bijections from $\mathbb{Q}$ to itself that don't extend to continuous functions on $\mathbb{R}$. But the way you phrase the question suggests that you may not be interested in these? – Jeremy Rickard Jan 30 '13 at 16:30
For example, swap the intervals $(\sqrt{2},\sqrt{2}+1)$ and $(\sqrt{2}+1,\sqrt{2}+2)$, leaving everything outside these intervals fixed. – Jeremy Rickard Jan 30 '13 at 16:48
Consider the zig-zag construction showing that any two countable dense linear orders are isomorphic, and apply it with $\mathbb Q$ on both sides. You have a lot of freedom in the construction: in particular, you can do it in such a way that the image or preimage being chosen is slightly off from the position it would have if the bijection were linear between the nearest points where the function has already been fixed (I hope this description is clear). You will end up with a monotone bijection which is not linear on any nonempty interval. – Emil Jeřábek Jan 30 '13 at 17:03
In fact, if $F$ is a countable set of functions, you can arrange that the the value of the bijection in the $n$-th chosen point disagrees with the values given by the first $n$ functions from $F$. You will get a monotone bijection which differs from any $f\in F$ in all but finitely many points. For example, $F$ can be the set of all rational functions with rational coefficients. – Emil Jeřábek Jan 30 '13 at 17:12
You can biject two given countable dense subsets of $\mathbb{R}$ by an entire diffeomorphism: mathoverflow.net/questions/42460/… – Pietro Majer Feb 2 '13 at 19:52

A simple example of a monotonic homeomorphism from $\mathbb{Q}$ to itself that is not piecewise linear is given by $f(x)=x$ if $x<0$, $f(x)=\frac{x}{1-x}$ if $x\in[0,\frac{1}{2}]$ and $f(x)=x+\frac{1}{2}$ if $x>\frac{1}{2}$.
You can even have $f$ be an entire function. See e.g. https://groups.google.com/d/msg/sci.math/UjRgb0y_iBE/iTFqP5GjRgwJ