The Dirichlet function χ presents a particular problem for the theory of the Riemann integral. Consider this sequence of functions:

f (t) = lim (cos (n! πt))
 n      m->∞
(1 if t = k/n! for k an integer and 0 otherwise), all of which are clearly Riemann integrable. This sequence of functions fn(t) converges to χ(t), where χ(t) = 0 when t is irrational and χ(t) = 1 when t is rational (the characteristic function of the rational numbers over the set of real numbers). This is not Riemann integrable because for any partition P you can make the Riemann sums equal either 0 or 1, by taking the points ci to be either rational or irrational. Thus, the space of all Riemann integrable functions is incomplete, since taking a Cauchy sequence from fn will converge to χ, which is not Riemann integrable.

This function motivated the theory of the Lebesgue integral, and is indeed Lebesgue integrable, with an integral (over any interval) of zero, because χ(t) is zero almost everywhere, i.e. zero everywhere except on a set of measure zero.