# Expectation of a random variable in terms of its distribution function

Here is a theorem on expectation of a random variable in terms of its distribution function

Theroem: Let $X$ be a (continuous or discrete) non-negative random variable with distribution function $F$. Then, $E(|X|) < \infty$ if and only if $\displaystyle \int_0^\infty 1-F(x)dx <\infty$, and in that case, $$E(X) = \displaystyle \int_0^\infty1-F(x)dx$$.

Then, a corollary of the Theorem is given as:

Corollary: For any random variable $X$, $E(|X|) <\infty$ if and only if the integrals $\displaystyle \int_0^\infty 1-F(x)dx$ and $\displaystyle \int_{-\infty}^0 F(x)dx$ both converge, and in that case $$E(X) = \displaystyle \int_0^\infty 1-F(x)dx - \displaystyle \int_{-\infty}^0 F(x)dx$$

I understand the Theorem, but I do not see how the Corollary follows from the Theorem. I understand the first claim of the Corollary, but I do not see why $$E(X) = \displaystyle \int_0^\infty 1-F(x)dx - \displaystyle \int_{-\infty}^0 F(x)dx \tag{1}$$ holds in that case.

I have that:

$$E(|X|) = \displaystyle \int_0^\infty P\{|X| > x\}dx \\ = \displaystyle \int_0^\infty P\{X > x\} + \displaystyle \int_0^\infty P\{X < -x\}dx \\ = \displaystyle \int_0^\infty P\{X > x\} - \displaystyle \int_0^\infty P\{X < x\}dx \tag{2}$$, but then I could not conclude (1) since the integrand in the second integral of the last line in (2) is $P\{X < x\}$, which is equal to $F(x)$ if X is a continuous random variable, but not equal to $F(x)$ if X is discrete variable.

What am I missing?

• Even though this post is slightly different and d.k.o.already made this link under his answer post, I’d still like to link it to the current choice of mother post. Also see the meta post for (abstract) duplicates. – Lee David Chung Lin Nov 13 '18 at 13:41

$$\mathbb{E}X=\mathbb{E}X^+-\mathbb{E}X^-=\mathbb{E}[X\vee 0]-\mathbb{E}[-X\vee 0]$$ $$=\int_0^\infty\mathbb{P}\{X>x\}dx-\int_{0}^\infty\mathbb{P}\{-X\ge x\}dx$$
• In your second integrand, you also have the strict inequality, but I need the less than or equal to since the distribution functino $F(x) = P\{X \leq x\}$ – mononono Jul 4 '15 at 22:01