TITLE: $f(X)$ measurable, but $f$ not measurable
QUESTION [6 upvotes]: Let $(\Omega,F,P)$ be a probability space.
Suppose $f\colon \mathbb R\to\mathbb
R$ is some function such that $f(X)$ is measurable for every real valued random variable $X$. I am curious if $f(X)$ is necessarily $\sigma(X)$-measurable. I tried to conclude with Doob-Dynkin lemma but to do we would need $f$ to be $\mathcal{B}(\mathbb R)$ measurable. Does someone has an idea or is this is false in general?

REPLY [2 votes]: To complement the previous answer. Let $\left(\Omega,\mathcal{F},\mathbb{P}\right)=\left(\mathbb{R},2^{\mathbb{R}},\delta_{0}\right)$. Let $f\,:\,\mathbb{R}\longrightarrow \mathbb{R}$ be the indicator of some non-Borel set $S$ and note that $f(X)$ is measurable for any $X$ (as mentioned in Danny's post). Let $X$ be the identity from $\mathbb{R}$ to $\mathbb{R}$, the latter endowed with $\mathcal{B}\left(\mathbb{R}\right)$. Then, $X^{-1}\left(f^{-1}\left(\left\{1\right\}\right)\right)=S\notin \sigma(X)=\mathcal{B}(\mathbb{R})$.