# Continuity and (Riemann) integrability of a particular function

I have the following function (sorry for the vague title but I don't know if this kind of function has some special name) defined by:

$$f(x)= \begin{cases} 0 & \text{if } x\in\mathbb R \smallsetminus\mathbb Q, \\[6pt] \frac 1n & \text{if } x=\frac mn\in\mathbb{Q},\,\, \gcd(m,n)=1.\end{cases}$$

first I have to prove that this function is continuous only at the irrational points and I see why but I can't properly formalize it rigorously, then I have to prove that it is Riemann integrable on $[0,1)$ and that said integral is $0$ and I really don't know how to approach this.

• This is variously known as Thomae's function or the popcorn function, or a number of other things. (No idea why Riemann's name would be attached to it.) – Chappers May 29 '17 at 16:47
• @Chappers the question is to prove whether or not the function is Riemann integrable. The problem doesn't state that the function itself is associated with Riemann. – Tucker May 29 '17 at 16:51
• @Tucker I'm commenting on one of the other names listed in the link. – Chappers May 29 '17 at 16:53

If $x\in\mathbb Q$, then take a sequence $(x_n)_{n\in\mathbb N}$ of irrational numbers such that $\lim_nx_n=x$. Then $\lim_nf(x_n)=0\neq f(x)$ and therefore $f$ is not continuous at $x$.
If $x\notin\mathbb Q$, then $f(x)=0$. Given $\varepsilon>0$, there are only finitely many points $x\in[0,1]$ such that $f(x)\geqslant\varepsilon$. So, take an interval $(x-\delta,x+\delta)$ so small that it contains no such number. This assures that $|y-x|<\delta\Longrightarrow|f(y)-f(x)|=|f(y)|<\varepsilon$.
Given $\varepsilon>0$, and given and partition $P$ of $[0,1]$, every lower sum $\underline\Sigma(f,P)$ is equal to $0$. If you prove that there is an upper sum $\overline\Sigma(f,P)$ smaller that $\varepsilon$, this will prove that the Riemann integral exits and that it is equal to $0$. Again, this follow from the fact that there are only finitely many points $x\in[0,1]$ such that $f(x)\geqslant\varepsilon$.
• I use that twice: in order to prove that $f$ is continuous in $\mathbb{R}\setminus\mathbb Q$ and in order to prove that $f$ is Riemann integrable. Which one do you have in mind? – José Carlos Santos May 29 '17 at 16:59