Sequence of simple functions nonnegative that converge to measurable function $f$

The sequence as given,

$$s_n = \sum_{k=0}^{2^{2n}} \frac{k}{2^n} \chi_{f^{-1}( [ \frac{k}{2^n}, \frac{k +1}{2^n} ] ) }$$

contains an insidious error. It will not converge pointwise to $f$ if $f$ takes on a value of the form $\frac{k}{2^n}$ at all, and it will not even converge to $f$ almost everywhere if $f$ attains values of that form on a set of positive measure. One must choose half-open intervals. Let

$$E_{n,k} = f^{-1}\left(\left[\frac{k}{2^n}, \frac{k+1}{2^n}\right) \right),$$

and

$$s_n = \sum_{k=0}^{2^{2n}-1}\frac{k}{2^n}\chi_{E_{n,k}}.$$

A small change, but now it works ;)

For every $n \in \mathbb{N}$, the family $\mathscr{E}_n = \{ E_{n,k} : k \in \mathbb{N}\}$ is a partition of the space, since they are preimages of disjoint sets, hence disjoint, and every point lies in some $E_{n,k}$, since the intervals $\left[\frac{k}{2^n},\frac{k+1}{2^n}\right)$ cover the entire range $[0,\infty)$ of $f$.

Let us see that $s_n$ converges monotonically pointwise to $f$. For that, fix an arbitrary $x$ and check how $s_n(x)$ behaves.

First, while $2^n \leqslant f(x)$, we have $s_n(x) = 0$: Since $f(x) \geqslant 2^n$, we have $k_{x,n} = \lfloor 2^n\cdot f(x)\rfloor \geqslant 2^{2n}$, and $x \in E_{n,k_{x,n}}$, but since $k_{x,n} \geqslant 2^{2n}$, the characteristic function of $E_{n,k_{x,n}}$ does not yet appear in $s_n$, so $s_n(x) = 0$.

Once $n$ is so large that $2^n > f(x)$, we have $k_{x,n} = \lfloor 2^n\cdot f(x)\rfloor < 2^{2n}$, and since $x \in E_{n,k_{x,n}}$, we have

$$s_n(x) = \sum_{k=0}^{2^{2n}-1}\frac{k}{2^n}\chi_{E_{n,k}}(x) = \frac{k_{x,n}}{2^n}\chi_{E_{n,k_{x,n}}}(x) = \frac{k_{x,n}}{2^n}$$

since the $E_{n,k}$ are disjoint. Since $k_{x,n} \leqslant 2^n\cdot f(x) < k_{x,n}+1$, we have $s_n(x) = \dfrac{k_{x,n}}{2^n} \leqslant f(x) < \dfrac{k_{x,n}+1}{2^n}$, and hence

$$0 \leqslant f(x) - s_n(x) < \frac{1}{2^n},$$

which shows that $s_n(x) \to f(x)$. To see that $s_{n+1}(x) \geqslant s_n(x)$, note that $k_{x,n} \leqslant 2^n\cdot f(x) < k_{x,n}+1$ implies $2k_{x,n} \leqslant 2^{n+1}\cdot f(x) < 2k_{x,n}+2$, and so we have either $k_{x,n+1} = \lfloor 2^{n+1}\cdot f(x)\rfloor = 2k_{x,n}$ - if $2^{n+1}\cdot f(x) < 2 k_{x,n}+1$ - or $k_{x,n+1} = \lfloor 2^{n+1}\cdot f(x)\rfloor = 2k_{x,n}+1$. In the first case, we have

$$s_{n+1}(x) = \frac{k_{x,n+1}}{2^{n+1}} = \frac{2k_{x,n}}{2^{n+1}} = \frac{k_{x,n}}{2^n} = s_n(x),$$

and in the second, we have

$$s_{n+1}(x) = \frac{k_{x,n+1}}{2^{n+1}} = \frac{2k_{x,n}+1}{2^{n+1}} = \frac{k_{x,n}}{2^n} + \frac{1}{2^{n+1}} = s_n(x) + \frac{1}{2^{n+1}}.$$

In either case, $s_{n+1}(x) \geqslant s_n(x)$, so the sequence $s_n(x)$ is nondecreasing. Since $x$ was arbitrary, the entire sequence of simple functions is nondecreasing, and converges pointwise to $f$ (assuming all values of $f$ are real; if $f$ takes $+\infty$ as a value, we must modify $s_n$ if we want pointwise convergence everywhere, for example by adding $2^n\cdot \chi_{F_n}$ to $s_n$, where $F_n = \{x : f(x) \geqslant 2^n\}$).