# No swapping

There is no continuous function $f:\Bbb{R}\to\Bbb{R}$ such that $f(\Bbb{Q})\subseteq \Bbb{R}\setminus\Bbb{Q}$ and $f(\Bbb{R}\setminus\Bbb{Q}) \subseteq \Bbb{Q}$.

## 2 thoughts on “No swapping”

1. gciruelos says:

Suppose such $f$ exists.
Then $f(\mathbb{R})$ is connected, because $\mathbb{R}$ is connected and $f$ is continuous. But $f(\mathbb{R}) = f(\mathbb{Q} \cup (\mathbb{R} \setminus \mathbb{Q})) = f(\mathbb{Q}) \cup f(\mathbb{R} \setminus \mathbb{Q}) \subseteq f(\mathbb{Q}) \cup \mathbb{Q}$, which is countable.
So $f(\mathbb{R})$ is at most countable. But then $f(\mathbb{R})$ has only one element (because if $C$ is a connected metric space then $\# C = 1$ or $\# C \geq c$). Then $f$ is constant.

A contradiction follows easily from this fact

Liked by 2 people

2. A second solution:

Suppose $f$ were such a function. Then $f(x) \neq qx$ for all $x\in \Bbb{R}$ and $q\in\Bbb{Q}$. Even more, by the mean value theorem we either have $f(x) > qx$ for all $x\in\Bbb{R}$ or $f(x) for all $x\in\Bbb{R}$.

Let $m=f(1)$. Then, if $q,q'\in\Bbb{Q}$ are such that $q, then $qx for all $x\in\Bbb{R}$, since the last set of inequalities holds for $x=1$. Letting $q,q'$ approach $m$ we get $f(x)=mx$ for all $x\in\Bbb{R}$. Since obviously $m$ can not be zero, $f$ is bijective; in particular, it induces a bijection between the rational and the irrational numbers.

Liked by 1 person