Integral of function (1 if irrational, 2 if rational)

Let function $f$ be defined, such that $f(x)=1$ for irrational $x$ and $f(x)=2$ for rational $x$. Compute $\int_0^1 f(x)\,dx$.

How would I even???? Would it just be $1$ because there are infinitely many irrational numbers between each rational number or ?????????

I don't even know where to start with this.

• Exactly what is your definition of a definite integral like $\int_a^bg(x)dx$? The answer to your problem will depend heavily on this. – Arthur Mar 26 '17 at 20:37
• @Arthur What is your definition of it? How would you integrate it using yours... I don't have any clue, I guess for me it would be the area under the curve, but clearly that doesn't make sense – Saketh Malyala Mar 26 '17 at 20:45
• It's usually some form of limit, and the word "partition" probably appears. Maybe even two simultaneous limits which should be equal. Does this ring any bells? Doesn't your book tell you? To be more specific, even whether your integral has a value or is undecidable depends on what definition you're using. – Arthur Mar 26 '17 at 20:48

Riemann integral: $\int_0^1 f(x) dx$ is undefined, because the refinement of the partition of the interval does not result in a converging Riemann sum.
Lebesgue integral: $f\equiv 1$ almost everywhere, because the rational numbers are a countable set, which means that they are a set of measure zero and do not have any impact on the result. Therefore, $\int_0^1 f(x) dx = 1$