Is it true that if the set $A=\{x:f(x) =c\}$ is measurable for every $c$ in $\Bbb R$, then $f$ is measurable? Let $f: [0;1] \to \Bbb R$. Is it true that if the set $A=\{x:f(x) =c\}$ is measurable for every $c$ in $\Bbb R$, then $f$ is measurable?


I have this counter example
$f(x) =x$ if $x$ belong to $P$, $f(x) =-x$ otherwise, where $P$ is a non measurable set on $[0,1]$.

$A$ is measurable but $f$ is not measurable function. 

I had proved that $f$ is not measurable, but how can I prove that $A$ is measurable and what is $A$ in this example ?
As you think, the answer to the question is no.  However, I am not sure how your example will work.  Maybe it does, but I am unable to show that there exists a measurable set $U$ such that $f^{-1}(U)$ is not measurable in your example.  I had a lapse of intelligence a little bit.  The comments both under the question and under my answer have explained how the OP's function works.  Nonetheless, I have a different counterexample.

Note that there exists (due to the Axiom of Choice) a non-measurable subset $X$ of $\left[0,1\right]$.  This set has the same cardinality as $\left[\dfrac12,1\right]$, so there exists a bijection from $g:X\to \left[\dfrac12,1\right]$.  Note also that $[0,1]\setminus X$ and $\left[0,\dfrac12\right)$ are also equinumerous, so there exists 
a bijective function $h:\big([0,1]\setminus X\big) \to \left[0,\dfrac12\right)$.  

Define $f:[0,1]\to\mathbb{R}$ to be 
$$f(x):=\begin{cases}g(x)&amp;\text{if }x\in X\,,\\h(x)&amp;\text{if }x\in[0,1]\setminus X\,.\end{cases}$$
Note that $f^{-1}\big(\{c\}\big)$ is either empty or a singleton for each $c\in\mathbb{R}$ (it is empty if $c\notin[0,1]$, and is a singleton if $c\in[0,1]$).  However, for the measurable set $M:=\left[\dfrac12,1\right]$, $f^{-1}(M)=X$ is not measurable.  That is, $f$ is not a measurable function.
As you think, the answer to the question is no.  However, I am not sure how your example will work.  Maybe it does, but I am unable to show that there exists a measurable set $U$ such that $f^{-1}(U)$ is not measurable in your example.  I had a lapse of intelligence a little bit.  The comments both under the question and under my answer have explained how the OP's function works.  Nonetheless, I have a different counterexample.

Note that there exists (due to the Axiom of Choice) a non-measurable subset $X$ of $\left[0,1\right]$.  This set has the same cardinality as $\left[\dfrac12,1\right]$, so there exists a bijection from $g:X\to \left[\dfrac12,1\right]$.  Note also that $[0,1]\setminus X$ and $\left[0,\dfrac12\right)$ are also equinumerous, so there exists 
a bijective function $h:\big([0,1]\setminus X\big) \to \left[0,\dfrac12\right)$.  

Define $f:[0,1]\to\mathbb{R}$ to be 
$$f(x):=\begin{cases}g(x)&amp;\text{if }x\in X\,,\\h(x)&amp;\text{if }x\in[0,1]\setminus X\,.\end{cases}$$
Note that $f^{-1}\big(\{c\}\big)$ is either empty or a singleton for each $c\in\mathbb{R}$ (it is empty if $c\notin[0,1]$, and is a singleton if $c\in[0,1]$).  However, for the measurable set $M:=\left[\dfrac12,1\right]$, $f^{-1}(M)=X$ is not measurable.  That is, $f$ is not a measurable function.