Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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|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.

3 Answers 3

up vote 9 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|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|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|improve this answer

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