Prove that there doesn't exist any function $f:\mathbb R\to \mathbb R$ that is continuous only at the rational points. Prove that there doesn't exist any function $f:\mathbb R \to \mathbb R$ that is continuous only at the rational points. Suggestion: For every $n \in \mathbb N$, consider the set $$U_n=\{x \in \mathbb R : \exists U \subset \mathbb R \,\text{open, with}\, x \in U, {\rm diam}(f(U))<1/n\}.$$
I am supposed to prove this statement using the Baire Category theorem. I am not sure but I think that the suggestion points towards trying to express $\mathbb R$ as the union of the sets $U_n$. If I could prove that any $U_n$ is a nowhere dense set and I affirm $\mathbb R=\bigcup_{n \in \mathbb N} U_n$, since the Baire Category theorem says that the interior of a countable union of nowhere dense sets is empty, I would get to an absurd. I have two problems: what does this have to do with the fact that there can't be any function $f$ continuous only at rational points? How can I assure that every $x \in \mathbb R$ is in some $U_n$? Moreover, is there any non-empty $U_n$? 
 A: You've got it backwards.  It's not $U_n$ that will be nowhere dense, but its complement.


*

*Show that $\bigcap_n U_n$ is precisely the set of points at which $f$ is continuous.

*Show that $U_n$ is open.  

*Suppose $f$ is continuous at the rationals.  Show $U_n$ is also dense.  Hence, $U_n^c$ is closed and nowhere dense.

*Using the previous statement and the fact that the rationals are countable, write $\mathbb{R}$ as a countable union of nowhere dense sets, contradicting the Baire category theorem.
Taking complements can be used to restate the Baire category theorem in the following equivalent way: a countable intersection of dense open subsets of $\mathbb{R}$ is dense.
A: Let $f:\Bbb R\to \Bbb R$ and let $D$ be the set of $x\in \Bbb R$ such that $f$ is discontinuous at $x$.
For $q\in \Bbb Q^+$ let $x\in D(q)$ iff $\sup \{|f(y)-f(z)|:y,z\in U\}>q$ whenever U is open and $x\in U.$ 
Every $D(q)$ is closed. For if $x'\in \overline {D(q)}$ and $U$ is any open set with $x'\in U$ then there exists $x\in U\cap D(q).$ Now, since $x\in D(q)$ and $U$ is open with $x\in U,$ we have $\sup \{|f(y)-f(z)|: y,z\in U\}>q.$ So $x'\in D(q).$
We have $D=\cup_{q\in \Bbb Q^+}D(q).$ So $D$ is an $F_{\sigma}$ set. So $C=\Bbb R \setminus D$ is a $G_{\delta}$ set.
Suppose $C$ is also dense. Let $C=\cap_{n\in \Bbb N}\,U_n$  where each $U_n$ is open. Each $U_n$ is dense  because $\overline U_n\supset \overline C=\Bbb R.$ Let $S$ be any countable set, with $S\subseteq \{s_n:n\in \Bbb N\}.$  Then each $U_n\setminus \{s_n\}$ is dense & open, so by Baire, $C\setminus S\supseteq \cap_{n\in \Bbb N}(U_n \setminus \{s_n\})\ne \emptyset.$ So $C$  is not equal to any countable  $S$.  In particular $C\ne \Bbb Q.$
Remarks: (1). Regardless of the Continuum Hypothesis, if $C$ is a dense $G_{\delta}$ subset of $\Bbb R$ then $|C|=2^{\aleph_0}=|\Bbb R|$. (2). If $C$ is any $G_{\delta}$ subset of $\Bbb R$ then there exists $f:\Bbb R \to [0,1]$ such that (i) $f(x)=0\iff  x\in C,$ and (ii) $f$ is continuous at $x \iff x\in C.$
