Show that $f(x)=\sin x$ if $x$ is rational, $f(x)=\cos x$ otherwise, defines $f$ not integrable on $[0,1]$ 
show that $f$ is not integrable on $[0,1]$.
hint: $M$ where $M = \sup f(x)$ on each subinterval $[X_{i-1},X_i]$
 $M \geq \cos(x)-\sin(x)$.
Then I'm not very sure about how to prove it.
 A: For every subinterval $J$ of $I=[0,\frac\pi6]$ with positive length, $\sup\limits_J\,f$ is at least $\inf\limits_I\,\cos=\frac{\sqrt3}2$ and $\inf\limits_J\,f$ is at most $\sup\limits_I\,\sin=\frac12$ hence, for any subdivision of $I$, the Darboux upper and lower sums on $I$ differ by at least $\left(\frac{\sqrt3}2-\frac12\right)\cdot|I|\gt\frac16\gt0$. Thus $f$ is not integrable on $I$.
Suitably adapted, the same method proves that $f$ is not integrable on any subinterval of $[0,1]$ with positive length, since any of these contains a point $x$ where $\cos x\ne\sin x$.
A: Are you sure about the question? It looks to me that your functions is integrable:


*

*in the sense of Lebesgue: it is equal to $\cos$ almost everywhere, and $\cos$ is clearly integrable on $[0,1]$;

*in the sens of Riemann: Edit: what is below is wrong -- see comments.
"A function on a compact interval $[a, b]$ is Riemann integrable if and only if it is bounded and continuous almost everywhere (the set of its points of discontinuity has measure zero, in the sense of Lebesgue measure)." (Lebesgue's criterion for Riemann integrability)
and you do have $\lvert f(x)\rvert \geq 1$ for all $x\in[0,1]$; [[$f$ is discontinuous only on  $[0,1]\cap\mathbb{Q}$, and the measure of $[0,1]\cap\mathbb{Q}$ is $0$.]] (false)
