Posted by: holdenlee | April 26, 2010

## Can a function be continuous only on rationals?

There exists a function that is continuous on the irrationals and discontinuous on the rationals, for example, the function $f(x)=\begin{cases} d(x) & x\in \mathbb{Q}\\ 0 & x\not\in\mathbb{Q}\end{cases}$ where $d(x)$ is the denominator of $x$ when written in lowest terms.

Does there exist a function that is continuous on the rationals and discontinuous on the irrationals? This would seem harder- as the rationals are a much smaller set than the irrationals.

In fact, we show that no function can be continuous only on a countable dense set of $\mathbb{R}$, such as $\mathbb{Q}$. The main idea is that if the set $S$ of continuity points were countable, then we could choose a nested sequence of intervals around points of $S$ where the variation in $f$ goes to 0, that eventually avoids all points of $S$. But the common point of the intervals would be a continuity point, contradiction.

Suppose by way of contradiction that $f$ is a function with a countable set of continuity points $x_1,x_2,\ldots$. Let $\epsilon_i$ be any positive sequence converging to 0. By continuity at $x_1$, we can choose a nondegenerate closed interval $I_1$ around $x_1$ such that $|f(x)-f(x_1)|<\epsilon_1$ for all $x\in I_1$. (By definition we can choose an open interval, but every open interval contains a closed one.) Now define nested intervals $I_n$ inductively as follows: once $I_n$ has been defined, if $x_{n+1}\not\in I_n$ let $I_{n+1}=I_n$, and if $x_{n+1}\in I_n$ let $I_{n+1}$ be an interval around $x_{n+1}$ that is contained in $I_n$, does not contain $x_n$, and such that $|f(x)-f(x_{n+1})|<\epsilon_{n+1}$ whenever $x\in I_{n+1}$. Note that each $I_{n+1}$ avoids $x_n$; therefore $\bigcap_n I_n$ contains no continuity point. However, as a series of nested intervals it contains a point $y$.

We can continue our construction forever- we cannot have $I_n=I_{n+1}=\cdots$ since the set of continuity points is dense. We show $y$ is a continuity point. Given $\epsilon>0$ we can choose $n$ so that $I_n\neq I_{n-1}$ and $\epsilon_n<\frac{\epsilon}{2}$. Now $y\in I_n$ so for any $z\in I_n$, $y,z\in I_n$ imply that

$\displaystyle |f(y)-f(z)|\leq |f(y)-f(x_n)|+|f(x_n)-f(z)|<\epsilon_n+\epsilon_n<\epsilon.$

Since there is an interval around $y$ where $f(z)$ differs from $f(y)$ by at most $\epsilon$, $y$ is a continuity point not in our list $x_1, x_2,\ldots$, contradiction.

## Responses

1. The subsets of $\mathbb{R}$ that can form the set of discontinuity points of a set $f$ are exactly $F_{\sigma}$ sets, i.e. sets that are a countable union of closed sets.
[Counterexamples in Analysis, p. 31]

2. […] Can a function be continuous only on rationals? […]

3. Thanks for the helpful explanation. I think the $\latex \bigcup_{n}I_n$ should be an intersection, but we can still understand.

• Thanks – fixed.

4. what is n’

• That’s a comma.