How to show that $f$ is Riemann integrable Let $u,v:[a,b]\rightarrow\mathbb{R}$ be contunious. Define $f:[a,b]\rightarrow\mathbb{R}$ by
$$f(x) = \begin{cases}u(x) & x \in \mathbb{Q} \\ v(x) & x \in \mathbb{R}-\mathbb{Q}\end{cases}$$  How to show that $f$ is Riemann integrable on $[a,b]$ if and only if $u(x) = v(x)$ for
all $x \in [a,b]$.
If $u(x)=v(x)$ then $f$ becomes continuous which imply f is Riemann integrable .But how to prove the converse part? I know that if $u(x)$ and $v(x)$ are unequal the set of points of discontinuity of $f$ is not countable so $f$ is not Riemann integrable.
 A: You can prove the converse exactly as you say but it is just a little bit subtle: if $u\neq v$, then there exists $p\in [a,b]$ such that $u(p)\neq v(p)$. By the continuity of $u$ and $v$, this implies that there exists $\epsilon > 0$ such that $u(x)\neq v(x)$ for all $\left|x-p\right|<\epsilon$. Now, for all such $x$, $f$ is discontinuous, and the set of points of discontinuity of $f$ has positive measure.
Therefore, $f$ is not Riemann integrable.
Or, are you looking for a different proof?
A: Let for $c\in[a,b],~u(c)> v(c).$ Set $d=u(c)-v(c).$ Then due to the continuity of $u,v$ in $[a,b]$ $\exists$ a neighborhood $N(c)$ of $c$ in $[a,b]$ such that $\forall~x\in N(c)$ $$u(c)-\dfrac{d}{4}<u(x)<u(c)+\dfrac{d}{4}\\v(c)-\dfrac{d}{4}<v(x)<v(c)+\dfrac{d}{4}$$ which in terms implies that, $u(x)-v(x)>u(c)-v(c)-\dfrac{d}{2}=\dfrac{d}{2}>0.$
Thus we obtain a subset $N(c)$ of $[a,b]$ of positive measure in which $u,v$ are unequal whence due to the sequential criterion of continuity $f$ is discontinuous thereon.
Consequently $f$ fails to be $\mathcal R$-integrable on $[a,b]$.
