Nonlinear regular bijection from $\mathbb Q$ to itself Is there a bijection $\phi\colon \mathbb Q \to \mathbb Q$ such that


*

*$\phi$ is nonlinear (i.e., different from $x\mapsto ax+b$),

*$\phi$ is regular: the extension $\hat{\phi}$ of $\phi$ over $\mathbb R$ is $\mathcal C^2$?


What if we require $\mathcal C^\infty$?
 A: We will construct a non-linear  $\mathcal C^\infty$ bijection $f\colon\Bbb R\to \Bbb R$ that induces a bijection $\Bbb Q\to\Bbb Q$.
Consider the smooth bump function $$h(x)=\begin{cases}0&|x|\ge 1\\e^{1-1/(1-x^2)}&|x|<1\end{cases} $$
Let $H_n=\max\{\,|h^{(n)}(x)|: x\in\Bbb R\,\}$ (so in particular $H_0=1$).
Definition We say that $(f,A,B)$ is nice if 


*

*$f$ is a $\mathcal C^\infty$  bijection $\Bbb R\to \Bbb R$

*$A,B$ are finite subsets of $\Bbb Q$

*$f|_A$ is a bijection $A\to B$

*$f(x)-x$ has compact support (in particular, all derivatives are bounded)

*$\inf f'(x)>0$


Lemma 1. Given $(f,A,B,q,\epsilon,d)$ where $(f,A,B)$ is nice, $q\in\Bbb Q$, $\epsilon>0$, and $d\in \Bbb N$, we can find nice  $(\hat f,\hat A,\hat B)$  such that


*

*$A\subseteq A'$, $B\subseteq B'$, $q \in A'$

*$f-\hat f$ has compact support, disjoint from $A'$

*$|f^{(n)}(x)-\hat f^{(n)}(x)|<\epsilon$ for $0\le n\le d$


Proof. If $q\in A$, we let $\hat f=f$ etc. and are done.
So assume $q\notin A$. Pick $r>0$ such that $[q-r,q-r]\cap A$ is empty.
We will let $\hat f(x)=f(x)+ch(\frac {x-q}{r})$, $\hat A=A\cap \{q\}$, $\hat B=B\cup \{f(q)+c\}$, where $c$ is yet to be determined. 
The first bullet point of the claim is clearly met.
By choice of $r$, the second bullet point is also met.
By the properties of $h$, the third bullet point is also met provided $$\tag0|c|<\frac{r^k \epsilon}{H_k}$$ for $k\le d$. We may assume wlog that additionally 
$$\tag1|c|<\frac {r\inf f'}{H_1}.$$ 
Of course this still allows us to pick $c$ such that 
$$\tag2f(q)+c\in\Bbb Q.$$
Remains to show that $(\hat f,\hat A,\hat B)$ is nice.
$\hat f$ is clearly $\mathcal C^\infty$.
It is a bijection because $(1)$ guarantees $\hat f'(x)>0$.
Clearly, $\hat A,\hat B$ are finite subsets of $\Bbb Q$.
By choice of $r$, $\hat A$, $\hat B$, and the bijectivity of $\hat f$, clearly $\hat f|_{\hat A}$ is a bijection $\hat A\to\hat B$.
Next, $\hat f(x)-x=(\hat f(x)-f(x))+(f(x)-x)$ clearly has compact support.
Finally, $\inf \hat f'\ge \inf f'-\frac 1r|c|H_1>0$. $\square$
Lemma 2.  Given $(f,A,B,q,\epsilon,d)$ where $(f,A,B)$ is nice, $q\in\Bbb Q$, $\epsilon>0$, and $d\in \Bbb N$, we can find nice  $(\hat f,\hat A,\hat B)$  such that


*

*$A\subseteq A'$, $B\subseteq B'$, $q \in B'$

*$f-\hat f$ has compact support disjoint from $A'$

*$|f^{(n)}(x)-\hat f^{(n)}(x)|<\epsilon$ for $0\le n\le d$


Proof. 
We proceed almost as in lemma 1: Let $\alpha=f^{-1}(q)$.
Pick $r>0$ such that $[\alpha-r,\alpha+r]\cap A=\emptyset$.
This time we want to pick rational $x\approx\alpha$ and $c=q-f(x)$.
If $|x-\alpha|$ is small enough, we still have $[x-r,x+r]\cap A=\emptyset$
and also can ensure that $(0)$ and $(1)$ hold (because $c\to 0$ as $x\to \alpha)$.
The rest works as in lemma 1. $\square$
Let $f_0\colon \Bbb R\to\Bbb R$ be given by
$$f_0(x)= x+Qh(x)$$
where $Q\in \Bbb Q$  with $0<Q<\frac 1{H_1}$.
Note that $(f_0,\{-1,0,1\},\{-1,q,1\})$ is nice.
Let $v=\inf f_0'(x)>0$.
Let $q_1,q_2,q_3,\ldots$ be an enumeration of $\Bbb Q$.
We define the sequence $\{(f_n,A_n,B_n)\}_n$ of nice triples recursively as follows, starting with $(f_0,A_0,B_0)$: 


*

*If $n=2m>0$ is even, construct $(f_n,A_n,B_n)$ as in lemma 1, using $(f_{n-1},A_{n-1},B_{n-1},q_m, \frac v{2^{n+1}}, n)$ as input; 

*if on the other hand $n=2m-1$ is odd,  construct $(f_n,A_n,B_n)$ as in lemma 2, using $(f_{n-1},A_{n-1},B_{n-1},q_m,\frac v{2^{n+1}},n)$ as input.


By this construction, the sequences $\{f_n^{(k)}\}_n$ are uniformly convergent for all $k\in\Bbb N_0$. Therefore, $f(x)=\lim_{n\to\infty}f_n(x)$ is a $\mathcal C^\infty$ function $\Bbb R\to\Bbb R$.
By the choice of $\epsilon$'s in the construction, we know that $f'(x)\ge \frac v2>0$ for all $x$. Consequently, $f$ is a bijection $\Bbb R\to\Bbb R$.
If $q\in \Bbb Q$, then the sequence $\{f_n(q)\}_n$ is eventually constant with rational value, hence $f(q)\in \Bbb Q$.
Also, if $q\in \Bbb Q$, there exists $q'$ such that $\{f_n(q')\}_n$ is eventually constant with value $q$.
We conclude that $f|_{\Bbb Q}$ is a bijection $\Bbb Q\to\Bbb Q$.
Finally, from $f(-1)=-1$, $f(0)=Q\ne 0$, $f(1)=1$, we see that $f$ is not linear.
