How to show that a measurable function on $R^d$ can be approximated by step functions? In Stein's Book: Real Analysis, Theorem 4.3 says that any measurable function $f$ on $R^d$ can be approximated by step functions. But the proof provided there only show that when $f=\chi_E$, with $m(E)<+\infty$ can be approximated by step function $\psi_k$ (a.e.).
How to complete the argument? 
 A: Here's another approach.

*

*Let $E$ be a measurable set, and $\epsilon>0$. Then there exists a step function $\psi$ s.t. $m\left(\big\{\,x\,\big\vert\,\psi(x)\neq\chi_E(x)\big\}\right)\le\epsilon$.

*Let $\phi$ be a simple function and $\epsilon>0$. Then there exists a step function $\psi$ s.t. $m\left(\big\{\,x\,\big\vert\,\psi(x)\neq\phi(x)\big\}\right)\le\epsilon$.

*Let $(f_n)$ and $(g_n)$ be two sequences of functions such that $f_n\to f$ as $n\to\infty$, and $\sum_{n=1}^\infty m_*\big(\big\{\,x\,\big\vert\,g_n(x)\neq f_n(x)\,\}\big)<+\infty$. Then $g_n\to g$ a.e. (Hint: it's easier if you apply the Borel–Cantelli lemma in Stein, RA, Chapter 1, Exercise 16)

*Note that $f$ could be pointwise approximated by simple functions, then apply 2,3.

A: I would like to share my answer, it is a litter long, and I will just guide the proof:

step 1: For $f=\chi_E$, with $m(E)<\infty$, see Stein's Book Thm4.3: there exist step function $\phi_k\to\chi_E$ a.e. in $R^d$;
step 2:. For general simple function $\psi=\sum_{l=1}^n a_l\chi_{E_{l}}(x)$ (note that by definition $m(E_l)<\infty$, $\forall l$), there exists step function $\phi_{k}$, such that $\phi_{k}\to\psi$ a.e. in $R^d$;
step 3: By Stein's book Thm4.2, for measurable function $f$ on $R^d$, there exists simple function $\psi_k\to f$ point-wise in $R^d$. Thus, by step 2. there exist step function $ \phi_{k,j}\to\psi_k$, $\forall k$. For each $k$, we can select a cubic $Q_k$ centered at the origin with length of side k.  We see that $\phi_{k,j}\chi_{Q_k}\to\psi_k$,$\forall k$, so we can replace $\phi_{k,j}$ by $\phi_{k,j}\chi_{Q_k}$.
step 4: Apply Egorov's Thm on $Q_k$ to select $J(k)$, such that $$|\psi_k-\phi_{k,J(k)}|<\frac{1}{k},\quad\forall x\in A_k.$$
  where $A_k$ is contained in the union of $ Q_k \text{and }\cup_{l=1}^{\infty} E_l$ with $ m(Q_k\cup\cup_{l=1}^{\infty} E_l\backslash A_k)<\frac{1}{2^k}$.
step 5: Let $E=\limsup_{k=1}^\infty ((Q_k\cup\cup_{l=1}^{\infty} E_l\backslash A_k)$, prove that $m(E)=0$, and $\phi_{k,J(k)}\to f$ a.e. in $E^c$.

A: I am just reading this part, and Google sent me here.
This is what I guess to be closer to Stein's intention.
Use Theorem 4.2 (that there is a sequence of simple functions that pointwise $\to f$) to find
$$
\phi_k(x) = \sum _{l=1} ^{L_k} \alpha _{k,l} \mathbf{1} _{E_{k,l}}
$$
Here, $E_{k,l}$ measurable, and $\phi_k \to f$ pointwise.
By Thm.3.4 (iv), there are disjoint $Q_{k,l,s}$ so that
$$
m \big( E_{k,l} \Delta (\cup _{s=1} ^{S_{k,l}} Q_{k,l,s}) \big)
\leq 2^{-k} \epsilon L_k^{-1}
$$
Define
$$
\psi_k
=\sum_{l=1} ^{L_k} \alpha _{k,l} \sum _{s=1} ^{S_{k,l}} \mathbf{1} _{Q_{k,l,s}}
$$
We see that
$$
\sum_{k=1} ^{\infty} \sum_{l=1} ^{L_k}
m \big( E_{k,l} \Delta (\cup _{s=1} ^{S_{k,l}} Q_{k,l,s}) \big)
\leq \epsilon
$$
by a similar argument for Borel-Cantelli lemma, the set on which convergence fails is a null set:
$$
\cap_{N=1} ^{\infty} \cup_{k=N} ^{\infty} \cup_{k=1} ^{L_k}
m \big( E_{k,l} \Delta (\cup _{s=1} ^{S_{k,l}} Q_{k,l,s}) \big)
\leq \epsilon
$$
