Evaluating Integrals using Lebesgue Integration Suppose we are to evaluate:
$$I = \int_{0}^{1} f(x) dx$$
Where
$$f(x)=\begin{cases}1 \space \text{if} \space x\space \text{is rational}, & \newline  0  \space \text{if} \space x \space \text{is irrational} \\ \end{cases}$$
I have been told that this can be done using measure theory.
Will anyone care to explain how possibly? I am new to measure theory, so I am just researching, please do not say "no attempt shown" this is because I dont know Lebesgue yet, but I heard it has great applications on this? 
 A: You can do: $$\begin{align} \int_{[0,1]} f(x)\, {\rm d}{\frak m}(x) &= \int_{[0,1]\cap \Bbb Q} f(x)\, {\rm d}{\frak m}(x) + \int_{[0,1]\cap \Bbb Q^c} f(x)\, {\rm d}{\frak m}(x) \\ &= \int_{[0,1]\cap \Bbb Q} 1\  {\rm d}{\frak m}(x) + \int_{[0,1]\cap \Bbb Q^c} 0 \ {\rm d}{\frak m}(x) \\&= {\frak m}([0,1] \cap \Bbb Q) = 0 \end{align}.$$
The exact definition of $\frak m$ is: ${\frak m}^*E = \inf\{\sum_{n \geq 1}\ell(J_n) \mid J_n \text{ intervals and } E \subseteq \bigcup_{n \geq 1}J_n\}$. Then ${\frak m}\Bbb Q = 0$. Let $\epsilon > 0$ and take a enumeration of $\Bbb Q$, $\{r_1, \cdots, r_n, \cdots\}$. Let $J_n = (r_n - \epsilon/2^{n+1},r_n + \epsilon/2^{n+1})$. Then I leave you to prove that $\Bbb Q \subset \bigcup_{n \geq 1}J_n$ and $\sum_{n \geq 1}\ell(J_n) < \epsilon.$ This in fact proves that any denumerable set has zero measure.
A: Since $f$ is characteristic function of $\mathbb{Q}$, from definition of Lebesgue integral you have:
$$I = \int_{0}^{1} f(x) dx=\lambda(\mathbb{Q\cap[0,1]})=0$$
where $\lambda$ is $1$-dimensional Lebesgue measure.
A: Your function $f(x) = \mathbb{1}_{\mathbb{Q}}(x)$, which is an indicator function of a measurable set. Lebesgue integration tells you that for all measurable $A$, $$\int \mathbb{1}_A dx = \lambda(A)$$ where $\lambda$ is the Lebesgue measure. So, your integral is equal simply to $\lambda(\mathbb{Q})$. One way to see that this is $0$ is by writing $$\mathbb{Q}=\bigcup_{n\in\mathbb{N}}\{q_n\}$$ with $\{q_n\}$ an enumeration of the rationals, then use the $\sigma$-additivity property of measures noting that the Lebesgue measure of a singleton set is $0$.
A: The Lebesgue integral is like Riemann integration turned on its side.  (Instead of dividing the domain into sections, as Riemann does, it divides the range into sections and takes the pre-image of those sections.)  It sums the Lebesgue measures of the pre-images of the values in the range of the function times the function values.  It is related to measure theory. In this case, the Lebesgue integral is 1* measure( rationals) + 0 * measure( irrationals).  It can be shown that measure( rationals ) = 0 and measure( irrationals ) = 1.  So the integral is 0.  The measure of the rationals is 0 because you can create a countable set of line segments containing all the rationals whose lengths sum to less than an arbitrarily small epsilon>0.
A: Lebesgue integration tells you that the value is zero. Basically, much like how you can split integrals over intervals in Riemann integration, you can split integrals over arbitrary measurable sets in Lebesgue integration. Here we write:
$$\int_{[0,1]} f(x) dx = \int_{[0,1] \cap \mathbb{Q}} 1 dx + \int_{[0,1] \cap \mathbb{Q}^c} 0 dx$$
Now that we've written it as an integral of constant functions, we just multiply the constants by the measures of the corresponding sets, obtaining
$$\int_{[0,1]} f(x) dx = 1 \cdot 0 + 0 \cdot 1 = 0.$$
since $[0,1] \cap \mathbb{Q}$ has measure zero. Explaining how to prove that it has measure zero would require a significant amount of explanation of the definitions and theorems from measure theory.
