# Calculate $\int_0^1f(x)dx$

Calculate $\int_0^1f(x)dx$,where $$\ f(x) = \left\{ \begin{array}{l l} 0 & \quad \text{if x=0 }\\ n & \quad \text{if x\in(\frac{1}{n+1},\frac{1}{n}]} \end{array} \right.$$

How we can calculate this integral?

Is this simply

$$\int_0^1f(x)dx=\int_{\frac{1}{n+1}}^{\frac{1}{n}}ndx=n\left(\frac{1}{n}-\frac{1}{n+1}\right)=\frac{1}{n+1}$$?

• I think $n$ is intended to run through all positive integers. – Daniel Fischer Oct 21 '14 at 20:54
• If $n$ is fixed, then yes. – Tom Oct 21 '14 at 20:58

$$(0,1]=\bigcup_{n=1}^\infty \left(\frac1{n+1},\frac1n\right]$$ so
$$\int_0^1 f(x)dx=\sum_{n=1}^\infty\int_{1/n+1}^{1/n}ndx=\sum_{n=1}^\infty\frac1{n+1}=\infty$$