Rudin chapter 2 problem 14 Let $f$ be a real-valued Lebesgue measurable function on $\mathbb{R}$. Prove that there exist Borel functions $g$ and $h$ such that $g(x)=h(x)$ almost everywhere and $g(x)\le f(x)\le h(x)$ for every $x\in \mathbb{R}$.
My Solution:
I tried it as if $B\in \mathbb{B}(\mathbb{R})$ (where $\mathbb{B}(\mathbb{R})$ is Borel $\sigma - $algebra on $\mathbb{R}$) then $f^{-1}(B)=A\cup N_1$ where $A\in \mathbb{B}(\mathbb{R})$ and $\mu(N_1)=0$. Now i defined $g^{-1}(B)=A=h^{-1}(B)$.
now i am not able to understand what to do next like how to show $g(x)=h(x)$ almost everywhere and $g(x)\le f(x)\le h(x)$ for every $x\in \mathbb{R}$.
 A: I would suggest another approach. Some hints: recall that every Lebesgue measurable positive function can be approximated by a (monotone) sequence of simple functions, and that every Lebesgue measurable set can be approximated by a Borel set.
To be a bit more precise (although not yet complete):
Without loss of generality, we assume that $f$ is non negative (otherwise, exploit the decomposition $f=f^{+}-f^{-}$); furthermore I for simplicity suppose that $f$ is bounded, say by $N \in \mathbb{N}$.  Consider the pre-image sets:
$$A^{i}_n=\{ x \in \mathbb{R} : \frac{i}{2^n} \le f(x) \le \frac{i+1}{2^n}  \}$$
These sets are Lebesgue measurable, hence for every $n \in \mathbb{N}$ and every $i=0 \dots N2^n-1$, there exist Borel sets $E^{i}_n$ and $F^{i}_n$ such that $E^{i}_n \subseteq A^{i}_n \subseteq F^{i}_n$ and $\mathcal{L}(F^{i}_n \setminus E^{i}_n)=0$.
Next define two sequences of simple functions $(h_n(x))_n$ and $(g_n(x))_n$ in the following way:
$$ g_n(x)=\sum_{i=0}^{N2^n-1} \frac{i}{2^n} \chi_{E^{i}_n} \qquad h_n(x)=\sum_{i=0}^{N2^n-1} \frac{i+1}{2^n} \chi_{F^{i}_n}.  $$
Note that $h_n,g_n$ are Borel measurable for every $n$ since they are linear combination of characteristic functions of Borel sets. Finally, set:
$$h(x)=\lim_{n \rightarrow +\infty} h_n(x) \qquad g(x)=\lim_{n \rightarrow +\infty} g_n(x); $$
$h(x)$ and $g(x)$ are Borel measurable since they are pointwise limit of Borel functions. It remains to prove that such limits actually exist for every $x$ (or, as suggested in comments, use the $\limsup$ instead), that the required inequality is satisfied and that $h$ and $g$ coincide a.e.
A: $\mathbf (\mathbf I \mathbf) \\ \\ \\$
Assume $f = \alpha \cdot {\chi}_{E}$ , where $E$ is lebesgue measurable set and $\alpha \geq 0$.
$$\exists A, B \space (A : F_{\sigma}) \wedge (B : G_{\delta}), \space (A \subset E \subset B), \space \mu(B \setminus A) = 0.$$
i.e A and B are countable unions and intersections of closed and open sets respectively with stated properties.
Set $g := \alpha \cdot {\chi}_{A}$ and $h := \alpha \cdot {\chi}_{B}$.
From the properties of characteristic functions it follows that:
$$\begin{align} & 1. \space g \leq f \leq h. \\
                & 2. \space (g(x) \ne f(x)) \vee (h(x) \ne f(x)) \implies x \in B\setminus A \end{align} \tag{1}\label{eq1}$$
As $\mu(B \setminus A) = 0,$
$$g(x) = f(x) = h(x), \space a.e. \tag{2}\label{eq2}$$
as $A, B \in \mathscr B(\Re^m), \space g, h \in \mathcal M(\mathscr B(\Re^m))$
$\mathbf (\mathbf I \mathbf I \mathbf) \\ \\ \\$
Now suppose f is a simple function, i.e. $f = \sum\limits_{k =1}^{n} \alpha_k \cdot {\chi}_{E_{k}}$, where 
$$ \begin {align} & 1. \space E_{k} \in L(\Re^m). \\ 
                  & 2. \space \alpha_k \geq 0. \\
                  & 3. \space E_j \cap E_m = \phi \iff j \ne m. \end{align} \\ \\ \\ \\ $$
For each $1 \le k \le n$,
 $$\exists A_k, B_k \space (A_k : F_{\sigma}) \wedge (B : G_{\delta}), \space (A_k \subset E_k \subset B_k), \space \mu(B_k \setminus A_k) = 0.$$
For each $1 \le k \le n$,
Set $g_k := \alpha_k \cdot {\chi}_{A_k}$ and $h_k := \alpha_k \cdot {\chi}_{B_k}. \space g_k, h_k \in \mathcal M(\mathscr B(\Re^m))$.
From $\mathbf (\mathbf I \mathbf)$, we have
$$\begin{align} & g_k \leq \alpha_k \cdot {\chi}_{A_k} \leq h_k. \tag{3}\label{eq3} \\
                & (g_k(x) \ne \alpha_k \cdot {\chi}_{A_k}(x)) \vee (h_k(x) \ne \alpha_k \cdot {\chi}_{A_k}(x)) \implies x \in B_k\setminus A_k \tag{4}\label{eq4} \end{align}$$
