Counterexample for a non-measurable function? I am struggling to solve an exercise in my measure theory book and any help for solving it would be appreciated:
Let $(\Omega,\mathcal{A},\mu)$ be a measure space and let $f:\Omega  \to \mathbb{R}$ be measurable. Find a function $g:\Omega  \to \mathbb{R}$ which is equal to $f$ almost everywhere but is not measurable.
 A: Two cases:


*

*There is a set $N$ contained in a measurable set of zero measure which is not measurable. 
In this case, take $g:=f+\mathbf 1_{N}$, where $\mathbf 1_N$ is the indicator function of $N$. It's not a measurable function, because otherwise so would be $\mathbf 1_{N}$.

*Each set contained in a measurable set of zero measure is an element of $\mathcal A$ (the measure space is called complete). 
In this case, there is no such function $g$. Indeed, assume that $f$ is a measurable function and that $g\colon\Omega \to\mathbb R$ is such that $f(x)=g(x)$ for almost every $x$. We shall show that $g$ is $\mathcal A$-measurable. 
The set $D=\left\{x\in\Omega\mid f(x)\neq g(x)    \right\}$ is contained in a set of measure zero hence is measurable. Since 
$$g(x)=f(x)\mathbf 1_{\Omega\setminus D}(x) +g(x)\mathbf 1_D (x),$$
it suffices show that the function $h\colon x\mapsto  g(x)\mathbf 1_D (x)$ is $\mathcal A$ measurable. To this aim, let $A_t :=\left\{x\in\Omega\mid h(x)\lt t     \right\}$. If $t\leqslant 0$, then $A_t\subset  D$ hence $A_t$ is contained in a set of measure zero and is $\mathcal A$-measurable. If $t\gt 0$ then $A_t=\left(\Omega\setminus D\right) \cup\left(D\cap \left\{x\in\Omega\mid g(x)\lt t     \right\}\right)$, which is the union of two measurable sets (the second one because it is contained in $D$ hence contained in a set of zero measure). 
