composition of Lebesgue measurable functions is not Lebesgue mesurable Let $f,g:\mathbb{R}\longrightarrow \mathbb{R}$ be Lebesgue measurable. If $f$ is Borel measurable, then $f\circ g$ is Lebesgue mesuarable. In general, $f\circ g$ is not necessarily Lebesgue measurable. Is there any counterexample?
 A: Recall that a function $f$ is Lebesgue (reps. Borel measurable) if $f^{-1}(B)$ is a Lebesgue (resp. Borel measurable) set whenever $B$ is a Borel set.
Observe from $(f\circ g)^{-1}(B)=g^{-1}\circ f^{-1}(B)$, if $f$ is not Borel measurable, then we cannot ensure $f^{-1}(B)$ is Borel, and hence the statement is false in general.
From above, it remains to show that we can find a function such that $f^{-1}(B)$ is not Borel even $B$ is so. The Cantor function always do a good job in finding the counter-examples.
Let $f:[0,1]\longrightarrow[0,1]$ be the standard Cantor function, define from $f$ that $$g(x)=\inf\{y\in[0,1]:f(x)=y\}$$
$g$ is increasing, one-to-one and map $[0,1]$ onto the Cantor set $C$, the preimage of any Borel set under $g$ is again Borel.
Pick $E$ to be a Lebesgue non-measurable set in $R$, standard example is constructed by Vitalli. $F=g(E)\subset C$ is measurable by completeness of Lebesgue measure, and Cantor set is of measure zero. $F$ is the desired non-Borel-measurable set, as if $F$ is Borel measurable, then $E=g^{-1}(F)$ is Borel measurable by above consideration, but it's abusrd from our assumption that $E$ is not Lebesgue measurable.
A: Let $g:\mathbb R\to \mathbb R$ be any Borel function with the following property: there exists a Lebesgue-measurable set $B$ such that $g^{-1}(B)$ is not Lebesgue-measurable. Such functions do exist (see below).
Now take $f:=\mathbf 1_{B}$. Then $f$ is Lebesgue-measurable because $B$ is, but $f\circ g=\mathbf 1_{g^{-1}(B)}$ is not Lebesgue-measurable.
Existence of the function $g$. Take any one-to-one Borel function $g:\mathbb R\to\mathbb R$such that $g^{-1}(C)$ does not have measure $0$, where $C$ is the usual Cantor ternary set. There exist even continuous functions with this property (see e.g. the link given by FisiaiLusia). If you don't require continuity, just take a one-to-one Borel function $g_0$ such that $g_0(\mathbb R) =C$. Let us show that $g$ has the required property.
Since $g^{-1}(C)$ does not have measure $0$, it contains a set $A$ which is not Lebesgue-measurable. (If you take $g=g_0$, you just need to know that there exists at least one non-measurable set in $\mathbb R$). Set $B:=g(A)$. Then $B$ is Lebesgue-measurable because it is contained in the measure $0$ set $C$; and $A=g^{-1}(B)$ because $g$ is one-to-one. So $g^{-1}(B)$ is indeed non-measurable.
