Let $f$ be a bounded, real-valued (not necessarily continuous) function on $[0, 1]$ such that the set $A=\{x: f(x) \neq 0 \}$ is countable and closed. Show that $f$ is Riemann integrable.
Please do NOT use the fact that $f$ is Riemann integrable iff $f$ is continuous a.e.
Since $f$ is bounded, let $|f| \le M$ on $[0, 1]$. Then it would be enough to prove that the function $M \chi_A$ is Riemann integrable, since if $U(M\chi_A ,P)-L(M\chi_A,P)<\epsilon$ for given $\epsilon>0$ and a partition $P$, then the same equality also holds for $f$. Is my idea right?
However, I failed to proceed further. Does anyone have an idea?
Note that $A$ is compact. Now let $\varepsilon>0$. If $A=\{a_n\}$ $n\in \mathbb{N}$, and put $U_n=]a_n-\varepsilon_n, a_n+\varepsilon_n[$, where $\varepsilon_n>0$ and $\sum \varepsilon _n<\varepsilon$. The $U_n$ are an open cover of $A$, hence there exist a finite number of the $U_n$ that cover $A$, say for $n\in I$ finite subset of $\mathbb{N}$. Then if $h=\sum_{n\in I}\chi_{U_n}$, $Mh$ is a step function, and $M\chi_A\leq Mh$. As the integral of $Mh$ is $\leq M\varepsilon$, we have hence proved that $M\chi_A$ is Riemann integrable, with integral equal to $0$. If $f$ is positive, you are done, as $0\leq U(f,P)\leq U(M\chi_A,P)$ with your notation. In the general case, take $K>0$ such that $f(x)\geq -K$ for all $x\in A$, and apply the above for $g=f+K\chi_A$.