# Show that a function is not integrable but an iterated integral exist

So, I have the funcion

$f(x,y) = \begin{cases} 0 & \text{if }x \text{ irrational} \\ 2y & \text{if } x \text{ rational}\ \end{cases}$

Defined in $R=[0,1]\times[0,1]$

I know that $f$ is not Riemann-integrable since the value of the lower/upper Darboux' sums depends on the choice of the sample points.

I just don't understand why should the iterated integral exist:

$\int_{0}^{1}[\int_{0}^{1}f(x,y)dy]dx$

But it does, and I don't know what its value should be.

As for the iterated integral, just evaluate it inside out. Consider, for fixed $x \in [0, 1]$, the integral $$\int_0^1 f(x,y) \, \mathrm{d}y = \begin{cases} \int_0^1 2y \, \mathrm{d}y & \text{if } x \in \mathbb{Q} \\ \int_0^1 0 \, \mathrm{d}y & \text{if } x \in \mathbb{R} \setminus \mathbb{Q}\end{cases} = \begin{cases} 1 & \text{if } x \in \mathbb{Q} \\ 0 & \text{if } x \in \mathbb{R} \setminus \mathbb{Q}\end{cases}.$$ This function is not Riemann integrable, so the iterated integral doesn't make sense.
If you want an example of an iterated integral that does make sense, even though the function is not integrable, try $$f(x, y) = \begin{cases} \sin(y) & \text{if } x \in \mathbb{Q} \\ 0 & \text{if } x \in \mathbb{R} \setminus \mathbb{Q}\end{cases}.$$ over $[-\pi, \pi] \times [-\pi, \pi]$.