Proof

We first claim that \(f\) is not continuous at any rational point. Pick a point \(x_0 = \frac{p}{q} \in \mathbb{Q}\). Since irrationals are dense in \(\mathbb{R}\), then we can find a sequence \(\{x_n\}\) such that
We know by definition that \(f(x_n) = 0\). Therefore,
Now define the sequence \(\{y_n\}\) by \(y_n = x_0 = \frac{p}{q}\) for all \(n\). Then
Thus,
Since we have two sequences converging to \(x_0\) but \(\lim\limits_{n \to \infty} f(y_n) \neq \lim\limits_{n \to \infty} f(x_n)\). Then \(\lim\limits_{x \to x_0} f(x)\) doesn’t exist. Thus, \(f\) is not continuous at \(x_0\). Since \(x_0\) is chosen arbitrarily, then \(f\) is not continuous at any rational point. \(\ \blacksquare\)
Next, we claim that \(f\) is continuous at any irrational point.
Strategy
Pick \(x_0 \in \mathbb{R} \setminus \mathbb{Q}\) such that \(x_0 \in [0,1]\) and recall that \(f(x_0) = 0\) by definition. Then
We want to show that for \(\epsilon > 0\), there exists a \(\delta > 0\) such that whenever \(|x - x_0| < \delta\), then
The idea of the proof is control what rationals are in the neighborhood of \(|x-\delta|\). It relies on constructing this set
For example, \(Q_8 = \{\frac{1}{2}, \frac{1}{3}, \frac{2}{3}, \frac{1}{4},\ldots, \frac{7}{8}\}\) so all the fractions with denominator less that \(q_0 = 8\). This way, if we pick any fraction in \(Q_{q_0}\), then we know that
On the other hand, if \(x\) is not in the set then
Hence, by choosing \(q_0\) to be large enough such that \(\frac{1}{q_0} < \epsilon\), all the rationals with denominator \(q > q_0\) will satisfy \(\frac{1}{q} < \frac{1}{q_0} < \epsilon\).
Proof
Let \(\epsilon > 0\) be given. Pick \(q_0 \in \mathbb{N}\) such that
Consider the set
Then we know that \(|Q_{q_0}| < \infty\) is finite. Since it’s finite, then we can find a \(\delta > 0\) small enough such that
Then, for all \(x\) such that \(|x - x_0| < \delta\) we have two cases:
Case 1: If \(x \in \mathbb{R} \setminus \mathbb{Q}\), then we know that \(f(x) = 0\). Therefore, \(|f(x) - 0| < \epsilon\).
Case 2: If \(x \in \mathbb{Q}\), then by (1) \(x \in (x_0 - \delta, x_0 + \delta)\). This means that \(x = \frac{p}{q}\) where \(q > q_0\). Thus
From case 1 and 2, we see that \(f(x) < \epsilon\). Therefore, \(f\) is continuous at \(x_0\). \(\ \blacksquare\)
References
- Lecture Notes by Professor Chun Kit Lai
- Popcorn Graph