Given $$ f(x) = \begin{cases} x, & \text{when x is rational} \\ -x, & \text{when x is not rational} \end{cases} $$ Show that $f$ is not Riemann-integrable over $[a,b]$, but $|f|$ is.
How to go about this problem? I started by taking a partition $P$ with each interval of equal length say $k$. Now clearly $U(P,f)$ is not equal to $L(P,f)$ and hence the limits. Is this approach fair?