Lebesgue measurable simple function and its Borel measurable counterpart Q) Suppose that $f$ is a simple Lebesgue measurable function on $R^n$. Show that
there exists a Borel measurable function $g$ such that $f(x) = g(x)$ for almost every $x \in R^n$.
I know that a simple Lebesgue measurable function takes finitely many values on Lebesgue measurable sets. But I'm not sure how I can find an appropriate Borel measurable function $g$, i.e. function wherein the pre-image of every open set is Borel measurable, which is the same as $f$ except atmost on a countable set?
 A: The problem boils down to: For each Lebesgue measurable set $A$,
there exists a Borel set $B$ such that $m(A\Delta B)=0$. For simplicity, I demonstrate the proof for the case $n=1$.
Proof: Let $A$ be Lebesgue measurable. Firstly, consider the case
that $m(A)<\infty$. For each $n$, there exists an open set $U_{n}$
such that $A\subseteq U_{n}$ and $m(U_{n})-m(A)<\frac{1}{n}$. Define
$B=\cap_{n}U_{n}$, which is a Borel set (Actually, we can say more:
it is a $G_{\delta}$-set. However, we do not need this fact.) Clealry
$A\subseteq B$. Moreover $B\setminus A\subseteq U_{n}\setminus A$
implies that $m(B\setminus A)\leq m(U_{n}\setminus A)=m(U_{n})-m(A)<\frac{1}{n}$.
Since $n$ is arbitrary, we have $m(B\setminus A)=0$. Next, we drop
the assumption that $m(A)<\infty$. For each $n\in\mathbb{Z}$, let
$A_{n}=A\cap(n,n+1]$. For each $n$, choose a Borel set $B_{n}$ such
that $A_{n}\subseteq B_{n}$ and $m(B_{n}\setminus A_{n})=0$. Let
$B=\cup_{n}B_{n}$, which is a Borel set. Clearly $A\subseteq B$.
Moreover, $B\setminus A=\cup_{n}(B_{n}\setminus A)\subseteq\cup_{n}(B_{n}\setminus A_{n})$,
so $m(B\setminus A)=0$.
A: Here is a proof for arbitrary Lebesgue measurable $f$. As the other answer shows, $A=F\cup N$ for some Borel set $F$ and a null set $N$. Let $U\in \tau_{\mathbb R}.$ Then the fact that $f$ is Lebesgue measurable implies that $f^{-1}(U)=V$ is Lebesgue measurable and so has the form $F\cup N$, as above.
Let $\{I_n\}_{n\in \mathbb N}$ be an enumeration of the collection of intervals with rational endpoints, which form a base for $\tau_{\mathbb R}.$
Then, there are Borel sets $\{F_n\}_{n\in \mathbb N}$ and null sets $\{N_n\}_{n\in \mathbb N}$ such that $f^{-1}(I_n)= F_n\cup N_n.$ Furthermore, $U=\bigcup^\infty_{k=1}I_{n_k}$ for some subsequence. Then, $f^{-1}(I_{n_k})=F_{n_k}\cup N_{n_k}.$
Define $g:\mathbb R^n\to \mathbb R$ by $g(x)=f(x)$ if $x\in F_n$ for some $n$  and $g(x)=0$ otherwise. Then, $g$ agrees with $f$ except perhaps on $\bigcup_n N_n$, which is null. And $g^{-1}(U)=g^{-1}(\bigcup^\infty_{k=1}I_{n_k})=\bigcup^\infty_{k=1}F_{n_k}\cup g^{-1}(\{0\}),$ which is a Borel set. It follows that $g$ is Borel measurable.
Remark: if you know that $\mathscr B(\mathbb R)$ is generated by the intervals $\{(-\infty, r):r\in \mathbb Q\}$, then you can show that it suffices to prove the claim for these intervals only. Then the proof is much easier: For each $r\in \mathbb Q,$ choose a Borel set $B_r\subseteq f^{-1}((-\infty,r))$ such that $f^{-1}((-\infty,r))=B_r\cup N_r$ for some null set $N_r$. Now define $g(x)=f(x)$ if $x\in B_r$ for some $r$ and $0$ otherwise. Then, $g^{-1}((-\infty,r))=B_r\cup g^{-1}(\{0\}).$
