This is the definition which we need for the theorem: (source)
11.19 $\; \;$ Definition $\; \;$Let $s$ be a real-valued function defined on $X$. If the range of $s$ is finite, we say that $s$ is a simple function.
$\quad \quad$ Let $E \subset X$, and put $$ K_{E}(x)= \begin{cases}1 & (x \in E), \\ 0 & (x \notin E).\end{cases} $$
$K_{E}$ is called the characteristic function of $E$.
$\quad \quad$ Suppose the range of $s$ consists of the distinct numbers $c_{1}, \ldots, c_{n}$. Let $$ E_{i}=\left\{x \mid s(x)=c_{i}\right\} \quad(i=1, \ldots, n) . $$ $\quad \quad$ Then $$ s=\sum_{n=1}^{n} c_{l} K_{E_{1}}, $$
that is, every simple function is a finite linear combination of characteristic functions. It is clear that $s$ is measurable if and only if the sets $E_{1}, \ldots, E_{n}$ are measurable.
$ \quad \quad$ It is of interest that every function can be approximated by simple functions:
Here is the theorem: (source)
11.20 $\; \;$ Theorem $\; \;$ Let $f$ be a real function on $X$. There exists a sequence $\left\{s_{n}\right\}$ of simple functions such that $s_{n}(x) \rightarrow f(x)$ as $n \rightarrow \infty$, for every $x \in X$. If $f$ is measurable, $\left\{s_{n}\right\}$ may be chosen to be a sequence of measurable functions. If $f \geq 0,\left\{s_{n}\right\}$ may be chosen to be a monotonically increasing sequence.
$\quad$Proof $\; \;$ If $f \geq 0$, define $$ E_{n i}=\left\{x \mid \frac{i-1}{2^{n}} \leq f(x)<\frac{i}{2^{n}}\right\}, \quad F_{n}=\{x \mid f(x) \geq n\} $$ for $n=1,2,3, \ldots, i=1,2, \ldots, n 2^{n}$. Put $$ s_{n}=\sum_{i=1}^{n 2^{n}} \frac{i-1}{2^{n}} K_{E_{n l}}+n K_{F_{n}} . \quad \quad (50)$$ In the general case, let $f=f^{+}-f^{-}$, and apply the preceding construction to $f^{+}$and to $f^{-}$.
$\quad$ It may be noted that the sequence $\left\{s_{n}\right\}$ given by $(50)$ converges uniformly to $f$ if $f$ is bounded.
I couldn't understand that why does the sequence {$s_n$}, given by $(50)$ converge to $f$ .
Any help would be appreciated.
$\lim_{n \to \infty} s_n(x)=f(x)$:
Suppose $f$ is $\mathbb{R}_{\geq 0}$-valued.
Let $x \in X$. Since $f(x) \in \mathbb{R}_{\geq 0}$, there is a positive integer $M$ so that $0 \leq f(x) <M$. This means we will have \begin{aligned}s_{M}(x)=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}(x)+M K_{F_{M}}(x)&=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}(x)+M \cdot0\\&=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}(x). \end{aligned} Now we may repeat the proceeding corresponding argument for uniform convergence in the case that $f$ is bounded to similarly conclude that $\lim_{n \to \infty} |s_n(x)-f(x)|=\lim_{n \to \infty} \frac{1}{2^n}=0$.
$f$ bounded $\implies$ $s_n \to f$ uniformly:
Suppose $f$ is bounded. This means there is a positive integer $M$ so that $0 \leq f(x) <M$ (assuming $f$ nonnegative to spare some headache).
Notice we have \begin{aligned}s_{M}=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}+M K_{F_{M}}=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}+M \cdot0=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}. \end{aligned} So if $n \geq M$ and $x \in X$, then we have \begin{aligned}|s_{n}(x)-f(x)|&=\left|\sum_{i=1}^{n 2^{n}} \frac{i-1}{2^{n}} K_{E_{n i}}(x)-f(x)\right| \\&=\left|\sum_{i=1}^{n 2^{n}} \frac{i-1}{2^{n}} K_{E_{n i}}(x)-\sum_{i=1}^{n 2^{n}}f(x)K_{E_{n i}}(x)\right| \\&=\left|\sum_{i=1}^{n 2^{n}} \left(\frac{i-1}{2^{n}}-f(x)\right) K_{E_{n i}}(x)\right| \\&=\sum_{i=1}^{n2^{n}}\left( f(x) -\frac{i-1}{2^{n}}\right)K_{E_{n i}}(x) \quad \quad \left(f(x) -\frac{i-1}{n} < 0 \implies K_{E_{n i}}(x)=0 \right) \\&< \sum_{i=1}^{n 2^{n}} \frac{1}{2^n}K_{E_{n i}}(x) \\&=\frac{1}{2^n}\sum_{i=1}^{n 2^{n}} K_{E_{n i}}(x) \\&=\frac{1}{2^n}. \end{aligned}
Let $\varepsilon > 0$ be given.
By the Archimedean Principle, there is a positive integer $L$ so that $L\varepsilon>1$. Consider $N=\max\{M,L\}$. So if $n \geq N$, then we have $$\sup_{x \in X} \left|s_n(x)-f(x) \right|< \varepsilon.$$