Explicitly representing a random variable in terms of indicator functions Motivation:


*

*I want to compute $$E[g(X)] := \int_{\Omega} g(X(\omega)) d\mathbb{P}(\omega) \tag{*}$$ without needing change of variable formula.

*I want to prove the change of variable formula (you know the one I don't want to use for #1) without 'standard machine' (indicator, simple, nonnegative, integrable).
That is, prove $$(*) = \int_{\mathbb{R}} g(x) d\mathcal{L}_X(x)$$
possibly by writing
$$g(X) = \int_{\mathbb R} g(x) 1_{\{x = X(\omega)\}}(\omega) dx$$

We are given $(\Omega, \mathscr F, \mathbb P)$, $n \in \mathbb N$, $i = 1, \dots, n$ and $A_i \in \mathscr F$.
Bernoulli: Let $X_i \sim Be(p)$ where  and $p = \mathbb P (A_i)$.
Binomial: Let $X = \sum_i X_i \sim Binom(n,p)$ where $n \in \mathbb N$.
Thus, we can write the random variables explicitly in terms of indicator functions $X_i = 1_{A_i}$ and $X = \sum_i 1_{A_i}$.
Is there a way to do this for any random variable? Given the definition of Lebesgue integration, I think we can though we would have to use $\lim$, $\sup$, $\sum$, $X^+, X^-$, etc. Here's what I tried:
Discrete Uniform: Let $DU_i \sim Unif\{1,\cdots,6\}$. Can we write $DU=\sum_{d=1}^{6} d1_d dd$?
Continuous Uniform: Let $CU_i \sim Unif(0,1)$. Can we write $CU=\int_0^1 c 1_c dc$?
Normal: Let $Z \sim N(0,1)$. Can we write $Z = \int_{\mathbb R} z1_z dz$ ?
How about $$Z = \int_{\mathbb R} z \lim_n \frac{\sum_{i=1}^{n} 1_{A_i} - np}{\sqrt{np(1-p)}} dz$$ ?
I'm guessing that while $$\frac{\sum_i 1_{A_i} - np}{\sqrt{np(1-p)}} \nrightarrow Z$$, $$\frac{\sum_i 1_{A_i} - np}{\sqrt{np(1-p)}} \to 1_z$$
I guess we need some filtration $\{\mathscr F_0\} \cup \{\mathscr F_n\}_{n \in \mathbb N}$ and possibly $\mathscr F_{\infty} := \sigma(\mathscr F_0 \cup \bigcup_{n \in \mathbb N} \mathscr F_n)$
Any: $Y = \int_{\mathbb R} y1_y dy$ ?
I guess there may be some integrability issue such as if $X \sim Cantor$. I guess there may be some integrability issue such as if $X \sim Cantor$. I recall $\mathscr L_X(B) = P(X \in B)$ is a probability measure on $(\mathbb R, \mathscr B)$, but I'm not sure how that would resolve any integrability issue.
Perhaps $Y = \int_{\mathbb R} y1_y d\mu(x)$, but I'm not sure what the measurable space would be.

Found this in class notes:
For any $X$, $g_n(X) = \min\{n, \frac{[[2^ng(x)]]}{2^n}\}$ is simple, nondecreasing and $\to X$.
Then
$$X = X^+-X^-$$
$$X^+ = \lim_n \min\{n, \frac{[[2^nx^+]]}{2^n}\}$$
$$\min\{n, \frac{[[2^nx^+]]}{2^n}\} = n*1_{n \le \frac{[[2^nx^+]]}{2^n}} + \frac{[[2^nx^+]]}{2^n}* 1_{n \ge \frac{[[2^nx^+]]}{2^n}}$$
I guess that counts?
 A: $\newcommand{\ep}{\epsilon}
\newcommand{\R}{\mathbb{R}}
\newcommand{\E}{\operatorname{\mathsf E}} 
\newcommand{\PP}{\operatorname{\mathsf P}}$ 
For any random variable (r.v.) $X$, you can write $X=X_+-X_-$, where $X_+:=\max(0,X)$ and $X_-:=\max(0,-X)$. Then you can write 
$$X_+=\int_0^\infty I\{X>x\}dx,\quad X_-=\int_0^\infty I\{-X>x\}dx,$$
and hence
\begin{equation}
 X=\int_0^\infty (I\{X>x\}-I\{-X>x\})dx,\tag{1}
\end{equation}
where $I\{\cdot\}$ is the indicator function.  
Addition in response to the editing of the post: 
Suppose that $g\colon\R\to\R$ is a Borel-measurable function such that $\E g(X)$ exists. By (1),
\begin{equation}
 g(X)=\int_0^\infty (I\{g(X)>u\}-I\{-g(X)>u\})du. \tag{2}
\end{equation}
So, introducing the distribution (law) $\mu_X=\PP X^{-1}$ of $X$, by the Fubini theorem we have 
\begin{align*}
 \E g(X)&=\int_0^\infty (\E I\{g(X)>u\}-\E I\{-g(X)>u\})du \\ 
 &=\int_0^\infty (\PP\{g(X)>u\}-\PP\{-g(X)>u\})du \\ 
 &=\int_0^\infty [\mu_X(\{x\in\R\colon g(x)>u\})-\mu_X(\{x\in\R\colon -g(x)>u\})]du \\ 
 &=\int_0^\infty du \Big(\int_\R\mu_X(dx)(I\{g(x)>u\}-I\{-g(x)>u\})\Big) \\ 
 &=\int_\R\mu_X(dx)\int_0^\infty du\, (I\{g(x)>u\}-I\{-g(x)>u\}) \\ 
 &=\int_\R\mu_X(dx)g(x), 
\end{align*}
which is what you wanted, I hope. 
