Given $f(x) = n(-1)^{n+1}$ if $\frac{1}{n+1}\lt x \lt \frac{1}{n}$ and $f(x)= 0$ if $x=0$ on $[0,1]$
I need to show that for any real number $r$, there is a sequence $(E_n)$ of mutually disjoint measurable sets in $[0,1]$ such that $\bigcup_{n=1}^{\infty} E_n = [0,1]$ and that $\sum_{n=1}^{\infty}\int_{E_n} f(x)\,\mathrm{d}x = r$.
The only set I can think of is $E_n = [1/(n+1), 1/n]$ but I don't see how I can get that to be any $r$. Thanks
This question is actually an application of the Riemann series theorem, which says that if a series $\sum_{n=1}^{\infty}a_n$ is conditionally convergent (meaning it converges but does not converge absolutely, then the series can be rearranged to be equal to any real number you want. We have $$\int_{E_n}f(x)dx = \left(\frac{1}{n} - \frac{1}{n + 1}\right)n(-1)^{n+1} = \frac{(-1)^{n+1}}{n + 1},$$ thus $$\sum_{n=1}^{\infty}\int_{E_n}f(x)dx = \sum_{n=2}^{\infty}\frac{(-1)^n}{n}.$$ The above series is conditionally convergent.