The Dirichlet function isnowhere continuous. We can prove this by reference to the definition of acontinuous function to show that it violates the continuity properties at both rational and irrational arguments:
Proof
Ify is rational, thenf(y) = 1. To show the function is not continuous aty, we need to find anε such that no matter how small we chooseδ, there will be pointsz withinδ ofy such thatf(z) is not withinε off(y) = 1. In fact,1⁄2 is such anε. Because theirrational numbers aredense in the reals, no matter whatδ we choose we can always find an irrationalz withinδ ofy, andf(z) = 0 is at least1⁄2 away from 1.
Ify is irrational, thenf(y) = 0. Again, we can takeε =1⁄2, and this time, because the rational numbers are dense in the reals, we can pickz to be a rational number as close toy as is required. Again,f(z) = 1 is more than1⁄2 away fromf(y) = 0.
Its restrictions to the set of rational numbers and to the set of irrational numbers areconstants and therefore continuous. The Dirichlet function is an archetypal example of theBlumberg theorem.
The Dirichlet function can be constructed as the double pointwise limit of a sequence of continuous functions, as follows:for integerj andk. This shows that the Dirichlet function is aBaire class 2 function. It cannot be a Baire class 1 function because a Baire class 1 function can only be discontinuous on ameagre set.[4]
For any real numberx and any positive rational numberT,. The Dirichlet function is therefore an example of a realperiodic function which is notconstant but whose set of periods, the set of rational numbers, is adense subset of.
The Dirichlet function has both an upperDarboux integral (namely,) and a lower Darboux integral (0) over any bounded interval — but they are not equal if, so the Dirichlet function is not Darboux-integrable (and therefore not Riemann-integrable) over any nondegenerate interval.
The Dirichlet function provides a counterexample showing that themonotone convergence theorem is not true in the context of the Riemann integral.
Proof
Using anenumeration of the rational numbers between 0 and 1, we define the functionfn (for all nonnegative integern) as the indicator function of the set of the firstn terms of this sequence of rational numbers. The increasing sequence of functionsfn (which are nonnegative, Riemann-integrable with a vanishing integral) pointwise converges to the Dirichlet function which is not Riemann-integrable.
The Dirichlet function isLebesgue-integrable on and its integral over is zero because it is zero except on the set of rational numbers which is negligible (for the Lebesgue measure).