Approximation of a continuous function by piecewise constant function Let $f:(0,1) \to \mathbb{R}$ be continuous and increasing. Define
$$f_n(t) := \sum_{i=0}^{n-1} f(T^n_i)\chi_{(T^n_i, T^n_{i+1})}(t)$$
where $\{T^n_0, T^n_1, ..., T^n_n\}$ is a uniform partition of $(0,1)$ (for each $n$) which is such that in the limit $n \to \infty$ the mesh disappears and the union of the intervals $(T^n_i, T^n_{i+1})$ covers $(0,1)$.
Is it true that $f_n \to f$? In a pointwise or $L^2$ sense, provided $f \in L^2$?
How to prove it?
 A: Let $\alpha_n$ be the width (i.e. maximum subinterval size) of the $n$-th partition, and fix $\varepsilon > 0 $. Consider a compact interval $[a,b]\subset (0,1)$. Since $f$ is continuous in $[a,b]$, it is uniformly continuous, and there is a $\delta>0$ such that for all $x,y\in [a,b]$ with $|x-y|\leq \delta $ we have $|f(x)-f(y)|\leq \varepsilon$. Since $\alpha_n\to 0$, we have $|\alpha_n|\leq \delta$ for all $n\geq n_{\varepsilon}$. This means that 
$$|f(T_n^{i})-f(x)|\leq \varepsilon,\qquad \forall x \in [T_n^i,T_n^{i+1}]\cap [a,b],\forall i=0,\dots,n-1,\;n\geq n_{\varepsilon} $$ 
and therefore
$$\sup_{[a,b]}|f(t)-f_n(t)|\leq \varepsilon,\qquad \forall n\geq n_{\varepsilon}$$
Since $\varepsilon >0$ is arbitrary, we have $f_n\to f$ uniformly in $[a,b]$. Since $[a,b]$ is an arbitrary subinterval of $(0,1)$, we have $f_n(x)\to f(x)$ for all $x\in (0,1)$. Moreover, suppose $f\in L^p(0,1)$ with $p\in [1,\infty)$. Then since $|f_n-f|^p\in L^1$, and $T_n^0\to 0^+,T_n^n\to 1^-$ as $n\to \infty$ (here $[T_n^0,T_n^n]$ forms a compact subinterval of $(0,1)$), by absolute continuity of the Lebesgue integral, 
$$\lim_{n\to \infty}\int_0^1 |f_n-f|^p=\lim_{n\to \infty}\int_{T_n^0}^{T_n^n}|f_n-f|^p\leq \lim_{n\to \infty}\sup_{[T_0^n,T_n^n]}|f_n-f|^p|b_n-a_n|=0 $$
and therefore $f_n \to f$ in $L^p(0,1)$.
