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.

Possible Duplicate:
No continuous function that switches $\mathbb{Q}$ and the irrationals

Is there a continuous function $f\colon\mathbb R\to \mathbb R$ such that $f(\mathbb Q)\subseteq \mathbb R-\mathbb Q$ and $f(\mathbb R-\mathbb Q)\subseteq \mathbb Q$?

share|improve this question

marked as duplicate by David Mitra, Did, Erick Wong, hardmath, Thomas Jan 1 '13 at 19:52

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.

What do you think? –  Did Jan 1 '13 at 18:08
19 minutes. $ $ –  Did Jan 1 '13 at 18:28
See here and here . –  David Mitra Jan 1 '13 at 18:56
@nice question ali. +1 –  Babak S. Jan 1 '13 at 19:17

4 Answers 4

up vote 10 down vote accepted

HINT: If such an $f$ exists, $$\Bbb R\setminus\Bbb Q=\bigcup_{q\in\Bbb Q}f^{-1}[\{q\}]$$ is the union of countably many closed sets. Now apply the Baire category theorem.

share|improve this answer
I just love it when Baire knocks at the door ... –  Hagen von Eitzen Jan 1 '13 at 18:17
@Hagen: Lions and tigers and Baires [oh my]. :-) –  Brian M. Scott Jan 1 '13 at 18:18
@ Brian M. Scott Thanks very much –  aliakbar Jan 1 '13 at 18:27
Hammer, nails, and all that... –  Did Jan 1 '13 at 18:29
I wonder how many of the downvoters understand that the answer is correct, albeit less elementary than was actually necessary. –  Brian M. Scott Jan 1 '13 at 20:14

Hint: Consider a continuous function $f:\mathbb R\to\mathbb R$. Either $f$ is constant or $f(\mathbb R)$ is uncountable. (Can you show this? Sub-hint: intermediate value theorem.) If $f(\mathbb R\setminus\mathbb Q)$ is countable, what about the countability/uncountability of the set $f(\mathbb R)$, using the fact that $f(\mathbb R)=f(\mathbb Q)\cup f(\mathbb R\setminus\mathbb Q)$?

share|improve this answer
Ah, a smaller hammer; nice. –  Brian M. Scott Jan 1 '13 at 18:29
@BrianM.Scott Indeed. –  Did Jan 1 '13 at 18:31
@did Thanks very much –  aliakbar Jan 1 '13 at 18:41
@aliakbar You are welcome. Say, did you actually understand Brian's answer before accepting it? –  Did Jan 1 '13 at 21:22

Suppose by contradiction that such a function exists. Then it is non-constant.

Let $a<b$ be so that $f(a) \neq f(b)$. Then by the IVT $f([a,b])$ is a non-trivial interval. Let call this interval $[c,d]$.


$$f([ a,b] \cap \mathbb Q)= [c,d] \cap (\mathbb R \backslash \mathbb Q) \,.$$ This implies that $f$ takes a countable set onto an uncountable set, contradiction.

share|improve this answer

See, $f(\mathbb{Q})$ is a countable set, how $f(\mathbb{R-Q})\subset \mathbb{Q}$, then, $f(\mathbb{R-Q})$ is too a countable set, then $f(\mathbb{R})$ is also a countable set. See, a continuous function have a countable image if only if $f$ is a constant function, contradiction!

share|improve this answer

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