Let $f$ be defined on $[a,b]$ as :
$f(x)$ = $\frac1{q^2}$ when $x=p/q$
$f(x)$ = $\frac1{q^3}$ when $x=\sqrt {p/q}$
where $p$ and $q$ are relatively prime integers and $f(x)$ = $0$ for all other values of x.
Show that $f(x)$ is Riemann Integrable.
I am assuming a partition($P$) of $n$ equal intervals. Since every partition would have irrational numbers hence $L(P,f) = 0$.
$U(P,f)$ should be $\lim \limits_{n \to \infty}\sum\frac{(b-a)/n}{q^2}$. But I am unable to write $q$ in terms of $n$ so as to finally solve Upper Darboux Sum.
We observe:
So let $S(n) = \{a\le x\le b \,|\, f(x)>\frac1n\},$ and denote it by $S$ when it is clear what $n$ is. For any $n>0$ we have $S(n)$ is finite, say $k=|S|$. Let $\ell=b-a$.
Let $D(n)=\{a,b\} \cup \left\{x-\frac\ell{2kn}, x+\frac\ell{2kn} \,\middle|\, x \in S(n)\right\}.$ Now define $\mathcal D$ to be the dissection $a=x_0<x_1<\cdots<x_m=b$ made from exactly the points $x_i\in D.$
We clearly see $L(\mathcal D,f)=0.$ Now consider $U(\mathcal D,f).$ Around each $x\in S$ we have a region of size at most $\frac\ell{kn}$ and so this contributes at most $\frac\ell{kn}$ to the upper bound, as $f(x)\le1$ for all $x$. There are $k$ of these regions so their total contribution is at most $\frac\ell n$. What about all the other regions? Well their total length is at most $\ell$ and they do not contain any of $S$ and so their upper boundaries can be bounded above by $\frac1n,$ thus they contribute at most $\frac\ell n$.
Therefore $U(\mathcal D,f)\le2\frac\ell n\to 0$ as $n\to\infty$ so $f$ is Riemann integrable.