From $\eqref {eq3}$, we have:
$$\sum\limits_{k =1}^{n} g_k \leq \sum\limits_{k =1}^{n} \alpha_k \cdot {\chi}_{A_k} \leq \sum\limits_{k =1}^{n} h_k \tag{5}\label{eq5}$$
Set $g := \sum \limits_{k =1}^{n} g_k$ and $h := \sum\limits_{k =1}^{n} h_k$, then $g, h \in \mathcal M(\mathscr B(\Re^m))$ and from $\eqref{eq5}$, we have:
$$ g \leq f \leq h$$
Now
$$\begin{align} & (g(x) \ne f(x)) \vee (h(x) \ne f(x)) \implies x \in \bigcup \limits_{k = 1}^{n} B_k\setminus A_k \\
                & {\mu (\bigcup \limits_{k = 1}^{n} B_k\setminus A_k)} = \sum \limits_{k = 1}^{n} \mu (B_k\setminus A_k) = 0. \\
\therefore \space & g(x) = f(x) = h(x), \space a.e. \end{align}$$
$\mathbf (\mathbf I \mathbf I \mathbf I \mathbf) \\ \\ \\$
Suppose
$$\begin {align} &1. f : \Re^m \rightarrow [0, \infty]. \\
                 &2. f \in L(\Re^m). \end {align}$$
Then
$$\begin {align} & 1. \space \exists s_1 \le s_2 \le \ldots \le f \\
                 & 2. \space s_k \text { is simple.} \\
                 & 3. \space s_k \in \mathcal M(\mathscr L(\Re^m)). \\
                 & 4. \space \forall x, \lim_{k \to \infty} s_k(x) = f(x) \end {align}$$
Let
$$ s_k = \sum \limits_{k = 1}^{n} \alpha_{(n, k)} \cdot {\chi}_{E_{(n, k)}}$$
From $\mathbf (\mathbf I \mathbf I \mathbf I \mathbf) \\ \\ \\$
$$\begin{align} & \space \forall k, (\exists g_k, h_k \in
                                     \mathcal M(\mathscr B(\Re^m)),
                                    (\forall x, 
                                     g_k(x) \le s_k(x) \le h_k(x))) \\
                & \space \forall k, g_k(x) = s_k(x) = h_k(x), a.e. \end{align}$$
Put $g := \sup_{k} g_k$ and $h := \sup_{k} h_k$. Then $g, h \in \mathcal M(
                                                            \mathscr B(\Re^m))$ and
$$g \leq f \leq h.$$
Let $A_k := \{x \in \Re^m \space | (g_k(x) \ne s_k(x)) \vee (h_k(x) \ne s_k(x)\}$.
$$\mu(A_k) = 0.$$
Put $A := \bigcup_{k = 1}^{\infty} A_k$. Then
$$\begin{align} \space \mu(A) & = \mu (\bigcup_{k = 1}^{\infty} A_k) \\
                              & = \sum_{k = 1}^{\infty} \mu(A_k) \\
                              & = 0. \end{align} \tag{6}\label{eq6}$$
Now we have:
$$\begin{align} \space & x \in \Re^m \setminus A \\
              \implies & x \in \Re^m \setminus (\bigcup_{k = 1}^{\infty} A_k) \\
              \implies & x \in \bigcap_{k = 1}^{\infty} (\Re^m \setminus A_k) \\
              \implies & \forall k, \lnot{((g_k(x) \ne s_k(x)) \vee (h_k(x) \ne 
                                           s_k(x))} \\
              \implies & \forall k, g_k(x) = s_k(x) = h_k(x) \\
              \implies & g(x) = f(x) = h(x) \end{align} \tag{7}\label{eq7}$$
From $\eqref{eq6}$ and $\eqref{eq7}$,
$$g(x) = f(x) = h(x), a.e.$$
$\mathbf (\mathbf I \mathbf V \mathbf) \\ \\ \\$
Let $f \in \mathcal M(\mathscr L(\Re^m))$, then
$$\begin{align} & 1. \space f = f^+ - f^-. \\
  & 2. f^+ : \Re^m \rightarrow [0, \infty]. \\
  & 3. f^- : \Re^m \rightarrow [0, \infty]. \\
  & 4. f^+, f^- \in \mathcal M(\mathscr L(\Re^m)) \\ \end{align}$$
From $\mathbf (\mathbf I \mathbf I \mathbf I \mathbf)$
$$\begin{align} & 1. \space \exists g^+, h^+ \in \mathcal M(\mathscr B(\Re^m))
                            (\forall x, \ g^+(x) \le f^+(x) \le h^+(x))
                             \text{ and } g^+ = f^+ = h^+ a.e.\\
 & 2. \space \exists g^-, h^- \in \mathcal M(\mathscr B(\Re^m))
                            (\forall x, \ g^-(x) \le f^-(x) \le h^-(x))
                             \text{ and } g^- = f^- = h^- a.e.\end{align}$$
Put $g = g^+ - h^-$ and $h = h^+ - g^-$. Then
$$(\forall x, \ g(x) \le f(x) \le h(x)) \text{ and } g = f = h a.e.$$
