I just posted a short essay that defines a function with some curious properties. The function is defined by

\[f(x) = \begin{cases}\frac{1}{b} & x = \frac{a}{b}\in\mathbf{Q}\text{ in lowest terms}\ \0 & \text{if } x \in \mathbf{R}\setminus\mathbf{Q}.\end{cases}\]

In the essay I prove that

- \(f(x)\) is continuous on \(\mathbf{R}\setminus\mathbf{Q}\)
- \(f(x)\) is discontinuous on \(\mathbf{Q}\)
- \(f(x)\) is integrable, and in particular \(\int_0^1 f(x), dx = 0\)

At first blush, these properties may seem counterintuitive.

The theory of Lebesgue measure completely characterizes Riemann integrable functions: they are functions which are almost everywhere continuous. The above function is almost everywhere continuous because its set of discontinuities (\(\mathbf{Q}\)) is countably infinite, and therefore has Lebesgue measure \(0\).