TITLE: Obtain the value of $\int_0^1f(x) \ dx$, where $f(x) = \begin{cases} \frac {1}{n}, & \frac{1}{n+1}<x\le\frac{1}{n}\\ 0, & x=0 \end{cases}$
QUESTION [4 upvotes]: Is the function Riemann integrable? If yes, obtain the value of $\int_0^1f(x) \ dx$
$f(x) =
\begin{cases}
\frac {1}{n},  & \frac{1}{n+1}<x\le\frac{1}{n}\\
0, & x=0
\end{cases}$

My attempt
$f$ is bounded and monotonically increasing on $[0,1]$. Also, $f$ has infinite discontinuities but only one limit point. Therefore $f$ is Riemann integrable. Now, to calculate the integration
$\int_0^1f(x) \ dx=\int_{1/2}^{1}1 \ dx + \int_{1/3}^{1/2}\frac{1}{2} \ dx + \int_{1/4}^{1/3}\frac{1}{3} \ dx+...$
$=\sum_{n=1}^\infty \frac{1}{n^2}-\frac{1}{n}+\frac{1}{n+1}$
How do I proceed from here? How do I calculate these summations? I know $\sum \frac{1}{n}$ is $\log 2$, but not the other two summations.

REPLY [0 votes]: since $(0,1) = \bigcup_{n=1}^{\infty} ( \frac1{n+1} , \frac1{n })$. (pairwise disjoint union)
$$\int_{0}^1f(x)dx  = \sum_{n=1}^{ \infty} \int_{1/n+1}^{1/n}f(x)dx  =  \sum_{n=1}^{ \infty} \int_{1/n+1}^{1/n}\frac1ndx=\sum_{n=1}^{ \infty}  \frac1{n^2 }-     \frac1{(n+1)n}= \frac{\pi^2}{6}-1
$$ 
Given that $ \frac1{(n+1)n}= \frac1{n}- \frac1{n+1}$ then 
$$\sum_{n=1}^{ \infty} \frac1{(n+1)n}=\sum_{n=1}^{ \infty}  (\frac1{n}- \frac1{n+1})=1$$
{"set_name": "stack_exchange", "score": 4, "question_id": 2396444}