TITLE: Evaluating Integrals using Lebesgue Integration
QUESTION [9 upvotes]: 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?

REPLY [3 votes]: 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.