Prove that $f$ is Riemann-integrable on $[a,b]$ Assume that $\{r_n\}$ is an index of rational numbers in the interval $[a,b]$ and $\{v_n\}$ is a sequence of non-zero real numbers which converges to $0$.    
Define $f:[a,b] \to \mathbb R$ this way :
If $x=r_n$ ,  $f(x)=v_n$
If $x \notin \mathbb Q \cap [a,b]$ , $f(x)=0$  

Prove that $f$ is Riemann-integrable on $[a,b]$.

My try :  
I observed that $f$ is discontinuous on each interval and is not monotonic on any interval. That makes it hard to prove the statement above. I don't know what to do next...

I think in this way it should work:
Consider for the sake of simplicity $v_n >0$ for each $n \in \mathbb{N}$. Let $ 1 > \epsilon >0$ By definition there exists $n_m \in \mathbb{N}$ such that $v_n < \epsilon$ for each $n \ge n_m$.
Now observe that one can assume that $ a = r_1 < r_2 < . . . < r_{n_m} = b$. Take $\delta$ to be $\epsilon\min\{ | r_i - r_j |\}/2$ Consider the partition $P =r_1< r_1 + \delta/2 < r_2 . . . r_{n_m - 1} + \frac{\delta}{2^{n_m - 1}} < r_{n_m} $ which now i rename $ x_{1}^0 < x_{1}^1 < . . . < x_{n_m}^0$. We have that $U(P) = \sum_{i=1}^{n_m-1} v_i ( x_{i}^1 - x_{i}^0) + \sum_{i=2}^{n_m} \sup_{[ x_{i-1}^1, x_{i}^0]}(f(x)) (x_{i}^0 - x_{i-1}^1)$ Now you can extimate this upper riemann sum observing:


*

*our choose of $n_m$ gives $\sup_{[ x_{i-1}^1, x_{i}^0]}(f(x)) < \epsilon$

*our choose of the partition gives $\sum_{i=1}^{n_m-1} v_i ( x_{i}^1 - x_{i}^0) \le \max\{v_1, . . .,v_{n_m}\}\ \epsilon$


Thus you get $U(P) \le \max\{v_1, . . .,v_{n_m}\}\ \epsilon + \epsilon (b - a)$ and you can conclude, because a convergent sequence of real numbers is bounded, that $U(P) \rightarrow 0$, thus the claim since it's obvious that $L(P) \ge 0$ (I supposed $v_n \ge 0$, otherwise you have to do the same thing for lower sums).
