Find whether these functions are Riemann integrable or not and If they are then what is the value of he integral

real-analysisriemann-integration

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 !!

Best Answer

The function $g$ is continuous at every irrational point. To prove this let $x_n = \frac{p_ n}{q_n}$ be a sequence of rational numbers such that $\mbox{GCD} (p_n , q_n )=1$ which converges to $x\in [0,1]\setminus \mathbb{Q}.$ If we assume that there is a subsequence $q_{n_k } $ that is bounded then it has a subsubsequence that is constant and therefore by the convergence of $x_{n_k}$ the sequence $x_{n_k} $ has a subsequence that is convergent to an rational number. But this is immposible. Therefore the sequence $g(x_n )$ have to converges to $0=g(x)$. Thus the function $g$ is continuous at $x.$

Fom the above we deduce that the set of discontiunities of $g$ has Lebesgue measure zero and thus $g$ is Riemann itegrable.