# Proving Riemann integrability for piecewise function

Question: Prove the function $$f:[0,1] \to \mathbb R$$ given by $$f(x) = \begin{cases} 1, & \text{if x=\frac{1}{n} for any positive integer n} \\ 0, & \text{otherwise} \end{cases}$$ is Riemann integrable.

My attempt:

To prove this, I need to show that there exists a partition $$P$$ such that the difference between the upper and lower Darboux sums (denoted $$\mathcal U(P,f)$$ and $$\mathcal L(P,f)$$ respectively) is less than any $$\epsilon>0$$.

I have the following formulae:

• $$\mathcal U(P,f)=\sum^n_{i=1} M_i\Delta x_i$$
• $$\mathcal L(P,f)=\sum^n_{i=1} m_i\Delta x_i$$
• $$m_i= \inf\{f(x):x_{i-1} \le x \le x_i\}$$
• $$M_i=\sup\{f(x):x_{i-1} \le x \le x_i\}$$
• $$\Delta x_i= x_i - x_{i-1}$$

However, to begin this computations I need a partition $$P$$. How should one go about determining this?

Any help would be greatly appreciated.

• Try to see how many of the points $1/n$ lie outside the interval $[0,\epsilon /2]$. Say at most there are $k$ such points $x_1,x_2,\dots, x_k=1$. Now your partition $P$ should include points $0,\epsilon/2, 1$ and points around $x_i$ which are $\epsilon/2k$ apart. – Paramanand Singh May 17 '20 at 10:45
• @ParamanandSingh so are you saying $P = \{0, \frac{\epsilon}{2}, 1\}$? – Viv4660 May 17 '20 at 13:41
• Read again. The partition include these three points and more points around $x_i$. Something like $0,\epsilon /2,y_1,x_1,y_2,y_3,x_2,y_4,y_5,x_3,y_6,\dots,y_{2k-3},x_{k-1},y_{2k-2},y_{2k-1},1$. The thing to note is that $y_{2i}-y_{2i-1}<\epsilon/2k$. – Paramanand Singh May 17 '20 at 14:18
• Thus each $x_i$ lies between two $y_j$ and these two $y$'s differ by at most $\epsilon/2k$. I don't want to write a full answer because that takes away the joy from you. Try to understand the reason why this kind of partition would work and write an answer yourself. Do let me know if you need more clarity. The question is not difficult. – Paramanand Singh May 17 '20 at 14:21
• So this could be $P=\{ 0, \frac{\epsilon}{2}, \frac{\epsilon}{2}+\frac{\epsilon}{2k}, 1\}$ where $\epsilon > 0$ and $k \in \mathbb Z^{>0}$? – Viv4660 May 17 '20 at 14:23

pick arbitrary $$x>0$$ we know that there is $$n \in \mathbb{N}$$ s.t $$\frac{1}{n}< x$$ because $$\lim_{n \rightarrow \infty} \frac{1}{n} = 0$$ . Now we know that there are atmost finite number of discontinuities on $$[\frac{1}{n}, 1]$$ hence your function is integrable on $$[\frac{1}{n},1]$$ Since this holds for arbitrary $$x$$ we can say that function is integrable on interval $$[x,1]$$ for any $$x>0$$.Hence it is Riemann Integrable on $$[0,1]$$ using following theorem.

$$f : [a, b] \rightarrow \mathbb{R}$$ is bounded, and $$f$$ is integrable on $$[c, b]$$ for all $$c \in$$ $$(a, b)$$, then f is integrable on $$[a, b]$$.

infact you can calculate value integral of function by proving following

$$\int_{0}^1 f = \lim_{n \rightarrow \infty} \sum_{k=1}^{n} \int_{\frac{1}{k+1}}^{\frac{1}{k}} f = 0$$

can you prove the threorem and above statement?

• I'm not sure I can prove the theorem. Intuitively, it makes sense though since the "for all $c \in (a,b)$" part pretty much includes $c=a$. Do you know where I can find a proof of this theorem? – Viv4660 May 17 '20 at 14:08

I guess you want a elementary detailed proof.

Fix $$\epsilon>0$$, there exists $$n_0\in\Bbb N$$ such that $$\frac{1}{n_0}<\epsilon/2$$. Then we can split $$[0,1]$$ into $$[0,\frac{1}{n_0}]$$ and $$[\frac{1}{n_0},1]$$. Notice that $$[\frac{1}{n_0},1]$$ contains only finitely many $$\frac{1}{n}$$, therefore $$f$$ has only finitely many discontinuous points on $$[\frac{1}{n_0},1]$$. Thus $$f$$ is integrable on $$[\frac{1}{n_0},1]$$(why?). Then we can choose a partition $$P:x_0,x_1,...x_N$$ of $$[\frac{1}{n_0},1]$$ such $$U(P,f)-L(P,f)<\epsilon/2$$.

We consider $$Q=P\cup\{0\}$$. Let $$Q:y_0,...y_{N+1}$$.

Notice that $$y_1=x_0,y_2=x_1,...y_{N+1}=x_N$$.

Thus

$$U(Q,f)-L(Q,f)$$

$$=(M_1-m_1)\Delta y_1+\sum_{i=2}^{N+1}(M_i-m_i)\Delta y_i$$

$$=(M_1-m_1)\Delta y_1+\sum_{i=1}^{N}(M_i-m_i)\Delta x_i$$

$$<(1-0)(\frac{1}{n_0}-0)+U(P,f)-L(P,f)$$

$$=\frac{1}{n_0}+\epsilon/2$$

$$<\epsilon/2+\epsilon/2$$

• I have a few questions: (1) Why does $[\frac{1}{n_0}, 1]$ contain only finitely many $\frac{1}{n}$? (2) For the partition $P$, what is $x_N$? Is this $1$? (3) How did you get the difference of the Darboux sums for $P$ being $< \frac{\epsilon}{2}$? – Viv4660 May 17 '20 at 14:05
• (1): if $\frac{1}{n}\in[\frac{1}{n_0},q]$, then $n<=n_0$ – user743633 May 17 '20 at 15:55
• (2): $x_N$ is 1, since $P$ is defined to be a partition of $[0,1]$ – user743633 May 17 '20 at 15:57
• (3) since $f$ contains only finitely many discontinuous points on $[\frac{1}{n_0},1]$, we have $f$ is integrable on $[\frac{1}{n_0},1]$, therefore, by definition, we can choose a partition $P$ such that $U(P,f)-L(P,f)<\epsilon/2$ (does this answer your question? Do you know how to prove "discontinuous on only finitely many points implies integrability"?) – user743633 May 17 '20 at 15:59