Prove that there exists a Borel measurable function $h: \mathbb R \to \mathbb R$ such that $g= h\circ f$. Problem:
Suppose $f: \mathbb R \to \mathbb R$ is Borel measurable. Define $\mathcal A$ to be the smallest $\sigma$-algebra containing the sets $\{ x : f(x) > a\}$ for every $a \in \mathbb R$. Suppose $g: \mathbb R \to \mathbb R$ is measurable with respect to $\mathcal A$, which means that $\{x : g(x) > a\} \in \mathcal A$ for every $a \in \mathbb R$. Prove that there exists a Borel measurable function $h: \mathbb R \to \mathbb R$ such that $g= h\circ f$.
What I've looked into so far:
I'm thinking $h = g\circ f^{-1}$. This would mean I would need to prove that for any Borel measurable set $B$, we have $h^{-1}(B) = f(g^{-1}(B))\in \mathcal B$. Since $g$ is $\mathcal A$-measurable, $g^{-1}(B) = A\in \mathcal A$. Can we say that since $f$ is Borel measurable, $\{x: f(x) > a\} \in \mathcal B$, and $\mathcal A \subset \mathcal B$? However, I'm not sure what I can say about $f(A)$ besides that I need it to be Borel measurable. 
Should I approach this differently, or am I on the right track?
 A: The problem is that $f$ has in general no inverse which means that the expression $h = g \circ f^{-1}$ is not well-defined.
Usually, the statement is proved using a monotone class argument:


*

*Prove the claim if $g$ is of the form $g=1_A$ where $A \in \mathcal{B}(\mathbb{R})$ is a Borel set. To this end, note that $A \in \mathcal{A}$ (as $g$ is $\mathcal{A}$-measurable) and that any set $A \in \mathcal{A}$ admits a representation of the form $$A = f^{-1}(B)$$ for some Borel set $B$; this follows directly from the definition of the $\sigma$-algebra $\mathcal{A}$: $$\mathcal{A} = \sigma\{\{x; f(x)>a\}; a \in \mathbb{R}\} = \{f^{-1}(B); B \in \mathcal{B}(\mathbb{R})\}.$$

*Prove the claim for a step function $g$.

*Consider $g \geq 0$ measurable. Approximate $g$ by step functions in order to deduce that the claim holds for $g$.

*For arbitrary measurable $g$, write $g=g^+-g^-$ where $g^+$ ($g^-$) denotes the positive (negative) part of $g$. 


The result is known as factorization lemma and is of importance in probability theory.
