I have the following proof to do:
Let $X:(\Omega,\mathcal{A},P)\to [0,\infty]$ be integrable. Prove the following $$\int X\,dP = \int_{0}^{\infty} P(\{\omega:X(\omega)\geq x\})\,dx$$ where the RHS is an improper Riemann integral.
I am having trouble finding the right approach to this problem.
Hint: write $$ X(\omega)=\int_0^\infty {\bf1}(x\le X(\omega))\,dx $$ Substitute this into $\int X(\omega)\,dP$.