Integrability of Thomae function and value of its integral

integrationreal-analysissolution-verification

I am trying to solve the following exercise (from Axler's Measure, Integration and Real Analysis) and I would like to have some help in finishing my proof.

"Define $f:[0,1]\to\mathbb{R}$ as follows:
$
f(a) =
\begin{cases}
0 & \text{if $a$ is irrational} \\
\frac{1}{n} & \text{if $a\in\mathbb{Q}$ and $n$ is the smallest positive integer such that $a=\frac{m}{n}$ for some integer $m$}
\end{cases}
$
.

Show that $f$ is Riemann integrable and compute $\int_{0}^{1}f$."

My solution: (NOTE: THIS SOLUTION IS WRONG, I HAVE WRITTEN A CORRECT ONE IN THE ANSWER TO THIS QUESTION BELOW)

We immediately note that for any partition $P$ of $[0,1]$ we have $L(f,P,[0,1])=\sum_{j=1}^{n}(x_j-x_{j-1})\inf_{[x_{j-1},x_j]}f=\sum_{j=1}^{n}(x_j-x_{j-1})\cdot 0=0$ since in any sub-interval of $[0,1]$ there will be an irrational number.

Now we let $\varepsilon>0$ and consider the size of the set $D_{\varepsilon}:=\{x\in [0,1]:f(x)\geq \varepsilon\}\subset\{x\in [0,1]:f(x)\geq\frac{1}{n}\}=:D_{1/n}$, where $\varepsilon\geq\frac{1}{n},\ n>1+\frac{2}{\varepsilon}$ fixed (such an $n$ must exist, since $\frac{1}{n}\overset{n\to\infty}{\to}0$).

We note that if $\varepsilon>1$ we have $D_{\varepsilon}=\emptyset\Rightarrow \#(D_{\varepsilon})=0$,

if $\varepsilon = 1$ we have $D_{\varepsilon}=\{0,1\}\Rightarrow \#(D_{\varepsilon})=2$,

if $\frac{1}{2}\leq\varepsilon\leq 1$ we have $D_{\varepsilon}\subset D_{1/2}=\{0,1,\frac{1}{2}\}\Rightarrow \#(D_{\varepsilon})\leq \#(D_{1/2})=3$,

if $\frac{1}{3}\leq\varepsilon\leq \frac{1}{2}$ we have $D_{\varepsilon}\subset D_{1/3}=\{0,1,\frac{1}{2},\frac{1}{3},\frac{2}{3}\}\Rightarrow \#(D_{\varepsilon})\leq \#(D_{1/3})=5$,

if $\frac{1}{4}\leq\varepsilon\leq \frac{1}{3}$ we have $D_{\varepsilon}\subset D_{1/4}=\{0,1,\frac{1}{2},\frac{1}{3},\frac{2}{3},\frac{1}{4},\frac{2}{4},\frac{3}{4}\}=\{0,1,\frac{1}{2},\frac{1}{3},\frac{2}{3},\frac{1}{4},\frac{3}{4}\}\Rightarrow \#(D_{\varepsilon})\leq \#(D_{1/4})=7$,

if $\frac{1}{5}\leq\varepsilon\leq \frac{1}{4}$ we have $D_{\varepsilon}\subset D_{1/5}=\{0,1,\frac{1}{2},\frac{1}{3},\frac{2}{3},\frac{1}{4},\frac{3}{4},\frac{1}{5},\frac{2}{5},\frac{3}{5},\frac{4}{5}\}\Rightarrow \#(D_{\varepsilon})\leq \#(D_{1/5})=11$,

$\dots$,

so we see that in each case $D_{1/N},\ (N\geq 2)$ contains $0,1$ and the $k-1$ elements $\frac{1}{k},…,\frac{k-1}{k}$ for $2\leq k\leq N$ (this is an overestimate for the size of $D_{1/N}$ since some of the elements in this set might be present also in $D_{\frac{1}{N-1}}$ – see for example $D_{1/4}$) hence an upper bound for the size of $D_{1/N}$ is $$2+\sum_{k=2}^{N}(k-1)=2+\sum_{k=1}^{N}k-\sum_{k=1}^{N}1=1+\frac{N(N+1)}{2}-(N-1)=\frac{N^2-N+4}{2}$$
which in turn implies that $\#(D_{\varepsilon})\leq \frac{N^2-N+4}{2}$.

So, we consider again now the aformentioned $n$ such that $\frac{1}{n}\leq\varepsilon$, set $M:=\frac{n^2-n+4}{2}$ and consider the partition $P_{\varepsilon}$ of $[0,1]$ such that
$$P_{\varepsilon}:=\{0,n_1-\frac{\varepsilon}{4M}, n_1+\frac{\varepsilon}{4M},\dots, n_M-\frac{\varepsilon}{4M}, n_M+\frac{\varepsilon}{4M},1\}.$$

We have that $$U(f,P_{\varepsilon},[0,1])\leq (n_1-\frac{\varepsilon}{4M})\cdot 1+\frac{\varepsilon}{2M}\cdot 1+(n_2-n_1-\frac{\varepsilon}{2M})\cdot\frac{1}{n}+\frac{\varepsilon}{2M}\cdot 1+(n_3-n_2-\frac{\varepsilon}{2M})\frac{1}{n} +\dots +\frac{\varepsilon}{2M}\cdot 1+ (1-n_M-\frac{\varepsilon}{4M})\cdot 1= M\cdot\frac{\varepsilon}{2M}+(1-n_M-(\frac{\varepsilon}{4M}+\frac{\varepsilon}{4M}+M\frac{\varepsilon}{2M}))\frac{1}{n}=\frac{\varepsilon}{2}+(1-n_M-\frac{\varepsilon}{2M}+\frac{\varepsilon}{2})\frac{1}{n}<\frac{\varepsilon}{2}+(1+\frac{\varepsilon}{2})\frac{1}{n}<\varepsilon$$ so $U(f,P_{\varepsilon},[0,1])-L(f,P_{\varepsilon},[0,1])=U(f,P_{\varepsilon},[0,1])<\varepsilon$.

We have thus shown that for each $\varepsilon>0$ there exists a partition of $[0,1]$ such that $U(f,P_{\varepsilon},[0,1])-L(f,P_{\varepsilon},[0,1])<\varepsilon$ so $f$ is Riemann integrable on $[0,1]$, and $\int_{0}^{1}f=U(f,[0,1])=L(f,[0,1])=0$.

Best Answer

There are two mistakes here, in my view:

The first is a mistake at the end: You implicitly assume that in the intercal $[0,n_1 - \frac{\epsilon}{4M}]$ the supremum of $f$ is equal to zero, which is not true (and similarly for a lot of other intervals). At most you can estimate this supremum with $\frac{1}{n+1}$, so you get an extra term of at most $\frac{M+1}{n+1}(1 - \frac{\epsilon}{2M})$, which does not go to zero if $n \rightarrow \infty$ (or am I missing something?).

Second (and third) you should define your $n_i$, ($1 \leq i \leq M$), and you assumed that there exist exactly $M$ such points (but it is an upper bound as you stated), of course there is no harm in picking exactly $\tilde{M}_n := \#(D_{\frac{1}{n}})$ and then filling up the remainin $M - M_n$ with random ones, but you should state this explicitely.

All in all, a very nice idea of a proof, maybe you can make it work with a few changes (to add something positive to all the criticism, but then again you literally asked for it ;))

Related Question