# Chaitanya's Random Pages

## July 18, 2012

### The mean of a random variable in terms of its cdf

Filed under: mathematics — ckrao @ 9:17 pm

One of the nice applications of Fubini’s theorem is the following result that a random variable’s mean may be found from its cumulative distribution function (cdf) directly.

If $X$ is a random variable with cdf $F(x) = {\rm Pr}(X \leq x)$ then its mean (expected value) $E[X]$ is given by

$\displaystyle E[X] = \int_0^{\infty} \left(1 - F(x)\right)\ dx - \int_{-\infty}^0 F(x)\ dx,$

provided at least one of the two integrals is finite. This formula may be interpreted as the area of the region above the graph of $F(x)$ and below $y=1$ for positive x minus the area of the region below the graph of $F(x)$ (and above the x axis) for negative x. It also becomes intuitive by considering the Lebesgue-Stieltjes integral $E[X] = \int_{-\infty}^{\infty} x \ dF(x)$, in which the $y=F(x)$ axis is subdivided.

To show this we first decompose $X$ into difference of its positive and negative parts: $X = X^+ - X^-$, where $X^+ = \max\{X,0\}$ and $X^- = \max\{-X,0\}$. Then we may write each of these in terms of integrals of the following 0-1 indicator random variables (equal to 1 if the inequality holds, 0 otherwise).

$\displaystyle X^+ = \int_0^{\infty} I\{X > t\}\ dt$
$\displaystyle X^- = \int_{-\infty}^0 I\{t \geq X\}\ dt$

Applying Fubini’s theorem on the positive functions $I\{X > t\}$ and $I\{t \geq X\}$ we swap integration and expectation and then use the fact that the expectation of an indicator random variable is the probability of the corresponding event occurring. We obtain

$\begin{array}{lcl} E[X] & = & E\left[X^+ - X^-\right]\\& = & E\left[ X^+\right] - E\left[X^- \right] \\& = & E\left[ \int_0^{\infty} I\{X > t\}\ dt \right] - E\left[\int_{-\infty}^0 I\{t \geq X\}\ dt \right]\\& = & \int_0^{\infty} E[I\{X > t\}]\ dt - \int_{-\infty}^0 E[I\{t \geq X\}]\ dt \\ & = & \int_0^{\infty} {\rm Pr}(X > t)\ dt - \int_0^{\infty} {\rm Pr}(X \leq t)\ dt\\ & = & \int_0^{\infty} \left(1 - F(t)\right)\ dt - \int_{-\infty}^0 F(t)\ dt,\end{array}$

as required. The result may also be proved by integration by parts [1].

#### Reference

[1] Hajek, Notes for ECE 534: An Exploration of Random Processes for Engineers, July 2011, available here.