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

Given $$f(x) = \begin{cases} \frac{1}{q} & \text{if}~~ x = \frac{p}{q},(p,q)=1 ~,p\leqslant q, \text{is rational},~ 0\leqslant x \leqslant 1 \\ 0 & \text{if}~~ x ~~\text{is irrrational}, 0\leqslant x \leqslant 1 \end{cases} $$ I want to find both the Lebesgue and the Riemann integral of $f(x)$.

this is my attempt.

For the Lebesgue integral, I define $f(x) = 1\cdot 1_{\mathbf{Q}\cap [0,1]} +0\cdot 1_{[0,1]\setminus \mathbf{Q}}$. Then $$\begin{align*} \int_0^1 f(x)dx & = 1\cdot \mu(\mathbf{Q}\cap [0,1]) + 0 \\ & = 0 . \end{align*}$$ where $\mu$ is the Lebesgue measure.

I think the Riemann integral should also be $0$. Here is what I've done.
Let $P$ be a partition of $[0,1]$. Then since the irrationals are dense in $[0,1]$, every subinterval of $P$ will have a point where $f(x) = 0$. So the lower sum, $L(f,P) = 0.$ Thus $$\underline{\int_0^1} f(x) dx = \sup L(f,P) = 0.$$

Going with my guess, $\overline{\int_0^1} f(x)dx$ should also be 0$, but I don't know how to get it. so I want help with it. Also, is what I've done above alright?

share|cite|improve this question
this may help. – David Mitra Mar 14 '12 at 16:36
In your treatment of the Lebesgue integral, you state a wrong equality for $f(x)$. But you do have $f(x)=0$ a.e., so it comes out okay. It is useful to know that when the Riemann and Lebesgue integrals both exist, they must yield the same value. – Harald Hanche-Olsen Mar 14 '12 at 16:41
@HaraldHanche-Olsen: I fixed it. – Joe Mar 14 '12 at 16:51
@DavidMitra: Thanks for the link. – Joe Mar 14 '12 at 16:57

Quick hint: For any $\varepsilon>0$, there are only a finite number of point $x\in[0,1]$ with $f(x)>\varepsilon$. That should let you get at the upper Riemann sum.

More precisely, make a step function whose value is $\varepsilon$ in most of $[0,1]$, but takes on bigger values near those points where $f(x)>\varepsilon$. It can take the bigger values in intervals as short as you wish, and since there are only a finite number of points to take care of, this should get you there.

share|cite|improve this answer
could you please expand on the hint? thanks.. – Joe Mar 14 '12 at 16:58
Done. Do you get it on your own now? Drawing a picture should help. – Harald Hanche-Olsen Mar 15 '12 at 12:57

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.