Show that $f(x)=\begin{cases}1/b& x=\frac{a}{b}\in [0,1],a,b\in\mathbb Z\\ 0&x\in \mathbb R\backslash \mathbb Q \cap [0,1]\end{cases}$ is integrable. Show that $$f(x)=\begin{cases}\frac{1}{b}&amp; x=\frac{a}{b}\in [0,1],a,b\in\mathbb Z\\ 0&amp;x\in \mathbb R\backslash \mathbb Q \cap [0,1]\end{cases}$$
is integrable on $[0,1]$.

Let $$S_\sigma =\sum_{i=1}^n m_i(x_{i+1}-x_i)\quad \text{and}\quad S^{\sigma }=\sum_{i=1}^n M_i(x_{i+1}-x_i),$$
where $$M_i=\max_{ [x_{i+1},x_i]}f,\quad \text{and}\quad m_i=\min_{[x_{i+1},x_i]}f.$$

I have to show that $\overline{S}=\underline{S}$ where $$\overline{S}=\sup_{\sigma }S_\sigma  \quad \text{and}\quad \underline{S}=\inf_\sigma  S^\sigma .$$

Obviously $S_\sigma =0$ for all partition $\sigma $, and thus $\overline{S}=0$. But for $\underline{S}$ I have some problem. I just can't find $M_i$. But maybe something as : 

I consider $ \sigma _n : 0&lt;\frac{1}{n}&lt;...&lt;\frac{n-1}{n}&lt;1$. Then I would say that $M_i\leq \frac{1}{i}$, and thus

$$S^{\sigma _n}\leq \frac{1}{n}\sum_{k=1}^n\frac{1}{k}\underset{n\to \infty }{\longrightarrow }0,$$
and thus, the claim follow. It work ?
$f$ is integrable iff $\exists P$ for every $\epsilon &gt;0$ such that $S^{\sigma}-S_{\sigma}&lt;\epsilon$.

Choose $P=\{x_0, ....,x_n\}$ such that $x_i - x_{i-1} = \frac{b-a}{n}$.

$S_{\sigma} = 0$ on $P$ because for every interval $[x_i, x_{i+1}]$, $m_i=0$.

Also, since $f(x)&lt;1$ for $x&lt;1$, we also have $M_i &lt; 1$ and so $$\sum_{i=1}^n M_i &lt; n$$

Put $\sum_{i=1}^n M_i = M &lt;n$

Therefore $S^{\sigma}-S_{\sigma} = \frac{b-a}{n}M - 0&lt;\epsilon$ on $P$ for large enough $n$.
$f$ is integrable iff $\exists P$ for every $\epsilon &gt;0$ such that $S^{\sigma}-S_{\sigma}&lt;\epsilon$.

Choose $P=\{x_0, ....,x_n\}$ such that $x_i - x_{i-1} = \frac{b-a}{n}$.

$S_{\sigma} = 0$ on $P$ because for every interval $[x_i, x_{i+1}]$, $m_i=0$.

Also, since $f(x)&lt;1$ for $x&lt;1$, we also have $M_i &lt; 1$ and so $$\sum_{i=1}^n M_i &lt; n$$

Put $\sum_{i=1}^n M_i = M &lt;n$

Therefore $S^{\sigma}-S_{\sigma} = \frac{b-a}{n}M - 0&lt;\epsilon$ on $P$ for large enough $n$.