Expectation of non-negative random variables

Discrete case

Let's take a look at the expectation of non-negative random variables. What follows is a formula whose proof almost doesn't need words. If $T$ is a non-negative discrete random variable with finite expectation, then \begin{equation*} \definecolor{dark2green}{RGB}{27,158,119} \definecolor{dark2orange}{RGB}{217,95,2} \definecolor{dark2violet}{RGB}{117,112,179} \definecolor{dark2magenta}{RGB}{231,41,138} \definecolor{dark2green2}{RGB}{102,166,30} \E[ T ] = \sum_{t = 0}^\infty \P[ T > t ]. \end{equation*} Indeed, rearranging the expectation formula, we see that \begin{align*} \E[ T ] = \sum_{t = 0}^\infty t \, \P[ T = t ] &= \underbrace{{\color{dark2green} \P[ T = 1 ]} + {\color{dark2orange} \P[ T = 2 ]} + {\color{dark2magenta} \P[ T = 3 ]} + \cdots}_{= \P[ T > 0]} \\ &+ \underbrace{{\color{dark2orange} \P[ T = 2 ]} + {\color{dark2magenta} \P[ T = 3 ]} + \cdots}_{= \P[ T > 1]} \\ &+ \underbrace{{\color{dark2magenta} \P[ T = 3 ]} + \cdots}_{=\P[ T > 2]} \\ &+ \cdots \end{align*}

Absolutely continuous case

What happens when the random variable is absolutely continuous instead of discrete? An elementary approach using Fubini proves the corresponding result.

If $T$ is a non-negative, absolutely continuous random variable, then \begin{equation*} \E[ T ] = \int_0^\infty \P[ T > t ] \, \mathrm{d} t. \end{equation*} The above follows from \begin{align*} \int_0^\infty \P[ T > t ] \, \mathrm{d} t &= \int_0^\infty \E[ \1_{\{ T > t \}}(t) ] \, \mathrm{d} t = \E\left[ \int_0^\infty \1_{\{ T > t \}}(t) \, \mathrm{d} t \right] \\ %& \text{by Fubini} \\ &= \E\left[ \int_0^{T} 1 \, \mathrm{d} t + \int_T^{\infty} 0 \, \mathrm{d} t \right] = \E\left[ T \right]. \end{align*}

Is there another way to establish the same identity? Sure thing! Integration by parts is our friend here. If $p(t)$ is the PDF of $T$ and $\P[ T \le t ]$ is the CDF, then $p(t) = \frac{\d}{\d t} \P[ T \le t ]$ and we have \begin{align*} \E[ T ] &= \int_0^\infty t \, p(t) \, \mathrm{d} t = \int_0^\infty t \, \frac{\d}{\d t} \P[ T \le t ] \, \mathrm{d} t \\ &= \int_0^\infty t \, \frac{\d}{\d t} \left( 1 - \P[ T > t ] \right) \mathrm{d} t = -\int_0^\infty t \, \frac{\d}{\d t} \P[ T > t ] \mathrm{d} t \\ &= \int_0^\infty \P[ T > t ] \mathrm{d} t, \end{align*} where the last equality results from integration by parts.

Discrete case redux

We can adapt the idea from the previous proof to the discrete case thanks to a lesser-known relative of integration by parts called summation by parts.

We define two sequences ${\color{dark2orange} u_t = t}$ and ${\color{dark2violet} v_t = \P[ T \ge t ]}$ for $t \in \mathbb{N}$, and we see that \begin{equation*} {\color{dark2magenta} u_{t+1} - u_{t} % = t + 1 - t = 1}, \end{equation*} and \begin{equation*} {\color{dark2green} v_{t+1} - v_{t} = \P[ T \ge t + 1] - \P[ T \ge t] = - \P[ T = t ]}. \end{equation*} Substituting the above into the summation by parts formula, \begin{equation*} % \label{eq:summation-by-parts} \sum_{t = 0}^{\infty} {\color{dark2orange} u_t} {\color{dark2green} \left( v_{t+1} - v_{t} \right)} = -\sum_{t = 0}^{\infty} {\color{dark2violet} v_{t+1}} {\color{dark2magenta} \left( u_{t+1} - u_{t} \right)}, \end{equation*} we conclude again that \begin{equation*} \E[T] = \sum_{t = 0}^{\infty} {\color{dark2orange} t} \, {\color{dark2green} \P[ T = t ]} = \sum_{t = 0}^{\infty} {\color{dark2violet} \P[ T > t]}. \end{equation*}

Published: November 14, 2022.