Expected value of a non-negative random variable [duplicate]
Solution 1:
Assuming we have a continuous random variable with an existant probability density function $f_Y$.
$\begin{align} \int_0^\infty \Pr(Y \geqslant y) \operatorname d y & = \int_0^\infty \int_y^\infty f_Y(z)\operatorname d z\operatorname d y \\[1ex] & = \int_0^\infty \int_0^z f_Y(z)\operatorname d y\operatorname d z \\[1ex] & = \int_0^\infty f_Y(z)\int_0^z 1\operatorname d y\;\operatorname d z \\[1ex] & = \int_0^\infty z f_Y(z)\operatorname d z \\[1ex] & = \mathsf E[Y] \end{align}$
Solution 2:
This proof assumes a background in measure theory.
Let $1_{Y\ge y}$ the indicator function for the set $\{Y\ge y\}$. Then $$ \int_0^\infty P(Y\ge y)\,dy = \int_0^\infty \int 1_{Y\ge y}\,dP\,dy=\int\int_0^\infty1_{Y\ge y}\,dy\,dP=\int Y\,dP=E[Y] $$ The middle equality follows from the Fubini-Tonelli theorem. The third equality follows since $Y\ge0$, so the function $1_{Y\ge y}$ is $1$ on the interval $[0,Y]$, and $0$ elsewhere, so its integral over the real line is $Y$.