# Find expected value using CDF

I'm trying to solve the following problem:

Let $$X$$ have the CDF $$F(x) = 1 - x^{-\alpha}, x\ge1$$.
Find $$E(X)$$ for those values of $$\alpha$$ for which $$E(X)$$ exists.

How can I determine which values of $$\alpha$$ exist? What do I do with the CDF?

There are formulas for finding the expected value when you have a frequency function or density function. Wikipedia says the CDF of $$X$$ can be defined in terms of the probability density function $$f$$ as follows:

$$F(x) = \int_{-\infty}^x f(t)\,dt$$

This is as far as I got. Where do I go from here?

• Note that the distribution $F(x) = 1 - x^{-\alpha}, x\ge1$ for $\alpha \in (0,2)$ is often said to have a fat tail. The distribution has a finite mean only for $\color{blue}{\alpha >1}$, as obtained in this answer, and finite variance only for $\alpha>2$; see also power law distributions.
– Amir
Commented May 10 at 13:52
• Commented May 10 at 18:44

Note that $$F(1)=0$$ in this case so the distribution has probability $$0$$ of being less than $$1$$, so $$x \ge 1$$, and you will also need $$\alpha > 0$$ for an increasing cdf.

If you have the cdf then you want the anti-integral or derivative which with a continuous distribution is like this:

$$f(x) = \frac{dF(x)}{dx}$$

and in reverse $$F(x) = \int_{1}^x f(t)\,dt$$ for $$x \ge 1$$.

Then to find the expectation you need to find

$$E[X] = \int_{1}^{\infty} x f(x)\,dx$$

providing that this exists. I will leave the calculus to you.

• @henry - $F(1)=1-1^{-\alpha}=1-1=0$, so support can't be below 1 (as CDF is a non-decreasing function) Commented Apr 30, 2011 at 6:59
• @probabilityislogic: You may be correct in terms of the book. I will change my response. Commented Apr 30, 2011 at 9:49
• Thanks for the response. What does f(x) represent? The probability density function? Is the derivative of the cdf always f(x)? Commented Apr 30, 2011 at 20:23
• $f(x)$ is indeed supposed to be the probability density function. If the cdf has a derivative then it is the density, though there are distributions (for example discrete) where the cdf does not have a derivative everywhere Commented Apr 30, 2011 at 20:24
• @styfle: If it exists then $E[X^2] = \int_{1}^{\infty} x^2 f(x)\,dx$, and similarly for the expectations of other functions of $x$. Commented Apr 30, 2011 at 22:08

# Usage of the density function is not necessary

## Integrate 1 minus the CDF

When you have a random variable $X$ that has a support that is non-negative (that is, the variable has nonzero density/probability for only positive values), you can use the following property:

$$E(X) = \int_0^\infty \left( 1 - F_X(x) \right) \,\mathrm{d}x$$

A similar property applies in the case of a discrete random variable.

## Proof

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)$$

I used the Formulas for special cases section of the Expected value article on Wikipedia to refresh my memory on the proof. That section also contains proofs for the discrete random variable case and also for the case that no density function exists.

• +1 great result: the integral of the cdf is really simple, moreover, it is wise to avoid derivatives, whenever we can (they are not as well behaved as integrals ;)). Additional: using the cdf to calculate the variance see here math.stackexchange.com/questions/1415366/… Commented May 30, 2017 at 21:46
• When you change the order of integration, how do you get the integration limits?
– Zaz
Commented Oct 1, 2017 at 16:40
• The standard proof does not assume that $X$ has a density. Commented Sep 27, 2018 at 23:19
• @Zaz we set the integration limits so that the same part of (t, x) space is covered. The original constraints are x >0 and t > x. We can't have the outer limits depend on the inner variable, but we can define the same region as t > 0 and 0 < x < t. Good examples of this process here: mathinsight.org/… Commented Oct 7, 2019 at 21:16
• how is that $\int_0^t f_X(t)\,\mathrm{d}x = xf_X(t)\Big|_0^t$?
– Kuo
Commented Feb 23 at 4:53

The result extends to the $k$th moment of $X$ as well. Here is a graphical representation:

– Kuo
Commented Oct 8, 2023 at 18:35
• I love this result. I would really appreciate a citation so that I can use it in some of my formal work. Commented May 14 at 14:51

I think you actually mean $x\geq 1$, otherwise the CDF is vacuous, as $F(1)=1-1^{-\alpha}=1-1=0$.

What you "know" about CDFs is that they eventually approach zero as the argument $x$ decreases without bound and eventually approach one as $x \to \infty$. They are also non-decreasing, so this means $0\leq F(y)\leq F(x)\leq 1$ for all $y\leq x$.

So if we plug in the CDF we get:

