Proving that non-negative $f$ is Riemann integrable inside interval for every $\mathcal E$ such that... Let $f$ be a non-negative function defined for $[a,b]$ such that for every $\mathcal E >0$, the set $\{ x \in [a,b] : f(x) \geq \mathcal E\}$ is finite. Prove that $f$ is Riemann integrable in $[a,b]$, and that $\int ^b_a f(x)dx = 0$.
Intuitively, I can see that this function must either be the zero function, or a mapping of finite points which descend into the zero function, from the second part of the question. I know that the complement of the given set is $\{x \in [a,b] : f(x) < \mathcal{E}\}$, which is infinite, and I managed to prove it is integrable only for the case where the given set is empty, but other than that — I'm stuck.
 A: An sketch for a proof, fill in the details.
Let $E_n:=\{x\in[a,b]:f(x)\geqslant 1/n\}$, then note that if $E_n$ is finite then $M:=\sup_{x\in[a,b]} f(x)<\infty $ and $M$ is attained, at most, at a finite number of points.
Now for any $x\in E_n$ you can set a closed interval containing it of length less or equal to $1/(n|E_n|)$, that is $[x-1/(2n|E_n|),x+1/(2n|E_n|)]\cap [a,b]$, where $|E_n|$ is the cardinality of $E_n$. Then for any partition $P$ with mesh smaller to $1/(2n|E_n|)$ we have that
$$
0\leqslant R(f,P)\leqslant \frac{b-a}n+\frac{M}n
$$
where follows that the integral is zero.
A: Let $\epsilon >0$. Then redefine $f$ at the points where $f(x) >\epsilon$ by making it $0$ at these points. Changing the value at a finite number of points does  to change Riemann integrability or the value of the integral. Hence we get $\int_0^{1} f(x)dx \leq\epsilon$ and since $\epsilon$ is arbitrary we get $\int_0^{1} f(x)dx=0$. 
A: We can use the fact that $f$ if Riemann integrable if and only if for for every $\varepsilon>0$ there are a lower sum $\sigma_{\varepsilon}$ and an upper sum $\Sigma_{\varepsilon}$ such that
$$\Sigma_\varepsilon- \sigma_\varepsilon \leq \varepsilon.$$
Now, since $f$ is non-negative, $\sigma_\varepsilon = 0$ is a lower sum. 
Take now the upper step function
$$
S(x) = 
\begin{cases}
f(x) & \left(f(x) > \frac{\varepsilon}{b-a}\right)\\
\frac{\varepsilon}{b-a} & \left(f(x) \leq \frac{\varepsilon}{b-a}\right).
\end{cases}
$$
Since (recall that $f(x)>\mathcal E$ for a finite number of $x$'s, for any $\mathcal E>0$)
$$\Sigma_\varepsilon = \int_a^b Sdx = \varepsilon,$$
we have the desired inequality, and $f$ is Riemann integrable.
Furthemore, since, for any $\varepsilon$, we have
$$\sigma_\varepsilon \leq \int_a^b f dx \leq \Sigma_\varepsilon,$$
we conclude
$$\int_a^b fdx = 0.$$
