[This answer](https://mathoverflow.net/a/295742/501568) says that if $X$ is a random variable and $X\_+ = \mathrm{max}(0, X)$, then $X\_+ = \int\_0^\infty I\_{\{X > x\}}\mathrm{d}x$. I'd like to know how to derive this starting with $A \in \mathcal{S} \implies \int\_S 1\_A\mathrm{d}\mu = \mu(A)$ (from ["Desired Properties"](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/03:_Distributions/3.10:_The_Integral_With_Respect_to_a_Measure)).


My thinking is that for a probability space $(\Omega, F, \mu)$, $\{X > t\} \in F \implies \int\_\Omega I\_{\{X > t\}}\mathrm{d}\mu = \mu(\{X > t\})$ but it's the wrong variable of integration. Am I on the right track?



Random variable as an integral of an indicator function
The layer cake representation of a non-negative measurable function, $X$, is applied in the proof of proposition 2.1 [here](https://stat.uiowa.edu/sites/stat.uiowa.edu/files/cae/Lo_Expectation.pdf).