$$0\leq 1-x^{-\alpha}\leq 1\implies 1\geq \frac{1}{x^{\alpha}}\geq 0\implies x^{\alpha}\geq 1 > 0\implies x\geq 1 \>.$$

From this we conclude that the support for $x$ is $x\geq 1$. Now we also require $\lim_{x\to\infty} F(x)=1$ which implies that $\alpha>0$

To work out what values the expectation exists, we require:

$$\newcommand{\rd}{\mathrm{d}}E(X)=\int_{1}^{\infty}x\frac{\rd F(x)}{\rd x}\rd x=\alpha\int_{1}^{\infty}x^{-\alpha} \rd x$$

And this last expression shows that for $E(X)$ to exist, we must have $-\alpha<-1$, which in turn implies $\alpha>1$. This can easily be extended to determine the values of $\alpha$ for which the $r$'th raw moment $E(X^{r})$ exists.

• (+1) Particularly for the sharp-eyed recognition that the given support was incorrect. Commented Apr 30, 2011 at 14:00
• Thanks for the response. I fixed the question. I meant to put x>=1. How did you know to first differentiate the cdf to get the density function? Commented Apr 30, 2011 at 20:37
• @styfle - because that's what a PDF is, whenever the CDF is continuous and differentiable. You can see this by looking at how you have defined your CDF. Differentiating an integral just gives you the integrand when the upper limit is the subject of the differentiation. Commented May 1, 2011 at 1:00
• @styfle - the PDF can also be seen as the probability that a RV lies in an infinitesimal interval. $Pr(x<X<x+dx)=F(x+dx)-F(x)\to \frac{dF(x)}{dx}dx=f(x)dx$ as $dx\to 0$. This way holds more generally, even for discrete RV and RV without a density (the limit is just something other than a derivative) Commented May 1, 2011 at 1:04
• +1 because this post actually answers the question!
– whuber
Commented Mar 23, 2022 at 13:25

The Answer requiring change of order is unnecessarily ugly. Here's a more elegant 2 line proof.

$$\int udv = uv - \int vdu$$

Now take $$du = dx$$ and $$v = 1- F(x)$$

\begin{align} \int_{0}^{\infty} [ 1- F(x)] dx &= [x(1-F(x))]_{0}^{\infty} + \int_{0}^{\infty} x f(x)dx \\ &= 0 + \int_{0}^{\infty} x f(x)dx \\ &= \mathbb{E}[X] \qquad \blacksquare \end{align}

• I think you mean to let du-dx so that u=x. Commented Aug 30, 2019 at 19:20
• With your proof, we need to assume that $\lim _{x \rightarrow \infty} x(1 - F(x)) = 0$. Does it make sense to assume that for any continuous cdf F ? Commented Jun 11, 2023 at 8:42
• @Eryna otherwise the expectation wouldn't exist i guess? Commented Feb 29 at 19:30
• It does not work for distributions with fat tails when $\alpha \in (0,1].$ You may see this MSE post for more details.
– Amir
Commented May 10 at 11:59

In case when a conditional expectation using only CDF is needed, we can formulate two cases,

$$\mathbb{E}\left(x|x\geq y\right)=y+\frac{\int_{y}^{\infty}\left(1-F(x)\right)dx}{\left(1-F(y)\right)}$$

$$\mathbb{E}\left(x|x\leq y\right)=y-\frac{\int_{-\infty}^{y}F(x)dx}{F(y)}$$

The derivation leverages on previous post such that we first define following integral, $$\int_{y}^{\infty} [ 1- F(x)] dx = [x(1-F(x)) ]_{y}^{\infty} + \int_{y}^{\infty} x f(x)dx$$

$$\int_{y}^{\infty} x f(x)dx=\mathbb{E}\left(x|x\geq y\right)(1-F(y))$$

Then using this definition and some algebra we arrive at first result. The second result can be obtained in the same way.

• The first formula is not fully correct. Although it holds when $F$ is continuous at $y,$ if it has a jump at $y$ then the amount of that jump needs to be subtracted from the denominator.
– whuber
Commented Mar 22, 2022 at 18:53
• Thank you very much @whuber for pointing that out. I solely, thought of a continuous one and did numerical experiments based on that. Commented Mar 22, 2022 at 23:55

Alternative derivation of $$EX = \int_0^\infty \left(1-F_X(x)\right)\mathrm d x$$ (for a positive r.v. $$X$$):

For any $$x \ge 0$$ one has that $$x=\int_0^x 1 \mathrm dt = \int_0^\infty \mathbf I_{t\le x}\mathrm dt$$, where $$\mathbf I$$ is the indicator function. Let $$x=X$$, take expectations on both sides, and use Fubini's theorem to exchange the integrals to obtain $$EX = \int_0^\infty P(X\ge t)\mathrm dt$$.