Is there a continuous function $f\colon \mathbb{R} \rightarrow \mathbb{R}$ such that $f(\mathbb{Q}) \subseteq \mathbb{R} \setminus \mathbb{Q}$ and $ f(\mathbb{R} \setminus \mathbb{Q}) \subseteq \mathbb{Q}$ ?

My answer : I think yes, take constant function Actually this logics came from my mind that if A is connected then $f\colon A \rightarrow \{\pm 1\}$ is constant function

  • 1
    $\begingroup$ What constant function has the property you want? $\endgroup$
    – lulu
    Aug 3 '19 at 18:34
  • 1
    $\begingroup$ I think that simple counting should do the job. If $f$ is not constant, take $a,b$ with $f(b)>f(a)$. Then there are uncountably many irrationals between $f(a)$ and $f(b)$ but only countably many rationals which might be mapped to them. $\endgroup$
    – lulu
    Aug 3 '19 at 18:35
  • $\begingroup$ @lulu $f$ will not nonconstant because continious image of connected set is connected $\endgroup$
    – jasmine
    Aug 3 '19 at 18:37

If you take a constant function, i.e., pick some $a\in\mathbb{R}$ and set $f(x) = a$ for all $x$, then

  • $f(\mathbb{Q}) = \{a\}$
  • $f(\mathbb{R}\setminus \mathbb{Q}) = \{a\}$

and so, by the condition on $f$, you need both $\{a\}\subseteq \mathbb{R}\setminus \mathbb{Q}$ and $\{a\}\subseteq \mathbb{Q}$. That is, you need $a\in\mathbb{Q}\cap (\mathbb{R}\setminus \mathbb{Q})$: this is impossible.

So no constant function can work.

And actually, there is no continuous function $f$ that works. The argument is similar to this answer to a related question: suppose $f$ works. Then

  • $f(\mathbb{R}\setminus \mathbb{Q})$ is countable, since $f(\mathbb{R}\setminus \mathbb{Q})\subseteq \mathbb{Q}$ and $\mathbb{Q}$ is countable.

  • $f(\mathbb{Q})$ is countable, since it is the image of $\mathbb{Q}$, which is countable.

So $f(\mathbb{R}) = f(\mathbb{R}\setminus \mathbb{Q}) \cup f(\mathbb{Q})$ is countable. But $f$ is continuous and $\mathbb{R}$ is an interval, so $f(\mathbb{R})$ must be an interval too... and the only non-empty countable intervals are the singletons. So $f(\mathbb{R})$ must be a singleton, i.e., $f$ must be a constant. But we just saw that this is not possible.

  • $\begingroup$ So, erm. Why the downvote? $\endgroup$
    – Clement C.
    Aug 3 '19 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.