I'm learning about Measure Theory (specifically measurable functions) and need help with the following problem:
Let $f : E \rightarrow \mathbb{R}$. Show that if $|f|$ is measurable on $E$ and the set $\{f > 0\}$ is measurable, then $f$ is measurable on $E$.
What I don't understand is that the implication $$|f| \ \text{measurable} \implies f \ \text{measurable} \ \ (1)$$ is clearly false.
For example, let $A$ be a non-measurable subset of $\mathbb{R}$, and let $f$ be the function $$f(x) = \begin{cases} 1\text{ if }x\in A,\\ -1\text{ if }x\notin A.\end{cases}$$
Then $f$ is not measurable ($f^{-1}[\{1\}] = A$) but $|f|$ is measurable (it's the constant function $1$).
How does the additional condition that $\{f > 0\}$ is measurable makes the implication $(1)$ true and how do I prove it?
Ok, I make my comment an answer. I assume that you know that product and sum of two measurable functions is again measurable. Define $f_+ := \max\{f,0\} = |f|\cdot\chi_{\{f>0\}}$. This function is measurable. Also, define $f_- := \min\{f,0\} = (-|f|)\cdot\chi_{\{f\le 0\}}$. Also this function is measurable. So, $f = f_+ + f_-$ is measurable.
EDIT: To see that $\chi_A$ is measurable for each measurable set $A$, you only have to realize that $\chi_A^{-1}(B)$ can only be equal to $\emptyset$, the whole measurable space $E$, $A$ or $E\setminus A$ (depending on whether $0\in B$ or $1\in B$).