TITLE: Expected value of a non-negative random variable
QUESTION [9 upvotes]: How do I prove that $\int_0^\infty Pr(Y\geq y) dy = E[Y]$ if $Y$ is a non-negative random variable?

REPLY [16 votes]: 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}$