Let $X$, $Y$ $:\Omega \rightarrow R$ be random variables and $\sigma(X)$ be the $\sigma$ algebra generated by $X$. Then $Y$ is $\sigma(X)$-measurable, then $Y=g(X)$ for some Borel measurable function $g:R\rightarrow R$.
I know how to prove when $Y$ is simple functions, but I have a problem generalizing the results.
$Y$ can be approximated by a sequence of simple functions point wisely, say $Y=\lim Y_n$. There exists a $g_n$ for each $Y_n$ such that $Y_n=g_n(X)$, define
$$ g(x):= \begin{cases}\lim _{n \rightarrow \infty} g_n(x) & \text { if } x \in A, \\ 0 & \text { if } x \notin A,\end{cases} $$
where $A$ is the set when the limit exist. The measurability of $g$ can be found here. @MISC { URL = {https://math.stackexchange.com/q/4980754} }
But I have a problem showing $Y=g(X)$