If $Y$ is $\sigma(X)$-measurable, then there is a Borel function $f$ such that $f(X) = Y$ I'm trying to show that $L_2(\Omega, \sigma(X), \mathbb R)$ is equal to $\Lambda$ which is the set containing all random variables in $L_2(\Omega, \mathcal F, \mathbb R)$ that can be written as $f(X)$ for some Borel function $f:\mathbb R \to \mathbb R$. In doing so, I need to show, given $Y \in L_2(\Omega, \sigma(X), \mathbb R)$, there is a Borel function $f:\mathbb R \to \mathbb R$ such that $Y = f(X)$.
I'm stuck at proving the $f$ I construct is measurable. Could you elaborate on how to do so?

Let

*

*$(\Omega, \mathcal F, \mathbb P)$ be a probability space.


*$L_2(\Omega, \mathcal F, \mathbb R)$ the Lebesgue space of square-integrable random variables from $(\Omega, \mathcal F, \mathbb P)$ to $(\mathbb R, \mathcal B(\mathbb R))$.


*$X \in L_2(\Omega, \mathcal F, \mathbb R)$.


*$\Lambda \subseteq L_2(\Omega, \mathcal F, \mathbb R)$ containing all random variables in $L_2(\Omega, \mathcal F, \mathbb R)$ that can be written as $f(X)$ for some Borel function $f:\mathbb R \to \mathbb R$.
Then $$\Lambda = L_2(\Omega, \sigma(X), \mathbb R).$$

My attempt:
It's clear that $\Lambda \subseteq L_2(\Omega, \sigma(X), \mathbb R)$. Let $Y \in L_2(\Omega, \sigma(X), \mathbb R)$. Then we want to prove there is a Borel function $f:\mathbb R \to \mathbb R$ such that $Y = f(X)$.
For $y_1, y_2 \in \mathbb R$ such that $y_1 \neq y_2$, let $A_1 =Y^{-1} (y_1)$ and $A_2 =Y^{-1} (y_2)$. Then $A_1 \cap A_2 = \emptyset$. Because $Y$ is $\sigma(X)$-measurable, then there are Borel sets $B_1, B_2$ such that $A_1 = X^{-1}(B_1)$ and $A_2 = X^{-1} (B_2)$. It follows that $X^{-1}(B_1) \cap X^{-1}(B_2) = X^{-1}(B_1 \cap B_2) =\emptyset$. This means $X(\omega) \notin B_1 \cap B_2$ for all $\omega \in \Omega$. Thus $X(A_1) \subseteq B_1 \setminus (B_1 \cap B_2)$ and $X(A_2) \subseteq B_2 \setminus (B_1 \cap B_2)$. Hence $X(A_1) \cap X(A_2) = \emptyset$. As such, $Y(\omega_1) \neq Y(\omega_2)$ implies $X(\omega_1) \neq X(\omega_2)$.
Now we define the required $f$ by $f(x) = Y(\omega)$ if there is some $\omega \in \Omega$ such that $x = X(\omega)$ and $f(x) = 0$ otherwise. This construction is valid due to above justification. Let's prove that $f$ is Borel.
 A: That result is due to Doob. Note that this is a property about measurable
space $(X,\mathcal{F})$ only and no meausure is involved. Fix a random
variable $X$ and let $\mathcal{G}=\sigma(X)$. Note that $\mathcal{G}=\{X^{-1}(B)\mid B\in\mathcal{B}(\mathbb{R})\}$.
We go to show that for any $\mathcal{G}$-measurable random variable
$Y:\Omega\rightarrow\mathbb{R}$, there exists a Borel function $f:\mathbb{R}\rightarrow\mathbb{R}$
such that $Y=f\circ X$.
Case 1: $Y=1_{A}$ for some $A\in\mathcal{G}$. In this case, there
exists $B\in\mathcal{B}(\mathbb{R})$ such that $A=X^{-1}(B)$. For
any $\omega\in\Omega$, $1_{A}(\omega)=1$ iff $\omega\in A$ iff
$X(\omega)\in B$ iff $1_{B}(X(\omega))=1$. Hence, $1_{A}=1_{B}\circ X$.
Note that $1_{B}$ is a Borel function.
Case 2: $Y$ is a $\mathcal{G}$-measurable simple functions. In this
case, $Y=\sum_{i=1}^{n}\alpha_{i}1_{A_{i}}$ for some $\alpha_{i}\in\mathbb{R}$
and $A_{i}\in\mathcal{G}$. For each $i$, choose a Borel function
$f_{i}$ such that $1_{A_{i}}=f_{i}\circ X$. Observe that $Y=\sum_{i=1}^{n}\alpha_{i}f_{i}\circ X=f\circ X$,
where $f=\sum_{i=1}^{n}\alpha_{i}f_{i}$ is a $\mathbb{R}$-valued
Borel function.
Case 3: $Y:\Omega\rightarrow[0,\infty]$ is a non-negative $\mathcal{G}$-measurable
function. In this case, we can choose a sequence of $\mathcal{G}$-measurable
random variables $(Y_{n})$ such that $0\leq Y_{1}\leq Y_{2}\leq\ldots\leq Y$
and $Y_{n}(\omega)\rightarrow Y(\omega)$ for each $\omega\in\Omega$.
For each $n$, choose a Borel function $f_{n}:\mathbb{R}\rightarrow\mathbb{R}$
such that $Y_{n}=f_{n}\circ X$. Define $f=\limsup_{n}$. Note that
$f$ is a $[-\infty,\infty]$-value Borel function (recall that limsup
always exists). Let $\omega\in\Omega$. We have that $Y(\omega)=\lim_{n}Y_{n}(\omega)=\lim_{n}f_{n}(X(\omega))=f(X(\omega))$.
Hence, $Y=f\circ X$. Note that if $Y$ is $[0,\infty)$-valued, $f$
can be choosen $[0,\infty)$-valued. For, define $A=f^{-1}\left([0,\infty)\right)$,
which is a Borel set. Define $g:\mathbb{R}\rightarrow[0,\infty)$
by $g(x)=f(x)1_{A}(x)$. Clearly $g$ is also a Borel function. Let
$\omega\in\Omega$, then from $Y(\omega)=f(X(\omega))$ and the fact
that $Y(\omega)\in[0,\infty)$, we conclude that $X(\omega)\in A$.
Therefore, $g(X(\omega))=f(X(\omega))$. Hence, $Y(\omega)=g(X(\omega))$,
i.e., $Y=g\circ X$.
Case 4: $Y:\Omega\rightarrow\mathbb{R}$ is a $\mathcal{G}$-measurable
function. Write $Y=Y^{+}-Y^{-}$, where $Y^{+}=\max(Y,0)$ and $Y^{-}=\max(-Y,0)$.
Choose Borel functions $f_{1},f_{2}:\mathbb{R}\rightarrow[0,\infty)$
such that $Y^{+}=f_{1}\circ X$ and $Y^{-}=f_{2}\circ X$. Define
$f=f_{1}-f_{2}$, which is a Borel function. Let $\omega\in\Omega$,
then we have $Y(\omega)=Y^{+}(\omega)-Y^{-}(\omega)=f_{1}(X(\omega))-f_{2}(X(\omega))=f(X(\omega))$.
Hence, $Y=f\circ X$.
