The following question was asked in a masters exam for which I am preparing and I could not solve it . I tried it 25 days earlier also and then also couldn't completely solve it . So , I am asking for help here.
Question:Let $ f,g :[0,1] \to \mathbb{R}$ be given by
$f(x) \begin{cases} x^2 , & \text {if x is rational }\\ 0 , & \text { if x is irrational } \end {cases}$
$g(x) \begin{cases} 1/q , & \text {if $x=p/q$ is rational , with }\gcd(p,q)=1 \\ 0 , & \text { if $x$ is irrational } \end {cases}$
I tried by taking upper and Riemann sums. For $f(x)$: As $[0,1]$ contains infinitely many rationals and irrationals, so, lower sum $=0$. But I am confused in how to find upper sum as if I take interval $(x_{k-1} , x_k)$, then upper sum value would be $\sum_{ k=1}^n (x_{k})^2 (x_{k-1} -x_k ) $ and $ x_k -x_{k-1}$ =1/n and $x_k =k/n$ and the sum comes out to be $1/3$ after taking limit n $\to \infty $ ($\lim_{n \to \infty } \frac{n (n+1) (2n+1) }{ 6 n^3}$ =1/3) .So , f is not Riemann integrable.
Is this approach right ?
For g(x) lower sum =0 . But I am having troubles in finding upper sum . Kindly tell how should I do it .
Thank you !!