I am trying to answer this question:

Let $f$ be a real-valued function on a metric space $X.$ Show that the set of points at which $f$ is continuous is the intersection of a countable collection of open sets. Conclude that there is no real-valued function on $\mathbb{R}$ that is continuous at the rational numbers only.

Here is my answer for the first part:

For $n\in\mathbb{N}$, consider the sets $$ U_n:=\{x\in X:\exists\delta>0,\forall y,z \in X, \, y,z\in B(x,\delta)\implies |f(y) - f(z)|<1/n\}. $$

I managed to prove that those $U_{n}$ are open and that the set of continuities of $f$ is a $G_{\delta}$ set.Now following the sequence of steps required to complete the solution of the problem regarding to the second part as suggested here

Prove that there doesn't exist any function $f:\mathbb R\to \mathbb R$ that is continuous only at the rational points.

I have to do the following: for $f:\mathbb R\to \mathbb R$

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

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

**My question is: **

I know that: by the definition of dense set in a metric space I have to show that every nonempty open subset of $\mathbb{R}$ contains a point of $U_n$ for every $n,$ but I am unable to prove this. Could anyone help me in doing so please?


1 Answer 1


Every point of continuity of $f$ belongs to $U_n$. [For this use: $|f(y)-f(z)| \leq |f(y)-f(x)|+|f(x)-f(z)|$ and use definition of continuity]. Since $f$ is assumed to be continuous at all rational points it follows that $U_n$ contains $\mathbb Q$. Hence $U_n$ is dense.

  • $\begingroup$ Does this follows from the fact that $\mathbb{Q}$ is dense in $\mathbb{R}$? $\endgroup$
    – user591668
    Mar 18, 2020 at 10:19
  • $\begingroup$ @Mathstupid Yes, that is what I used. $\endgroup$ Mar 18, 2020 at 10:21
  • $\begingroup$ And why the closure of $U_n^C$ will be hollow? $\endgroup$
    – user591668
    Mar 18, 2020 at 10:25
  • 1
    $\begingroup$ @Mathstupid Yes, if an open set is dense then its complement has no interior. $\endgroup$ Mar 18, 2020 at 10:29
  • 1
    $\begingroup$ @Mathstupid It follows by definition of a dense set. No open set can be contained in $U_n^{c}$. $\endgroup$ Mar 18, 2020 at 10:34

You must log in to answer this question.