# Tail sum for expectation

In Pitman's Probability, the tail sum formula for expectation is introduced for a nonnegative (0,1,...) discrete random variable $X$:

$$E(X) = \sum_{i=0}^\infty P(X > i).$$

1. I wonder if there is a similar formula for nonnegative continuous random variable $X$:

$$E(X) = \int_0^\infty P(X > x) dx?$$

If no, are there some conditions for it to hold? And how can it be proved?

Here is my thought:

If the cdf $F$ of $X$ is bijective, then $X=F^{-1}(U)$ for some random variable $U$ uniformly distributed over $[0,1)$. So $$E(X) = \int_0^1 F^{-1}(u) du.$$

To prove the tail sum formula, it suffices to prove $$\int_0^1 F^{-1}(u) du = \int_0^\infty P(X > x) dx.$$ But I am stuck here.

What's more, is the condition that the cdf $F$ of $X$ is bijective really necessary for tail sum formula to hold?

2. Can tail sum formula be generalized to a random variable that is not necessarily nonnegative?

Thanks!

-
I've seen it written as a Riemann-Stieltjes integral $\int_0^\infty x\;dF(x)$, where $F(x) = \Pr(X \le x)$ is the cumulative distribution function. This works regardless of whether you have a continuous distribution, a discrete distribution, a singular distribution (which is neither continuous nor discrete nor a mixture of the two), or a mixture of any or all of the three kinds. Only for continuous distributions is this the same as $\int_0^\infty x f(x)\;dx$, where $f(x)=F'(x)$ is the probability density function. – Michael Hardy Sep 12 '11 at 1:26
@Michael: Thanks! The tail sum formula is another way to computer expectation defined as in your comment. – Tim Sep 12 '11 at 2:45
Similar question: stats.stackexchange.com/questions/18438/… – Henry Nov 26 '11 at 13:10
@Henry: Thanks! – Tim Nov 26 '11 at 16:52

This is Fubini theorem for nonnegative functions/sums. If $x$ is a nonnegative integer, $$x=\sum\limits_{i=0}^{+\infty}[x\gt i].$$ If $x$ is a nonnegative real number, $$x=\int\limits_{0}^{+\infty}[x\gt t]\mathrm dt,\qquad x=\int\limits_{0}^{+\infty}[x\geqslant t]\mathrm dt.$$ Then one integrates both sides of the relevant identity with respect to the distribution $\mathrm P_X$ of $X$ and one uses Fubini theorem to change the order of the summation/integral and of the expectation.

For example, the second identity yields $$\mathrm E(X)=\int\limits_\Omega X\ \mathrm dP=\int\limits_\Omega \int\limits_{0}^{+\infty}[X\gt t]\mathrm dt\ \mathrm dP=\int\limits_{0}^{+\infty}\int\limits_\Omega [X\gt t]\mathrm dP\ \mathrm dt=\int\limits_{0}^{+\infty}\mathrm P(X\gt t)\ \mathrm dt.$$ Likewise, the first identity yields $$\mathrm E(X)=\int\limits_\Omega X\ \mathrm dP=\int\limits_\Omega\ \sum\limits_{i=0}^{+\infty}[X\gt i]\ \mathrm dP=\sum\limits_{i=0}^{+\infty}\ \int\limits_\Omega[X\gt i]\ \mathrm dP=\sum\limits_{i=0}^{+\infty}\mathrm P(X\gt i).$$

-

First we prove that for $X \geq 0$ $$EX= \int_{0}^{\infty}P(X > t)dt.$$ We apply Fubini's theorem. Our product measure will be a product of the distribution of $X$ and Lebesgue measure. So $$\int_{0}^{\infty}P(X>t)dt = \int_0^{\infty}\left( \int_{t}^{\infty} \nu_X(ds)\right)dt=\int_{\mathbb{R}}\left( \int_{0}^{\infty}\textbf{1}_{[0,\infty)}(t)\textbf{1}_{(t,\infty)}(s)\nu_X(ds)\right)dt=$$ $$=\int_{0}^{\infty}\left(\int_0^s dt \right) \nu_X(ds)= \int_{0}^{\infty}s \nu_X(ds)=\int_{\mathbb{R}}s\nu_X(ds)=EX$$

But, you want to have $EX=\int_{0}^{\infty}P(X \geq t)dt.$

Applying what we have already proved, it is enough to show that $\int_{0}^{\infty}P(X=t)dt=0$.

-
We can also show that for $X \geq 0$ and for an increasing differentiable function $g$, such that $g(0)=0$ we have $$E(g(X))= \int_{0}^{\infty} g^{\prime}(t) P(X>t) dt.$$ – Edvin Goey Sep 12 '11 at 1:16
Thanks! Don't worry about $EX=\int_{0}^{\infty}P(X \geq t)dt$. I misunderstood Pitman's book for the discrete case. – Tim Sep 12 '11 at 1:31
No problem, but $EX= \int_{0}^{\infty}P(X \geq t)dt$. I proved the main part for this, to get $\geq$ instead of $>$ it is sufficient to show that $\int_0^{\infty}P(X=t)dt=0$ which is obvious. – Edvin Goey Sep 12 '11 at 1:35
Edvin: This is obvious when using the right approach but maybe not so obvious to every MSE reader, hence I wonder why you skip the proof of this part... – Did Nov 25 '11 at 17:28

This is integration by parts. Take $X\geq 0$, and call its distribution function $F$. Let $g$ be an increasing differentiable function with $g(0)=0$.

\begin{align*} \mathbb{E}[g(X)]&=\int_0^\infty g(t) dF(t) \\ &= \int_0^\infty -g(t) d(1-F(t)) \\ &= [-g(t)(1-F(t))]^\infty_0 - \int_0^\infty 1-F(t)d(-g(t)) \\ &= \int_0^\infty g'(t)\mathbb{P}[X>t]dt \end{align*}

This reduces to what you want when $g(X)=X$.

One way we could compute $\mathbb{E}[X]$ for general $X$ would be to compute $\mathbb{E}[X^+]$ and $\mathbb{E}[X^-]$ in this way and then take the difference, where $X^+=\max(X,0)$ and $X^-=\max(-X,0)$.

Justification of integration by parts: The integration by parts works when $g(X)$ is integrable, since, by dominated convergence, \begin{align} \limsup_x g(x)\mathbb{P}[X>x] &\le \limsup_x\mathbb{E}[g(X)\mathbf{1}(X>x)]\\ &= \mathbb{E}[\limsup_x g(X)\mathbf{1}(X>x)]\\ &= 0. \end{align}

-
Why is $g(+\infty)(1-F(+\infty))=0$? Ok, $1-F(+\infty)=0$ but what if $g(t)\to +\infty$? Does $g$ have to be bounded? Or does $1-F(t)$ converge so fast to $0$, that this works for any $g$? Thanks. – Jimmy R. Jan 4 at 14:24
@Stef I've edited the answer in response to your question. – Ben Derrett Jan 4 at 20:42
Ok, thanks. Yes, of course, if $g$ is integrable this works fine. – Jimmy R. Jan 4 at 21:09