(Doob-Dynkin Theorem) Sigma algebra generated by a function Let $(X,F)$ a measurable space. Let $f\in M(X,F)$. Consider the sigma algebra generated by a function $\sigma(f):={f^{-1}(B):B\in \textit{B}(\mathbb{R})}$, where $\textit{B}(\mathbb{R})$ denotes the Borel sigma algebra. 
Show that if $\phi\in M(X,\sigma(f))$, then exists a borel measurable function $g:\mathbb{R}\longrightarrow \mathbb{R}$ such that $\phi =g\circ f$.
I don't know how to start. I thought that a good idea could be to prove it for simple measurable functions, but I can figure out how to do it.
I'll appreciate any suggestions, thanks.
 A: The idea to deal with simple functions is good. 
Assume that $\phi$ is the characteristic function of an element of $\sigma(f)$, say $A$. Then we choose $g$ as the characteristic function of $f^{-1}(A)$. If $\phi$ is a linear combination with non-negative coefficients of such sets, the idea is the same. If $\phi$ is non-negative, then there is a sequence $(\phi_k)$ of simple non-negative functions such that $\phi_k(x)\uparrow \phi(x)$ for all $x$. For each $\phi_k$, there is a function $g_k$ such that $\phi_k=g_k\circ f$. Furthermore, the sequence $(g_k)_k$ is non-decreasing, hence it converges to a function $g$ (that why we dealt with the case $\phi$ non-negative separately). 
This is Doob-Dynkin's theorem. 
A: Let $\phi$ is the limit of a sequence of simple functions $\phi_k$ which you already expressed as $\phi_k = g_k \circ f$ for some Borel measurable $g_k: \mathbb R \to \mathbb R$.
If $g_k$ converges everywhere on $\mathbb R$, then we are done (by letting $g := \lim g_k$), but sadly we only know that $g_k$ converges on $f(X)$.
If $f(X)$ is measurable, then we are done, but there is no guarantee that $f(X)$ is always measurable.
But fortunately, there is a measurable $E$ such that $f(X) \subset E$ and that $g_k$ converges on $E$. Can you define $E$ to complete the proof?
