Riemann integrable function Show that $f(x)$ defined by $f(x)=\frac{1}{n}$, if $\frac{1}{n+1}<x<\frac{1}{n}, n=1,2,3,...$ and $f(0)=0$ is Riemann integrable on $[0,1]$. Also show that $$\int_0^1f(x) dx=\frac{\pi ^2}{6}-1$$
I know that I can use $\displaystyle \sum_{n=1}^\infty\frac{1}{n^2}=\frac{\pi^2}{6} $ to solve this. But I can't get the required form.
 A: $$
\begin{align}
\int_0^1f(x)\,\mathrm{d}x
&=\sum_{k=1}^\infty\int_{\frac1{n+1}}^{\frac1n}f(x)\,\mathrm{d}x\\
&=\sum_{n=1}^\infty\int_{\frac1{n+1}}^{\frac1n}\frac1n\,\mathrm{d}x\\
&=\sum_{n=1}^\infty\frac1n\left(\frac1n-\frac1{n+1}\right)\\
&=\sum_{n=1}^\infty\frac1{n^2}-\sum_{n=1}^\infty\frac1{n(n+1)}\\
&=\frac{\pi^2}{6}-\sum_{n=1}^\infty\left(\frac1n-\frac1{n+1}\right)\\
&=\frac{\pi^2}{6}-1
\end{align}
$$
Note that any sub-partition of $P=\left\{\left[\frac1{n+1},\frac1n\right]\right\}$ yields the same answer (since $f$ is constant on each interval). To reduce this to a finite partition, we only need to notice that on $\left[0,\frac1n\right]$, $|f(0)|\le\frac1n$. Therefore, any finite sub-partition of $P$ contained in $\left[\frac1n,1\right]$ yields the same answer and is within $\frac1{n^2}$ of any sub-partition of $P$ on a larger interval. This shows that $f$ is Riemann integrable.
A: You are asking about
$$\int_0^1 \frac{1}{Floor(\frac{1}{x})}dx$$
I love this problem. I saw this first when I was taking Calc I and now I always give this to my students. Here is a snippets from a detailed writeup I have.
Fact I: The function $f(x)=g(x)$ on the interval [0,1] where
\begin{eqnarray*}
g(x)=\left\{ \begin{array}{ll}
 \frac{1}{n} & \textrm{ for }x \in \left(\frac{1}{n+1},\frac{1}{n}\right] \textrm{ where } n \in \mathbb{N}\\
0 & \textrm{ if } x=0
\end{array}\right.
\end{eqnarray*}
Proof:
At $x=0,\,f(x)=g(x)$ obviously.
Pick any $x\in(0,1]$ and let $n\in \mathbb{N}$ be the number such that $x\in\left(\frac{1}{n+1},\frac{1}{n}\right]$
$\Rightarrow \frac{1}{n+1}<x\leq\frac{1}{n}$
$\Rightarrow n+1>\frac{1}{x}\geq n$
$\Rightarrow Floor(1/x)=n$ by the definition of the floor function
$\Rightarrow \frac{1}{Floor(\frac{1}{x})}=1/n$
$\Rightarrow f(x)=g(x).$
This tells us that at every point $x$ where $x$ is a unit fraction, our function $f(x)$ has a jump discontinuity and everywhere else, $f(x)$ is a constant.
Now for the first part of your problem, the number of jump discontinuities is countable therefore the function is Riemann integrable. But for a formal proof of the level you probably want, you have to use the definition of a Riemann integrable function. Given an arbitrary $\epsilon > 0$ you have to find a partition of  $[0,1]$ such that the difference between the upper sum and the lower sum over that partition of $f(x)$ is less than $\epsilon$.
And then for the last part of your question, just graph the function very carefully and then finding the area under the curve should become very obvious. I suggest you do this part by hand. Using a calculator won't help you much. After getting you started I'll leave both of these parts up to you.
A: To prove the function is Riemann Integrable, you need to check the two conditions
i) boundedness,
ii) the set of discontinuity of the function is countable or more generally, by Lebesgue criteria for Riemann integrability, it has measure zero.   
