# Find expected value using CDF

I'm going to start out by saying this is a homework problem straight out of the book. I have spent a couple hours looking up how to find expected values, and have determined I understand nothing.

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.

I have no idea how to even start this. How can I determine which values of $$\alpha$$ exist? I also don't know what to do with the CDF (I'm assuming this means Cumulative Distribution Function). 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?

EDIT: I meant to put $$x\ge1$$.

Edited for the comment from probabilityislogic

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 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) Apr 30, 2011 at 6:59
• @probabilityislogic: You may be correct in terms of the book. I will change my response. 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)? 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 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$. 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/… May 30, 2017 at 21:46
• When you change the order of integration, how do you get the integration limits?
– Zaz
Oct 1, 2017 at 16:40
• The standard proof does not assume that $X$ has a density. 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/… Oct 7, 2019 at 21:16

The result extends to the $k$th moment of $X$ as well. Here is a graphical representation: – Kuo
Oct 8 at 18:35

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. 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? 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. 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) May 1, 2011 at 1:04
• +1 because this post actually answers the question!
– whuber
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)$$

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

• I think you mean to let du-dx so that u=x. 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 ? Jun 11 at 8:42

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
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. Mar 22, 2022 at 23:55