Is f(x,y) integrable? Question 3-7 from Spivak's Calculus on Manifolds I am trying to work my through the exercises in Spivak's Calculus on Manifolds. I am currently working on the exercises in Chapter 3 which deals with Integration. I am having trouble with the following question:

Let:
\begin{equation}
  f(x,y)=\begin{cases}
    0, & \text{if $x$ is irrational}.\\
    0, & \text{if $x$ is rational, $y$ is irrational}. \\
    1/q, & \text{if $x$ is rational, $y=p/q$ in lowest terms}.
  \end{cases}
\end{equation}
Show that $f$ is integrable  on $A = [0,1] \times [0,1]$ and $\int_A f = 0$.

I was thinking of trying to prove that this set is Jordan Measurable and that it's Jordan measure is zero and that it is therefore Riemann Integrable but I am not sure how to do this or if it is even the best way to solve this problem.
If I could show that $f$ is continuous on $A$ up to a set of Jordan Measure $0$, then $f$ would be integrable but again, I'm not sure I can do this or if its even appropriate for this problem.
Any assistance that anyone could provide would be greatly appreciated.
Thank you.
 A: Hint: For any partition $P$ of $A$ the lower sum $L(P,f) = 0$ since any rectangle must contain a point $(x,y)$ where $x$ is irrational and $f(x,y) = 0.$  Next show that the upper sum $U(P,f)$ can be arbitrarily close to zero if the partition is sufficiently fine. Just extend the proof for the one-dimensional case given here.
Aside
This function is peculiar in that it is Riemann integrable on $[0,1]^2$, but for fixed rational $y$, the function $f(\cdot,y)$ is a non-Riemann-integrable Dirichlet function and $\int_0^1 f(x,y) \, dx$ does not exist as a Riemann integral.
In this case, the iterated integral
$$\int_0^1 \left(\int_0^1 f(x,y) \, dx \right) \, dy$$
does not exist.
A: So here is an attempt at a solution:
So for any partition $P$, 
$u(f,P) = 0$, so it should be enough to show that $U(f,P)$ is arbitrarily close to $0$. For a natural number $q$, consider the partition,
$P = \bigl((0,1/q,2/q,\cdots,(q-1)/q,1),(0,1)\bigr)$.
Let $x \in [\frac{p}{q}, \frac{p-1}{q}]$, with $p < q$ and $\frac{p}{q}$ in lowest terms. 
Then, if $x = \frac{a}{b}$, 
$b \ge q$
So, for any rectangle in the partition $P$, $U(f,P) = \frac{1}{q^2}$
And since $q$ can be chosen to be arbitrarily large, the upper sum of $f$ is arbitrarily close to the lower sum of $f$ for an appropriate partition. Thus $f$ is integrable.
Furthermore,
$\int_{[0,1] \times [0,1]} f$ = $infU(f,P) = q(1/q^2) = 0$
Is this correct?
A: It is obvious that the inferior sums are zero, so we want to proof that the superior sums $U(f;P)$ can be taken less than any previously fixed $\epsilon$. Let p prime and let $k=\max \{n \mid n(n+1)/2 +1\leq p)\}$ . Then $p=\frac{k(k+1)}{2}+q$, with $0\leq q\leq k+1$. (If $q=0$ then $p$ is of the form $p=1+2++...+k=k(k+1)/2$ and if $q=k+1$, $p $ is of the same form  $p=1+2+...+k+k+1=(k+1)(k+2)/2$). Now we take the partition $P=\{0<1/p<...<(p-1)/p<1\}$. The reason for taking $p$ prime is that any fraction $a/b\in [\frac{m-1}{p},\frac{m}{p} ]$ with $b<p$ is the interior of the interval. That avoid that the same fraction repeats when we take the supreme of the function. For example, if $p=4$, then $1/2$ appears as the supreme value of $f$ in $[1/4,1/2]$ and $[1/2,3/4]$ and we don't want this to happen. Thus, $1$ appears only one time and no more as the supreme of the upper interval $[\frac{p-1}{p},1]$.
$1/2$ appears also only one time and no more as the supreme on some interval for the reason explained before. For $1/3$ we have that it can appear maybe two times and no more as the supreme of $f$ on the intervals containing $1/3$ and $2/3$ and $1/4$ may appear $3$ times and more as the supreme of $f$ on some intervals (in fact $1/4$ is the supreme of $f$ in at most 2 intervals: one containing $1/4$ and the other containing $3/4$ because $2/4=1/2$, but we want to obtain an upper bound of $U(f; P)$ so we will count $1/4$ three times). We can go on with this reasoning and we will have that as upper bounds of the supremes we have $1$ for one interval, $1/2$ also for one interval, $1/3$ for $2$, $1/4$ for $3$,... and $1/(k+1)$  for $k $ intervals. Until now we have $1+1+2+3+...+k=1+\frac{k(k+1)}{2}$ intervals for which we have found upper bounds of the supreme of $f$ on them. For the remaining $q$ intervals we can choose $1/(k+2)$ as an upper bound. So, we have
$$U(f;P)\leq \frac{1}{p}[1+1/2+2/3+3/4+...+k/(k+1)+q/(k+2)]=\frac{1}{p}[1+1-1/2+1-1/3+1-1/4+...+1-1/(k+1)+q/(k+2)]=\frac{1}{p}[k+1-S+q/(k+2)]$$, where $S=1/2+...+1/(k+1)>0$. Then
$$U(f;P)<\frac{1}{p}[k+1+q/(k+2)]$$
But $1/p<\frac{2}{k(k+1)}$, since $p>\frac{k(k+1)}{2}$, so
$$U(f;P)<\frac{2}{k(k+1)}[k+1+q/(k+2)]=\frac{2}{k}+\frac{2q}{k(k+1)(k+2)}\leq \frac{2}{k}+\frac{2}{k(k+2)}$$ since $q\leq k+1$.
The last expression tends to $0$ as $k$ tends to infinite. But $p \longrightarrow \infty \Rightarrow k\longrightarrow \infty$ so $$U(f;P)\longrightarrow 0$$ if $p \longrightarrow \infty$
