Why this function is Riemann integrable? Let $f:[a,b]\rightarrow \mathbb R$
$$f(x)=0\text{ if x is irrational} $$
$$f(x)=\frac{1}{q}\text{ if }x=\frac{p}{q},\text{gcd}(p,q)=1 $$
When we consider the Dirichlet function, then we are saying that it is not Riemann integrable because the upper and the lower Riemann sums does converge to different values.
Why this can't be applied here at the same way? Because in this case the function does attain also different values for rational and irrational numbers. Hence the set of discontinues is uncountable..
 A: Proof:
a, f has a limit everywhere, and it is $0$.
It is enough, to show it on $(-1,1)$. Let us have an arbitary $a \in (-1,1)$.
First, we need, that for every $\epsilon > 0$, such $\delta$ exists, that if $|x-a| < \delta$, then $|f(x)-0| < \epsilon$. Let us have $N > \frac{1}{\epsilon}$, then $|f(x)-0|=|f(x)| \le \frac{1}{N}$. If $x$ is irrational, it is of course, true, if $x$ is rational, we need that, $x=\frac{p}{q}$, where $q > N$. Divide the interval $(-1,1)$ into $\frac{1}{q}$ length areas, and choose one of them, which contains $a$. Choose $\delta$ lower, than the distance between $a$ and the interval.
b, f is contionus in every irrational points.
If $a$ is irrational, $f(a)=\lim_{x\rightarrow a} f(x) = 0.$
c, f isn't contious, whenever $x$ is rational.
If $a$ is rational, $f(a) \ne\lim_{x\rightarrow a} f(x) = 0.$
Consequence: Our function is bounded, and it isn't continous in $\mathbb{Q}$. Since $\mathbb{Q}$'s Lebesgue measure is $0$, it is Riemann-integrable. It can be proven, that there isn't any function which is continous in rational points, and isn't in irrational points.
Hint: This function is called Riemann-function.
