For a nonnegative random variable $X$ with CDF $F$ and $n \geq 1$,
$\begin{align*}\mathbb{E}[X^n] &= \int_{0}^\infty x^n d F(x)\\&= \int_{0}^\infty \left ( \int_{0}^x n y^{n-1} dy \right ) d F(x) \\&= \int_{0}^\infty \int_{y}^\infty ny^{n-1} dF(x) dy\\&= \int_{0}^\infty n y^{n-1}(1 - F(y)) dy\end{align*}$
- I have not seen the notation in the first equality before. All I know is $\mathbb{E}[X^n] = \int_{0}^\infty x^n f_X(x) dx$ but I know the pdf $f_X$ does not necessarily exist. What does $dF(x)$ in the first equality mean?
- How to go from second to third equality? Interchanging the order of integrals should give $\int_{0}^x \int_{0}^\infty$; how to understand the new limits?
- The 4th equality apparently uses the result $1 - F(y) = \int_{y}^\infty dF(x)$ which I don't understand because I don't know what $dF(x)$ means in the first place.