TITLE: Is composition of measurable functions measurable?
QUESTION [48 upvotes]: We know that if $ f: E \to \mathbb{R} $ is a Lebesgue-measurable function and $ g: \mathbb{R} \to \mathbb{R} $ is a continuous function, then $ g \circ f $ is Lebesgue-measurable. Can one replace the continuous function $ g $ by a Lebesgue-measurable function without affecting the validity of the previous result?

REPLY [6 votes]: As an addition to the other answers, I think it is worth noting that in terms of imitating the relation between a topology and a continuous function when thinking of the relation between a $\sigma$-algebra and a measurable function, we can only go so far as having $g$ Borel measurable.
Let $\mathcal{T}$ be the open sets, $\mathcal{B}$ be the Borel sets and $\mathcal{M}$ be the Lebesgue measurable sets of the real line, respectively. Then we have that $\mathcal{T}\subset\mathcal{B}\subset\mathcal{M}$.
We call $f:E\to\mathbb{R}$ continuous if $f^{-1}(\mathcal{T})\subseteq\mathcal{T}$, Borel measurable if $f^{-1}(\mathcal{T})\subseteq\mathcal{B}$ and Lebesgue measurable if $f^{-1}(\mathcal{T})\subseteq\mathcal{M}$, respectively. Accompanying the inclusions of the classes of sets, we have that every continuous function is Borel measurable and every Borel measurable function is Lebesgue measurable.
It turns out that $f$ is Borel iff $f^{-1}(\mathcal{B})\subseteq\mathcal{B}$, which is analogous to the continuous case, but we don't have $f^{-1}(\mathcal{M})\subseteq\mathcal{M}$ in general for Lebesgue measurable functions $f$. The best we can do is that $f$ is Lebesgue measurable iff $f^{-1}(\mathcal{B})\subseteq\mathcal{M}$.
Consequently if $f$ is Lebesgue measurable and $g$ is Borel measurable, then $g\circ f$ is Lebesgue measurable (just like in the continuous case), and if $f,g$ are both Borel measurable then $g\circ f$ is Borel measurable (again, just like in the continuous case), but if both $f,g$ are Lebesgue measurable we can cook up examples where $g\circ g$ is not Lebesgue measurable. (For the sake of completeness, if $g$ is Lebesgue and $f$ is Borel then $g\circ f$ need not be Lebesgue: in the standard example above f is a homeomorphism).