Two Functions with Different Continuity Sets
Two bounded functions on the same interval can behave very differently as Riemann integrands, even when both vanish almost everywhere. The rational-number indicator oscillates between zero and one in every interval. Thomae's function also takes positive values at every rational, but those values become small as the denominator grows. That difference makes Thomae's function continuous at every irrational point.
Throughout, the domain is \([0,1]\), with its relative topology and Lebesgue measure \(m\), and all functions are real-valued. Write each rational \(x\in[0,1]\) in lowest terms as \(p/q\), where \(q\geq1\); in particular, \(0=0/1\) and \(1=1/1\). Define
The function \(D\) is the rational-number indicator, also called the Dirichlet function. The function \(T\) is Thomae's function. Both are bounded between zero and one. Statements about continuity at \(0\) or \(1\) below use limits relative to \([0,1]\), so only points in the domain are considered.
Continuity and Discontinuity
Proof. The rationals and irrationals are both dense in \([0,1]\). If \(x\) is rational, there are irrational points arbitrarily close to \(x\), where \(D\) is zero although \(D(x)=1\). If \(x\) is irrational, there are rational points arbitrarily close to \(x\), where \(D\) is one although \(D(x)=0\). In either case, a sequence approaching \(x\) has function values that do not approach \(D(x)\); thus \(D\) is discontinuous at \(x\).
Now let \(x=p/q\) be rational in lowest terms. Then \(T(x)=1/q>0\). There are irrational points \(y_n\in[0,1]\) approaching \(x\): for \(x<1\), take \(y_n=x+\sqrt{2}/n\) for sufficiently large \(n\), and for \(x=1\), take \(y_n=1-\sqrt{2}/n\) for sufficiently large \(n\). These points are irrational, and \(T(y_n)=0\), so \(T(y_n)\) does not approach \(T(x)\). Therefore \(T\) is discontinuous at every rational point.
Finally let \(x\) be irrational, and let \(\varepsilon>0\). Choose an integer \(N\geq1\) such that \(1/N<\varepsilon\). The set \(F_N\) of rationals in \([0,1]\) whose reduced denominator is less than \(N\) is finite: there are only finitely many possible denominators and numerators. Since \(x\) is irrational, \(x\notin F_N\). If \(F_N\) is nonempty, the minimum distance \(d\) from \(x\) to its points is positive; choose \(\delta=d/2\). If \(F_N\) is empty, choose any \(\delta>0\). Whenever \(y\in[0,1]\) and \(|y-x|<\delta\), either \(y\) is irrational and \(T(y)=0\), or \(y\) is rational with reduced denominator at least \(N\), and hence \(T(y)\leq1/N<\varepsilon\). Since \(T(x)=0\), this gives \(|T(y)-T(x)|<\varepsilon\). Thus \(T\) is continuous at \(x\). \(\square\)
In this proof, the denominator matters: among rationals with bounded denominator there are only finitely many on the interval, so an irrational point can be separated from all of them at once. Rationals with larger denominators have correspondingly smaller function values.
Using Lebesgue's Criterion
The rationals in \([0,1]\) have Lebesgue measure zero. To see this directly, enumerate them as \(r_1,r_2,\ldots\). For any \(\varepsilon>0\), cover \(r_k\) by an open interval of length \(\varepsilon/2^k\). The total length of the cover is \(\sum_{k=1}^{\infty}\varepsilon/2^k=\varepsilon\). Since this can be done for every positive \(\varepsilon\), the outer measure, and hence the Lebesgue measure, of \(\mathbb{Q}\cap[0,1]\) is zero.
Consequently, the discontinuity set of \(T\) is null, and \(T\) is Riemann integrable by Lebesgue's criterion. The discontinuity set of \(D\) is all of \([0,1]\), which has measure one, so \(D\) is not Riemann integrable. These conclusions depend on the sizes of the discontinuity sets, not merely on the fact that both functions vanish almost everywhere.
Worked Example: Darboux Sums for the Rational-Number Indicator
Take any partition \(P=\{0=x_0<x_1<\cdots<x_n=1\}\) of \([0,1]\). On every open subinterval \((x_{i-1},x_i)\), both rationals and irrationals are dense. Thus \(D\) takes the value one and the value zero in each partition interval. Its supremum on each closed interval \([x_{i-1},x_i]\) is one, and its infimum is zero. If \(\Delta x_i=x_i-x_{i-1}\), the upper and lower Darboux sums are therefore
For example, the partition \(0,\frac12,1\) has two intervals of length \(1/2\), so its upper sum is \(1\cdot\frac12+1\cdot\frac12=1\), and its lower sum is \(0\cdot\frac12+0\cdot\frac12=0\). The calculation holds for every partition, so no partition can make the upper and lower sums arbitrarily close. Check: the difference \(U(D,P)-L(D,P)=1-0=1\) for every \(P\); the Darboux criterion therefore also shows directly that \(D\) is not Riemann integrable.
Worked Example: Continuity of Thomae's Function at a Specific Irrational
Verify continuity of \(T\) at \(x=\sqrt{2}/4\) for \(\varepsilon=1/2\). This point is irrational and lies in \([0,1]\), so \(T(x)=0\). Choose \(N=3\), since \(1/3<1/2\). The rationals in \([0,1]\) with reduced denominator less than \(3\) are exactly \(0,1,\frac12\). (The denominators are \(1\) or \(2\), giving these three distinct values.) The distances from \(x\) to them are
respectively. The closest is \(1/2\): indeed, \(1<\sqrt2<3/2\) gives \((2-\sqrt2)/4<1/4\), while \(\sqrt2/4>1/4\) and \(1-\sqrt2/4>5/8\). Set \(\delta=(2-\sqrt2)/8\), half the distance to \(1/2\). If \(y\in[0,1]\) and \(|y-x|<\delta\), it cannot be any of \(0,1,\frac12\), since each is at least \(2\delta\) from \(x\). Thus, if \(y\) is rational, its reduced denominator is at least \(3\) and \(T(y)\leq1/3\); if \(y\) is irrational, \(T(y)=0\). In either case, \(|T(y)-T(x)|\leq1/3<1/2\), proving the required continuity estimate. Check: the chosen \(\delta\) is positive because \(\sqrt2<2\), and \(2\delta=(2-\sqrt2)/4\), the computed distance to \(1/2\).
Lebesgue Integrals and a Finite-Support Approximation
Both functions are Lebesgue measurable on \([0,1]\). For \(D\), the set where it equals one is the countable Borel set \(\mathbb{Q}\cap[0,1]\). For \(T\), for each \(t>0\), the set \(\{x:T(x)>t\}\) is finite: its elements must be rational with reduced denominator \(q<1/t\), and there are only finitely many such rationals in \([0,1]\). For \(t\leq0\), the set \(\{T>t\}\) is either all of \([0,1]\) or, when \(t=0\), the countable set of rationals. These superlevel sets are Borel, which gives measurability. Since both functions vanish off the null set \(\mathbb{Q}\cap[0,1]\), their Lebesgue integrals are zero:
The equality of a Riemann integral and a Lebesgue integral for a bounded Riemann-integrable function applies to \(T\), so its Riemann integral is also zero. It does not supply a Riemann integral for \(D\), because \(D\) is not Riemann integrable.
Worked Example: Approximating Thomae's Function by Finite-Support Functions
For each integer \(N\geq1\), define \(T_N\) to equal \(T(p/q)=1/q\) at reduced rationals \(p/q\in[0,1]\) with \(q\leq N\), and to equal zero elsewhere. There are finitely many such rationals, so \(T_N\) is a nonnegative measurable simple function supported on a finite set. Each point has Lebesgue measure zero, so the simple-function integral gives
As \(N\) increases, the sets of included rationals increase and the values at those points stay fixed, so \(0\leq T_N\leq T_{N+1}\). At every irrational point all these functions are zero. At a rational point \(p/q\), \(T_N(p/q)=T(p/q)\) for every \(N\geq q\). Thus \(T_N\) increases pointwise to \(T\). The Monotone Convergence Theorem applies on \(([0,1],\mathcal{L},m)\): each function is measurable and nonnegative, and the sequence increases pointwise. It follows that \(\int T\,dm=\lim_{N\to\infty}\int T_N\,dm=0\). Check: this agrees with the direct computation from the countable null support, and the result is exact, not merely a limit estimate.
A Common Mistake: Almost Everywhere Is Not Riemann Integrable
A tempting but incorrect argument is: “The rational numbers have measure zero, so \(D=0\) almost everywhere; therefore \(D\) is Riemann integrable with integral zero.” The first statement is correct, and it gives the Lebesgue integral \(\int D\,dm=0\). The conclusion about Riemann integrability does not follow: almost-everywhere equality to zero is not the criterion for Riemann integrability. Here \(D\) is discontinuous everywhere, and its upper and lower Darboux sums differ by one for every partition.
The correction is to use the right criterion for each question. The Lebesgue integral is unchanged by changing values on a null set, while Riemann integrability of a bounded function on a compact interval is characterized by whether its discontinuity set has measure zero. Thomae's function meets that criterion because its discontinuities are precisely the rationals; the rational-number indicator does not, because its discontinuities fill the interval.
Check Your Understanding
State which notion of integrability is being tested in each question, and justify your conclusions.
- What are the continuity and discontinuity sets of \(D\) on \([0,1]\), and what are its upper and lower Darboux sums for an arbitrary partition?
- Why does the finite set of rationals with reduced denominator less than \(N\) help prove continuity of \(T\) at an irrational point?
- Determine whether \(T\) is Riemann integrable on \([0,1]\), and identify the theorem that justifies your answer.
- Compute the Lebesgue integrals of \(D\) and \(T\). Why does the answer for \(D\) not imply that it has a Riemann integral?
- For the approximations \(T_N\), identify the hypotheses that permit applying the Monotone Convergence Theorem.