# Show that $E(X)=\int_{0}^{\infty}P(X\ge x)\,dx$ for non-negative random variable $X$

Show that for a non-negative random variable $X$,
$$\mathbb E(X)=\int_0^\infty \mathbb P(X\ge x) \, dx.$$

I started with $$\mathbb E(X)=\int_0^\infty x \, dF(x)=\int_0^\infty \int_0^x dt\,dF(x).$$ This is my try.

• Have you tried using integration by parts? – Reckless Nov 23 '13 at 17:42
• You should include some detail about what you have tried and where you got stuck. If you write down the definition of $E(X)$ and the definition of "non-negative random variable", the problem almost solves itself. – Paul Siegel Nov 23 '13 at 17:43
• @PaulSiegel.i am start with $$E(X)=\int_{0}^{\infty}xdF(x)=\int_{0}^{\infty}\int_{0}^{x}dtdF(x)$$ and this is my try.if it possible for you help me – peter Nov 23 '13 at 17:51
• Whenever you have two integrals, it's very often helpful to try interchanging them (using Fubini's theorem)... – Nate Eldredge Nov 24 '13 at 21:47

## 3 Answers

Integrate the LHS and the RHS of the pointwise identity $$X=\int_0^X\mathrm dx=\int_0^\infty\mathbf 1_{X\geqslant x}\,\mathrm dx.$$ This shows that the desired formula for $E[X]$ holds irrespectively of the hypothesis that $X$ is discrete or continuous or neither discrete nor continuous, as soon as $X\geqslant0$ almost surely, and that two formulas are available, namely, $$E[X]=\int_0^\infty P[X\geqslant x]\,\mathrm dx=\int_0^\infty P[X\gt x]\,\mathrm dx.$$

• For a discrete random variable we need a stronger condition that $X$ be integer-valued. Counter-example: $X=0.1,0.5$ with probability $\frac{1}{2}$. – Sudarsan Nov 24 '13 at 4:21
• @Sudarsan What are you talking about? "Counterexample" to what, exactly? – Did Nov 24 '13 at 9:52
• You're saying "This shows that the desired formula for E[X] holds irrespectively of the hypothesis that X is discrete or continuous ". For that, if the Random variable is just discrete, this formula doesn't hold; it has to be integer valued and positive. – Sudarsan Nov 24 '13 at 18:44
• @Sudarsan Wrong. The formula holds for every random variable X, discrete or continuous, integer valued or not (of course, as soon as X⩾0 almost surely, as mentioned in the answer). – Did Nov 25 '13 at 7:56
• @see Simply the definitions, as always... For example, for every $\omega$, $$X(\omega)=\int_0^{X(\omega)}dx$$ – Did Feb 12 '17 at 15:50

Use integration by parts. Let $f(x)$ denote the probability density of $X$. Define $F(x)=P(X\geq x)=\int_x^\infty f(z)dz$, then $f(x)=-F'(x)$ $$E(x)=\int_0^\infty x f(x) \,dx= -xF(x)\vert_0^\infty+\int_0^\infty F(x)\,dx = \int_0^\infty F(x)\,dx$$

The other way is $$\int_0^\infty P(X\geq x) \,dx=\int_0^\infty \int_x^\infty f(z)\,dz \,dx =\int_0^\infty \int_0^\infty f(z) I\{z\geq x\} \,dz \,dx =\int_0^\infty f(z) \,dz \int_0^\infty I\{z\geq x\} \,dx =\int_0^\infty z f(z) \,dz =E(x)$$ where $I\{z\geq x\}$ is indicator function, i.e. $I\{z\geq x\}=1$ if $z\geq x$; Otherwise, $I\{z\geq x\}=0$.

• No density is needed. – Did Nov 23 '13 at 18:08

If $\Pr(X>0)= 1$ then \begin{align} X & = \int_0^\infty \boldsymbol{1}_{X\,>\,c}(c) \, dc \\ \\ \text{and therefore } \operatorname{E}(X) & = \operatorname{E}\int_0^\infty \boldsymbol{1}_{X\,>\,c} (c) \,dc \\ \\ & = \int_0^\infty \operatorname{E}(\boldsymbol{1}_{X\,>\,c} (c)) \, dc \longleftarrow \text{How is this step justified? See below.} \\ \\ & = \int_0^\infty \Pr(X>c)\,dc. \end{align} To justify the step mentioned above, I would cite Tonelli's theorem, which justifies interchanging the order of integration when the function being integrated is non-negative, regardless of whether the value of the integral is finite.

• Is Tonelli's the same as Fubini's theorem?? – htennek2k Dec 8 '17 at 9:42
• @htennek2k : No, but it's somewhat similar. Fubini's theorem says that if the integral of the absolute value is finite, then the double integral and the two iterated integrals have the same value. Tonelli's theorem says that if the function being integrated is (almost everywhere) nonnegative, then the same conclusion holds, regardless of whether its value is finite. Together they imply that the two iterated integrals can converge to different values only if the integrals of the positive and negative parts are both infinite. $\qquad$ – Michael Hardy Dec 8 '17 at 18:42
• I see. I'm learning Fubini's now, so it came to my mind. Never heard of Tonelli's but sounds cool also. Lots of stuff to learn. Thanks – htennek2k Dec 8 '17 at 23:56