The question is from Mathematical Analysis, Douglass pg.286 Exercise 18.
Define a function $f(x)$ on $[0, 1]$ such that $f(x)=x$ if $x$ is rational, and $f(x)=0$ if $x$ is irrational. Find $L(f)$ and $U(f)$, and determine whether $f$ is in $R[a, b]$.
My attempt:
For any partition $\pi=\{0=x_0, x_1, ...x_p=1\} \in \Pi[0, 1]$, there exists an irrational between every interval $[x_{j-1}, x_j]$, so the minimum of each interval would be $0$, so we could conclude that $L(f)=0$. $U(f)$ is the part that I am having some hard time with.
Take the same partition as above, but in this case, take such that each $x_i$'s are rational. Then, for each interval $[x_{j-1}, x_j]$, the supremum of $f$ in this interval would be the largest rational, which is $x_j$. Then, $$U(f, \pi)=\sum_{j=1}^{p}M_j\Delta x_j=\sum_{j=1}^{p}x_j(x_j-x_{j-1})$$ At this stage, I struggled to get an inequality that would make me conclude that $L(f)\neq U(f)$, but I failed to do it. I saw that $U(f)=\frac{1}{2}$ from another article, and I'm not sure whether this specific partition would do me the job. I plugged in about 5 to 6 small partitions of $[0, 1]$ and it seems that it would do the job, but I'm not sure how to prove it. Can someone help me out with this proof?