# Prove $f:[0,1]\times[0,1]\to \mathbb R$ is integrable.

Let $f:[0,1]\times[0,1]\to \mathbb R$, $$f(x,y)= \begin{cases} \frac1q+\frac1n, & \text{if (x,y)=(\frac mn,\frac pq) \in \Bbb Q\times\Bbb Q,  (m,n)=1=(p,q) } \\ 0, & \text{if x or y irrational  or 0,1} \end{cases}$$

Prove that f is integrable over $R=[0,1]\times[0,1]$ and find the value of the integral (I know its value is zero, because every lower sum is zero).

I'm trying to find the set of discontinuities of $f$ over $R$ and prove that it has measure zero, so that $f$ is integrable.

I remember doing this for the one dimensional case (Thomae´s function), proving that $f$ was continuous over the irrationals and discontinuous over the rationals, but I can't prove it this time, so I need some help, it will be really appreciated.

• $f$ is nonnegative and is zero a.e. so its integral is zero a.e. – Math1000 Feb 29 '16 at 1:46

Let $u\mapsto T(u)$ $\>(0\leq u\leq1)$ be Thomae's function. Then $$0\leq f(x,y)\leq T(x)+T(y)\qquad\bigl((x,y)\in Q:=[0,1]^2\bigr)\ .$$ By "Fubini's theorem" for Riemann integrals one obtains $$\int_Q T(y)\>{\rm d}(x,y)=\int_0^1 \int_0^1 T(y) dy\ dx=0\ ,$$ and similarly for $(x,y)\mapsto T(x)$. It follows that $\int_Q f(x,y)\>{\rm d}(x,y)=0$.
If $a,b\in[0,1]$ are irrational, then $f$ is continuous in $(a,b)$. Given $\epsilon>0$, the number of rationals in $[0,1]$ with denominator (when written as $p/p$ an irreducible fraction) larger than than $1/\epsilon$ is finite. Then the exusts $\delta>0$ such that if $|x-a|,|y-b|<\delta$, then $f(x,y)=0$ (if one of $x$ or $y$ is irrational) or less than $2\,\epsilon$ (if both $x$ and $y$ are rational.) In any case, $|f(x,y)-f(x,a)|\le2\,\epsilon$. The set of discontinuities of $f$ is contained in $$D=\bigcup_{r\in\mathbb Q}\Bigl(\{r\}\times[0,1]\cup[0,1]\times\{r\}\Bigr).$$ $D$ is the conutable union of sets of measure $0$, so it has also measure $0$.