Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Can someone help me?

How can I prove that there isn't an everywhere continuous function $f:\mathbb R \rightarrow \mathbb R$ that transforms every rational into an irrational and vice-versa?

share|cite|improve this question

marked as duplicate by Pedro Tamaroff, Asaf Karagila, Amzoti, Micah, user17762 Apr 21 '13 at 2:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 10 down vote accepted

Let $\mathbb{I} = \mathbb{R}\backslash\mathbb{Q}$ and suppose $f(\mathbb{I})\subseteq\mathbb{Q}$. $f(\mathbb{R}) = f(\mathbb{Q})\cup f(\mathbb{I})\subseteq f(\mathbb{Q})\cup\mathbb{Q}$, which is countable. Since $f$ is continuous, $f(\mathbb{R})$ is connected. Thus, $f(\mathbb{R})$ is countable and connected, hence it is a singleton $\{x\}$ and $f$ is constant.

Clearly, no constant function fulfils the conditions you require, hence there is no continuous $f$ such that $f(\mathbb{I})\subseteq\mathbb{Q}$ and $f(\mathbb{Q})\subseteq\mathbb{I}$.

share|cite|improve this answer

Since there are only countably many rational numbers, such a function would map the rationals into a countable set $S$ of irrationals. So it would map all real numbers into $S\cup\mathbb Q$ (mapping the rationals into $S$ and the irrationals into $Q$). On the other hand, being continuous, your function would have to map the reals (a connected set) onto a connected set. But the only countable connected sets of reals are the singletons. So your function would have to be constant, which contradicts the requirement that it map rationals to irrationals and vice versa.

share|cite|improve this answer

Since $\mathbb{R}=\cup_{q\in\mathbb{Q}}f^{-1}(\mathbb{q})\bigcup\cup_{q\in\mathbb{Q}}\{q\}$ and $\mathbb{Q}$ is countable then Baire categoty theorem says that for some $q\in\mathbb{Q}$ we have that $f^{-1}(q)$ has non-empty interior. Then there exists some non-empty interval $I$ such that $f$ is constant. Absurd

share|cite|improve this answer

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