Dirichlet's Function
Let $$ \begin{align*} f(x) = \begin{cases} 1, & \text{if } x \in \mathbb{Q}, \\ 0, & \text{if } x \in \mathbb{R} \setminus \mathbb{Q}. \end{cases} \end{align*} $$ Then \(f\) is not continuous at any point \(a \in \mathbb{Q}\).

Proof

By definition, \(f\) is continuous at \(a\) if

$$ \begin{align*} \lim_{x \to a} f(x) = f(a). \end{align*} $$

Recall that by the Sequential Characterization of Limits, \(f\) is continuous at \(a\) if and only if for every sequence \(\{x_n\}\)

$$ \begin{align*} x_n \to a \quad \text { as } \quad f(x_n) \to f(a) \end{align*} $$

Since both the rationals and irrationals are dense in \(\mathbb{R}\), we can construct two sequences:

$$ \begin{align*} \{x_n\} &\subset \mathbb{Q} \quad \text{ and } \quad \quad x_n \to a \\ \{y_n\} &\subset \mathbb{R} \setminus \mathbb{Q} \quad \text{ and } \quad y_n \to a. \end{align*} $$

Now observe that \(f(x_n) = 1\) for all \(x_n \in \mathbb{Q}\). Thus

$$ \begin{align*} \lim_{n \to \infty} f(x_n) = 1. \end{align*} $$

Similarly, \(f(y_n) = 0\) for all \(y_n \in \mathbb{Q}\) so

$$ \begin{align*} \lim_{n \to \infty} f(y_n) = 0. \end{align*} $$

Hence, the limit of \(f(x)\) as \(x \to a\) does not exist, since we obtained two different limits for sequences converging to the same point \(a\). Therefore, \(f\) is discontinuous at every point \(a \in \mathbb{R}\)


References

  • Lecture Notes by Professor Chun Kit Lai