Show that $f\in \mathcal{R}[0,1]$ Let $f$ be defined by 
$$f(x) =\left\{\frac{1}{n}, \frac{1}{n+1} \lt x \le \frac{1}{n} \right\}$$ and $f(x) = 0$ when $x=0$ and $n \in N$. Show that $f$ is integrable and $$\int_{0}^{1}f(x)dx=\frac{\pi^2}{6}-1.$$
 A: Let $\epsilon > 0$ be given, and choose $n$ such that $n > \dfrac{1}{\epsilon}$, consider the partition $P = \{0, \frac{1}{n}, \frac{1}{n-1},..., \frac{1}{2}, 1\}$, then:
On $[0,\frac{1}{n}]$, $M - m = \dfrac{1}{n} - 0 = \dfrac{1}{n}$,
On $(\frac{1}{n}, \frac{1}{n-1}]$, $M - m = \dfrac{1}{n-1} - \dfrac{1}{n-1} = 0$,
On $(\frac{1}{n-1}, \frac{1}{n-2}]$, $M - m = \dfrac{1}{n-2} - \dfrac{1}{n-2} = 0$, and
...
On $(\frac{1}{2}, 1]$, $M - m = 1 - 1 = 0$. Thus:
$U(f,P) - L(f,P) = \dfrac{1}{n^2} < \dfrac{1}{n} < \epsilon$, proving $f$ is integrable.
A Riemann sum for $f$ using $M_i$ for each subinterval is: 
$\dfrac{1}{n}\cdot \dfrac{1}{n} + \dfrac{1}{n-1}\cdot \left(\dfrac{1}{n-1} - \dfrac{1}{n}\right) + \dfrac{1}{n-2}\cdot \left(\dfrac{1}{n-2} - \dfrac{1}{n-1}\right) + ... + 1\cdot \left(1 - \dfrac{1}{2}\right) = \displaystyle \sum_{k=1}^n \dfrac{1}{k^2} - 1 + \dfrac{1}{n} \to \dfrac{\pi^2}{6} - 1$, as $n \to \infty$.
A: Hint : 
Suppose it is integrable can you relate that integral (Draw  a picture) to following sum 
$$\frac{1}{2}+(\frac{1}{2}-\frac{1}{3})\cdot \frac{1}{2}+(\frac{1}{3}-\frac{1}{4})\cdot \frac{1}{3}+(\frac{1}{4}-\frac{1}{5})\cdot \frac{1}{4}+\cdots$$
This should immediately give you required result.
