Maths WorkshopMaths problems with full solutions
Exercise 719Calculus › Single-variable calculus › LimitsL1Added 1 Nov 2026

x times the Dirichlet function

#squeeze theorem#pathological functions#continuity

Statement

Let g(x)=x D(x)g(x)=x\,D(x), where DD is the Dirichlet function (D(x)=1D(x) = 1 if x∈Qx \in \mathbb{Q} and D(x)=0D(x)= 0 otherwise). Show that lim⁡x→0g(x)=0\lim_{x\to0}g(x)=0, and that gg has no limit at any point a≠0a\ne0.

Hint

At 00, use the bound 0≤D(x)≤10\le D(x)\le1.

Show solutionHide solution

Solution

At 00. For every xx, 0≤∣g(x)∣=∣x∣ D(x)≤∣x∣0\le|g(x)|=|x|\,D(x)\le|x|. By the squeeze theorem, g(x)→0g(x)\to0 as x→0x\to0. Since g(0)=0g(0)=0, the function gg is continuous at 00.

At a≠0a\ne0. For every n≥1n\ge1, the interval (a,a+1n)\left(a,a+\frac1n\right) contains a rational number rnr_n and an irrational number sns_n. We thus have rn→ar_n\to a, sn→as_n\to a and
g(rn)=rn⟶a,g(sn)=0⟶0.g(r_n)=r_n\longrightarrow a,\qquad g(s_n)=0\longrightarrow0.
Since a≠0a\ne0, these two limits are different, so gg has no limit at aa.

Remark. The function gg is continuous at exactly one point, 00. Continuity at a single point is possible, and it comes from the factor xx squeezing DD.