The Lebesgue Integral and the Dirichlet function

I am considering the function

$$f(x)=\begin{cases} 1 &\text{if } x\in [0,1]-Q \\{}\\ 0 &\text{if } x\in [0,1] \cap Q\end{cases}$$

I am trying to evaluate this using the Lebesgue integral. Quite simply, I am letting:

$$E_0=\{\text{x such that x is rational on [0,1]}\}, \text{ and } E_1=\{\text{x such that x is irrational on [0,1]}\}.$$

$\mu (E_0)$ is the size of the rational numbers, I am saying is $0$.

$\mu (E_1)$ is the size of the irrational numbers, I am saying is $1$.

When I evaluate the integral; $\int_a^b f(x) \, d \mu = 0\cdot0 + 1\cdot1 = 1$.

My questions are: 1) Am I correct? 2) I am stuck on the understanding the measure of the sets.

• You are correct. What exactly are you stuck on? If you wonder how to show that the measure of $E_0$ is 0 - use that $E_0$ is countable, and the the measure of a countable union of disjoint sets is the sum of the individual measures. Then use that $\mu(\{x\}) = 0$ for every $x$. – fgp Apr 16 '14 at 0:11
• I might have the idea. If I take a look at all of the rational numbers on the interval [0,1], and assign a value to each of them, say $a_1$, $a_2$, ..., $a_n$. Each $a_i$ has value 0 and then taking the sum of all $a_i$ will give me the measure of the set $E_0$? The same idea for the measure of $E_1$? – Joe Apr 16 '14 at 0:22
• Well, there are more than finitely many rationals in the unit interval, so says $a_1,a_2,\ldots,a_n$ doesn't work. But there are only countably many, so says $a_1,a_2,\ldots$ does work. For $E_1$, however, it does NOT - $E_1$ contains uncountably many elements! But since you know that $\mu([0,1]) = 1$ and that $E_1 \cap E_0 = \emptyset$, it follows from $\mu(E_0) = 0$ that $\mu(E_1) = 1$. – fgp Apr 16 '14 at 0:45
• Possible duplicate of Is Dirichlet function Riemann integrable? – Alex M. Jan 15 '17 at 13:39

You are correct if the measure $\mu$ is the Lebesgue measure and Lebesgue integral is with respect to that measure.
Your answer is correct. Recall that the Lebesgue integral of a non-negative function $f$ is the supremum of the integrals of non-negative simple functions $\le f$. And the function you're integrating in this case is itself a simple function: it has only two values, hence only finitely many. And integrals of simple functions are defined as just the kind of sum you've taken here.