Taking the integral of irrationals Let
$$f(x,y)=
\begin{cases}
1,&\mbox{ if $x$ is rational}\\2y,&\mbox{ if $x$ is irrational.}
\end{cases}
$$
Show that $$\int_0^1dx\int_0^1f(x,y)dy=1$$
But that 
$$\int_0^1dy\int_0^1f(x,y)dx$$
Fails to exist.
My approach : I couldn't manage to build a good approach here to be honest, but I think f(x,y)=1 if x is rational is not continuous that's why the second integral does not exist. But I also couldn't evaluate the first integral, any hints?
 A: Let's consider the first integral,
$$\int_0^1 \left( \int_0^1 f(x,y) dy\right) dx. \tag{1}$$
The inner integral is
$$ \int_0^1 f(x,y) dy.$$
If $x$ is a rational number, then this is
$$ \int_0^1 1 dy = 1.$$
If $x$ is irrational, then this integral is
$$ \int_0^1 2y dy = y^2 \bigg|_0^1 = 1.$$
So the inner integral is always $1$. Thus we can rewrite $(1)$ as
$$ \int_0^1 1 dx = 1.$$

Let us now consider the second integral,
$$ \int_0^1 \left( \int_0^1 f(x,y) dx \right) dy. \tag{2}$$ 
We must consider the inner integral again. The inner integral is
$$ \int_0^1 f(x,y) dx.$$
If $y$ is any number other than $\frac{1}{2}$, then this integral is not integrable. In short, as the rationals and irrationals are each dense in $[0,1]$, any upper sum partition of $[0,1]$ will yield a very different area estimate compared to any lower sum partition of $[0,1]$.
This function is essentially the Dirichlet Function, and it is a classical exercise to show that the Dirichlet Function is not integrable [See this answer on this site to a similar question for one explanation as to why $(2)$ is not integrable].
Since the inner integral in $(2)$ is not integrable, we have that this integral fails to exist.
A: The first integral exists because if we fix $x$ then the inner integrand can take either a value of $1$ or $2y$ and for both, the overall integral exists and comes out to be $1$. However for the second integral,it's inner integral can be thought of as an integration for rational indicator function,except in this case value is not $0$ when $x$ is irrational but $2y$, which doesn't exist (proved using density arguments). 
P.S. Riemann integration is considered.  
