# The Riemann Integrability of a function similar to Dirichlet's function

$\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!

-
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

-