Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

$\textbf{Problem:}$ Consider the function $f: [0,1] \rightarrow \mathbb{R}$ defined by letting $f(x)=0$ for rational $x$ and $f(x)=x$ for irrational $x$. Calculate the upper and lower Riemann integrals of $f$. Is $f$ Riemann integrable?

$\textbf{ Solution Attempt:}$ Let $P_n=\{0=t_0,...,t_n=1\}$ be a partition of $[0,1]$, where $t_k = \frac{k}{n}$. For this partition, we have $$U(f,P_n)=\sum^{n}_{k=1} t_k (t_k - t_{k-1}) = \sum^{n}_{k=1} t_k (\frac{k}{n} - \frac{k-1}{n})=\sum^{n}_{k=1} \frac{k}{n} (\frac{1}{n})= \frac{1}{n^2} \sum^{n}_{k=1} k.$$ A familiar property of the natural numbers gives us that $\sum^{n}_{k=1} k= \frac{1}{2}n(n+1).$ Thus, $U(f,P)= \frac{1}{2} + \frac{1}{2n}.$ Recall, the upper Riemann integral $U(f)$ is defined as $U(f)=\inf \{U(f,P)\}$, where $P$ is a parition of $[0,1].$ As $n \rightarrow \infty$, $P_n \rightarrow \frac{1}{2}.$ [Note: this is where I am a little unsure of myself.] Thus, $U(f)=\frac{1}{2}$. However, the lower Riemann integral is $0$. Hence, the upper and lower Riemann integrals disagree. We conclude that $f$ is not Riemann integrable. $\blacksquare$

If the aforementioned function was changed so that it took on the value of $0$ for irrational $x$ and $x$ for rational $x$, then $f$ would be zero almost-everywhere. Hence, it would be Lebesgue integrable. Is this correct? I am quite unsure of the Lebesgue integrability for the original function. A hint would great! Thank you!

share|cite|improve this question
The function differs from the function $g(x)=x$ on a set of measure $0$. For the Riemann integral, you have not proved that the inf of all upper sums is different from $0$, though I am sure you could. One can do it without taking any limits, so the specific computation you did can be bypassed. – André Nicolas Aug 19 '13 at 4:48
Thank you! Indeed, concerning the Riemann integral, I have only shown $U(f) \leq \frac{1}{2}$. Given any partition $P$, $0<U(f,P)$. So that by definition of the sup of a set, we get $0<U(f) \leq U(f,P).$ Does this suffice? Thanks again! – dgc1240 Aug 19 '13 at 5:23
For non-integrability (Riemann-style) you need to show that all upper sums are (say) $\gt \frac{1}{4}$. That forces $U(f)$ to be $\ge \frac{1}{4}$. You just need to look say at the second half of the interval, every upper sum is $\gt the length of the interval $[1/2,1]$ times $1/2$. – André Nicolas Aug 19 '13 at 5:37

A nice theorem to know is that a bounded function is Riemann integrable if and only if the set of its discontinuities has measure zero. Your function is only continuous at 0. So since your interval is uncountable, $f$ is NOT Riemann Integrable.

share|cite|improve this answer
Technically, because the interval has nonzero measure, there are uncountable sets with measure zero. – user45878 Aug 7 '14 at 14:00
yeah like the cantor set... – Mustafa Said Aug 7 '14 at 22:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.