Let $X$ be a continuous non-negative random variable (i.e. $R_x$ has only non-negative values). Prove that $$E(X) = \int_{0}^{\infty} P(X>x)\,dx = \int_{0}^{\infty} (1-F_X(x))\,dx$$ where $F_X(x)$ is the CDF for $X$. Using this result, find $E(X)$ for an exponential ($\lambda$) random variable.

I know that by definition, $F_X(x) = P(X \leq x)$ and so $1 - F_X(x) = P(X>x)$

The solution is: $$\int_{0}^{\infty} \int_{x}^{\infty} f(y)\,dy dx = \int_{0}^{\infty} \int_{0}^{y} f(y)\,dy dx = \int_{0}^{\infty} yf(y) dy.$$

I'm really confused as to where the double integral came from. I'm also rusty on multivariate calc, so I'm confused about the swapping of $x$ and $\infty$ to $0$ and $y$.

Any help would be greatly appreciated!


4 Answers 4


Observe that for a continuous random variable, (well absolutely continuous to be rigorous):

$$\mathsf P(X> x) = \int_x^\infty f_X(y)\operatorname d y$$

Then taking the definite integral (if we can):

$$\int_0^\infty \mathsf P(X> x)\operatorname d x = \int_0^\infty \int_x^\infty f_X(y)\operatorname d y\operatorname d x$$

To swap the order of integration we use Tonelli's Theorem, since a probability density is strictly non-negative.

Observe that we are integrating over the domain where $0< x< \infty$ and $x< y< \infty$, which is to say $0<y<\infty$ and $0< x < y$.

$$\begin{align}\int_0^\infty \mathsf P(X> x)\operatorname d x = & ~ \iint_{0< x< y< \infty} f_X(y)\operatorname d (x,y) \\[1ex] = & ~ \int_0^\infty \int_0^y f_X(y)\operatorname d x\operatorname d y\end{align}$$

Then since $\int_0^y f_X(y)\operatorname d x = f_X(y) \int_0^y 1\operatorname d x = y~f_X(y)$ we have:

$$\begin{align}\int_0^\infty \mathsf P(X> x)\operatorname d x = & ~ \int_0^\infty y ~ f_X(y)\operatorname d y \\[1ex] = & ~ \mathsf E(X \mid X\geq 0)~\mathsf P(X\geq 0) \\[1ex] = & ~ \mathsf E(X) & \textsf{when $X$ is strictly positive} \end{align}$$

$\mathcal {QED}$

  • $\begingroup$ Ah, thanks for explaining it! Now I know where the double integral came from. Quick question, do I still have to somehow use this result to find E(X) for an Exponential random variable? $\endgroup$
    – Nikitau
    Mar 10, 2016 at 1:45
  • 1
    $\begingroup$ @TFSM You do not have to, but which is easier: $$\begin{align}\int_0^\infty x~f_X(x)~\operatorname d x = & ~ \int_0^\infty x \lambda e^{-\lambda x}\operatorname d x \\ \int_0^\infty 1-F_X(x)\operatorname d x = & ~ \int_0^\infty e^{-\lambda x}\operatorname d x\end{align}$$ $\endgroup$ Mar 10, 2016 at 3:53


Since $1 - F_X(x) = P(X\geq x) = \int_x^\infty f_X(t) \,\mathrm{d}t$,

$$ \int_0^\infty \left( 1 - F_X(x) \right) \,\mathrm{d}x = \int_0^\infty P(X\geq x) \,\mathrm{d}x = \int_0^\infty \int_x^\infty f_X(t) \,\mathrm{d}t \mathrm{d}x $$

Then change the order of integration:

$$ = \int_0^\infty \int_0^t f_X(t) \,\mathrm{d}x \mathrm{d}t = \int_0^\infty \left[xf_X(t)\right]_0^t \,\mathrm{d}t = \int_0^\infty t f_X(t) \,\mathrm{d}t $$

Recognizing that $t$ is a dummy variable, or taking the simple substitution $t=x$ and $\mathrm{d}t = \mathrm{d}x$,

$$ = \int_0^\infty x f_X(x) \,\mathrm{d}x = \mathrm{E}(X) $$

  • $\begingroup$ OH I think I understand now! Correct me if I'm wrong, but the first integral was to change the CDF into a PDF. The second integral then involved the definition of $P(X \geq x)$ $\endgroup$
    – Nikitau
    Mar 10, 2016 at 3:31
  • $\begingroup$ Y es, you are right. $\endgroup$
    – alexjo
    Mar 10, 2016 at 3:49

First note that \begin{align} P\{X>x\}&=E(1_{X>x})\\ &=\int_0^{\infty}1_{y>x}f(y)dy \end{align} Therefore \begin{align} \int_0^{\infty}P\{X>x\}dx&=\int_0^{\infty}\int_0^{\infty}1_{y>x}f(y)dydx\\ &=\int_0^{\infty}\int_0^{\infty}1_{y>x}f(y)dxdy\\ &=\int_0^{\infty}yf(y)dy\\ \end{align}


The proof is incorrect as stated, but can be easily fixed. If $X$ is absolutely continuous with density $f$, that means that $F_X(x) = \int_{-\infty}^x f(t)\,dt$ for all $x$. The integral showed up in the proof because the prover assumed that $X$ is absolutely continuous with density $f$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.