Why is the Dirichlet function,
$$f(x) = \begin{cases}x : x \in \mathbb{Q}, \\ 0 : x \notin \mathbb{Q}, \end{cases}$$
not Riemann integrable on any interval $[a, b]$?
Why is the Dirichlet function,
$$f(x) = \begin{cases}x : x \in \mathbb{Q}, \\ 0 : x \notin \mathbb{Q}, \end{cases}$$
not Riemann integrable on any interval $[a, b]$?
Because $\mathbb Q$ is dense and discrete in $\mathbb R$, so $$\sup_{x\in[\xi,\eta]} f(x) = \eta \neq 0 = \inf_{x\in[\xi,\eta]} f(x)$$ Thus, $U(f;[a,b],Z) > 0=L(f;[a,b],Z)$ for any partiton $Z$
[I have edited to reflect $f(x) = x\chi_{\mathbb Q}(x)$, the previous version was designed for $f(x) = \chi_{\mathbb Q}(x)$]
Say $a,b$ are positive. No matter what partition of the interval you choose, you can always pick a rational representative. The Riemann sum is then the same as the riemann sum for $f(x) = x$, so you get $(b-a)/2$ However, if you were to always pick an irrational representative of each subinterval, you would get $0$. These answers are different, so the limit of the sequence of Riemann sums depends on the choice of the representatives. So it is not Riemann integrable.