Let $f(x)=\cos^2(x)$ if $x\in \mathbb{Q}$ and $f(x)=0$ if not. Show that $f$ is Riemann Integrable on $\left[0,\pi/2\right]$.
The problem that I have, is that I don't really see why this function would be Riemann integrable. I will start the proof and explain in details what I did. So, if someone could tell me where my intuition is worng, I would appreciate it.
By definition, $f$ is integrable iff. $\exists$ a subdivision $\sigma$: $\overline{S}_{\sigma}(f)<\underline{S}_{\sigma}(f)+\epsilon \ \forall \epsilon>0$.
By density of irrational numbers, the lower Darboux sum is equal to $0$. So, we have to show that $$\overline{S}_{\sigma}(f)<\epsilon \iff \sum_{i=0}^{n}M_i(x_{i+1}-x_i)<\epsilon,$$ with $M_i=\sup\{f(x):x\in[x_{i},x_{i+1}]\}$. By density of rational numbers, we consider the following sum:
$$\sum_{i=0}^{n}\cos^2(x_i)(x_{i+1}-x_i)$$ as $\cos^2(x)$ is decreasing on $[0,\pi/2]$. But, $0\le\cos^2(x)\le 1$ on $[0,\pi/2]$. Therefore, $$\sum_{i=0}^{n}\cos^2(x_i)(x_{i+1}-x_i)\le 1 \cdot \sum_{i=0}^{n}(x_{i+1}-x_i)=\frac{\pi}{2}-0>\epsilon$$ for every subdivision. Thus, $f$ is not intergable on $[0,\pi/2]$.