If $f$ is a real valued function on $\mathbb{R}$ such that $\{x|f(x)=a\}$ is measurable for each $a\in\mathbb{R}$ then $f$ is measurable?

266 Views Asked by At

Let $E$ be a measurable subset of $\mathbb{R}$ and $f$ be an extended real valued function on $E$. Then $f$ is measurable if $\forall a\in\mathbb{R},\{x\in E|f(x)<a\}$ is measurable.

Is it the case that, if $f$ is a real valued function on $\mathbb{R}$ such that $\{x|f(x)=a\}$ is measurable for each $a\in\mathbb{R}$ then $f$ is measurable? My gut tells me that it is not necessarily the case. I cannot find a counterexample though. Could someone give me a hint? Thanks.

Attempted solution (added later): Consider the non-measurable set $\mathcal{N}$ defined on the interval $[0,1]$ using the "rational-relation". Take $f(x)= \begin{cases} x & \text{if $x\in \mathcal{N}$}\\ x+2 & \text{if $x\in(\mathbb{R}-\mathcal{N})\bigcap [0,1]$}\\ x+100 & \text{if $x>1$}\\ x & \text{if $x<0$} \end{cases}$,

and observe that $f^{-1}((0,1))=\mathcal{N}$ is not measurable.

Is this solution alright?