Approximating Measurable Functions There are questions with such title on stackexchange, but I am posting this question, since I didn't find solution to my question from other similar questions.
The following is a basic theorem in measurable functions. Any non-negative measurable function $f\colon \mathbb{R}\rightarrow \mathbb{R}$ is a pointwise limit of a monotonic increasing sequence of simple functions.
Many standard books (Stein-Shakarchi/ Royden) gave proof without any geometric motivation or explanation. Further, following Stein-Shakarchi (p.31), the construction is done in three stages, with a sequence of functions in each stage. I failed to understand this constructive proof, by asking myself 'why to consider this' at many stages. 
The proof is almost like an algebraic manipulation. 
I know that Lebesgue's idea is to partition the range of $f$ rather than domain, while studying its integration. So, in the proof of theorem I am talking about, it is the range of $f$ which is partitioned. But, I couldn't get why it is done in this way. I would like to see the idea behind the construction of sequence of simple functions.
 A: The idea is - as you already observed - to partition the range of $f$ to construct the approximation.
If the range of $f$ were bounded, e.g. a subset of $[0,1)$, we could just partition this into $\bigcup_{m=0}^{n-1} [m/n, (m+1)/n)$ for each $n$. If our step function $g_n$ has the value $m/n$ on $f^{-1}([m/n, (m+1)/n))$, then we have $|f(x) - g(x)| \leq 1/n$ and $g_n\leq f$ (this will be needed to get monotonicity later on. If some $g_n$ was larger than $f$, we would have a problem).
The general construction has to overcome three problems:


*

*$f$ could be unbounded.

*$f$ could even attain the value $\infty$

*We want the sequence $g_n$ to be increasing.


To solve the first problem, we increase the part of the range of $f$ on which we approximate with each $n$, i.e. we set
$$
g_n = \sum_{m=0}^{n^2 -1} \frac{m}{n^2} \chi_{f^{-1}([m/n^2, (m+1)/n^2))} + n \cdot \chi_{f^{-1}([n, \infty])},
$$
which ensure $|f(x) -g_n(x)| \leq 1/n$ as long as $f(x) <n$. Note that this is the case for$n$ large if $f(x) < \infty$. Otherwise, the last term in the definition ensures $g_n(x) = n \to \infty$ if $f(x) = \infty$.
The last step is to ensure monotonicity. Often, this is somehow build into the construction, but I prefer to simply take
$$
h_n = \max \{g_1, \dots, g_n\}.
$$
Observe that this is indeed a simple function. We have $h_n \to f$ pointwise, because of $g_n \leq f$ for all $n$.
A: For a non-negative measurable function $f: \Omega \to \mathbb{R}$ we define approximations $f_k:\Omega \to \mathbb{R}$ by
$$f_k(\omega) := \begin{cases} j 2^{-k} & \omega \in \{j 2^{-k} \leq f \leq (j+1)2^{-k}\} \, \text{for some} \, j \in \{0,\ldots, k 2^k-1\} \\ k & \text{otherwise} \end{cases}.$$
This means that for any $\omega \in \Omega$ such that $f(\omega) \leq k$ we choose $j \in \{0,\ldots,k 2^k-1\}$ such that $$f(\omega) \in \bigg[ \frac{j}{2^k}, \frac{j+1}{2^k} \bigg)$$ and set $f_k(\omega) = \frac{j}{2^k}$. In particular, this shows that we approximate $f$ from below. Here is a picture how the approximation $f_k$ of some function $f$ might look like:
$\hspace{65pt}$
Reference: Measures, Integrals and Martingales by René L. Schilling.
