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$. 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 &gt; 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 &gt; 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&gt;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$).
You have that

if $b \geq 0, f^{-1}(]b,a[) = (|f|)^{-1}(]b,a[) \cap \{f &gt; 0 \}$, so it's measurable

if $b &lt; 0, f^{-1}(]b,0]) = (|f|)^{-1}([0,-b[ ) \cap \{f &gt; 0 \}^c$, so it's also measurable

This imply that if $a&gt;0, b&lt;0$,  $f^{-1}(]b,a[) = f^{-1}(]0,a[) \cup f^{-1}(]b,0])$ is measurable

if $a &lt; 0, b&lt;a, f^{-1}(]b,a[) = (|f|)^{-1}(]-a,-b[) \cap \{f &gt; 0 \}^c$, so it's also measurable

hence $f^{-1}(]b,a[)$ is measurable for all $a&gt;b$