Convergence in $L^2(\mathbb{R}_+)$ I'm struggling with the following question:
Let $f \in L^2(\mathbb{R}_+)$ and let $r > 0$.
Show that $\sum \limits_{n =0 }^{\infty} \frac{1}{r} \int_{[rn, r(n+1))} f(t)dt\textbf{1}_{[rn, r(n+1))}$ converges to $f$ in $L^2(\mathbb{R}_+)$ as $r \to 0^+$. Symbol $\textbf{1}_{[rn, r(n+1))}$ stands for an indicator function on $[rn, r(n+1))$.
I was thinking to start with $f \in C_0(\mathbb{R}_+)$ - continuous functions with compact support which are dense in $L^2(\mathbb{R}_+)$, but I still can't show it.
Thanks for any hints or answers.
 A: It's a good idea to start with $f \in C_0(\mathbb{R}_+)$. So let $f \in C_0(\mathbb{R}_+)$ and
$$\begin{align} f_r(x) &:= \sum_{n \geq 0} \frac{1}{r} \cdot 1_{[r \cdot n, r \cdot (n+1))}(x) \cdot \int_{[r \cdot n, r \cdot (n+1))} f(t) \, dt \end{align}$$
Since $$f(x) = \sum_{n \geq 0} f(x) \cdot 1_{[r \cdot n, r \cdot (n+1))}(x)$$ we have
$$\begin{align} |f_r(x)-f(x)|^2 &= \left| \sum_{n \geq 0} \frac{1}{r} \cdot 1_{[r \cdot n, r \cdot (n+1))}(x) \cdot \int_{[r \cdot n, r \cdot (n+1))} (f(t)-f(x)) \, dt \right|^2 \\ &\stackrel{\ast}{=} \sum_{n \geq 0} 1_{[r \cdot n, r \cdot (n+1))}(x) \cdot \frac{1}{r^2} \cdot \underbrace{\left( \int_{[r \cdot n, r \cdot (n+1))} (f(t)-f(x)) \, dt \right)^2}_{\leq \int_{[r \cdot n, r \cdot (n+1))} (f(t)-f(x))^2 \, dt} \end{align}$$
(for $(\ast)$: Since the intervalls $[r \cdot n, r \cdot (n+1))$ are disjoint, squaring gives a sum (and no double sum).) Note that for fixed $x$ there is exactly one addend in the last equation not equal zero. 
Let $\varepsilon>0$. Since $f$ is uniformly continuous there exists $\delta>0$ such that $$|f(t)-f(x)| \leq \varepsilon$$ for all $|x-t| \leq \delta$. Thus $$\begin{align} \int |f_r(x)-f(x)|^2 \, dx &\leq \int \sum_{n \geq 0} 1_{[r \cdot n, r \cdot (n+1))}(x) \cdot \frac{\varepsilon^2}{r} \, dx \leq \varepsilon^2 \end{align}$$ for $r \leq \delta$.
