# Expected value equals sum of probabilities [duplicate]

Let $X$ be a random variable that takes non-negative integer values. Show that, $$E[X] = \sum^{\infty}_{k=1}P(X \geq k)$$

I'm having trouble following the solution. Could someone help clarify some steps? Thanks.

By definition, $$P(X \geq k) = \sum^{\infty}_{i=k}p_{X}(i)$$

Therefore, we substitute to get $$\sum^{\infty}_{k=1}P(X \geq k) = \sum_{k=1}^{\infty}\sum_{i=k}^{\infty}p_{X}(i)$$

Now here is where I'm confused. $$\sum_{k=1}^{\infty}\sum_{i=k}^{\infty}p_{X}(i) = \sum_{i=1}^{\infty}\sum_{k=1}^{i}p_{X}(i) = \sum^{\infty}_{i=1}ip_{X}(i)$$

I don't understand how we are manipulating the summations in the first equality and how we derive $ip_{X}(i)$ in the second equality.

-

## marked as duplicate by Arthur Fischer♦Jun 25 '14 at 14:48

Put $P(X\ge k)=P(X=k)+P(X=k+1)+\cdots$ as the $k$'th row of an infinite matrix, padded at the start with $k-1$ zeroes. Now sum over the columns. –  David Mitra Jun 24 '14 at 17:03
As in the first answer here. –  David Mitra Jun 24 '14 at 17:10
This is a recurring question here, but it's hard to find it because the titles vary so much. –  Michael Hardy Jun 24 '14 at 17:18

\begin{array} & & 0P(X=0) & + & 1P(X=1) & + & 2 P(X=2) & + & 3P(X=3) & + & \cdots \\[18pt] = & & & P(X=1) & + & P(X=2) & + & P(X=3) & + & \cdots \\ & & & & + & P(X=2) & + & P(X=3) & + & \cdots \\ & & & & & & + & P(X=3) & + & \cdots\\ & & & & & & & & + & \cdots \end{array}

The sum in the first row is $P(X>0)$; that in the second row is $P(X>1)$; that in the third row is $P(X>2)$, and so on.

The equality of $$\sum_{k=1}^\infty \sum_{i=k}^\infty \cdots = \sum_{i=1}^\infty \sum_{k=1}^i \cdots$$ can be seen by observing that both are the sum over the set $$\{ (k,i) : 1\le k \le i \}.$$

The next equality involves a sum of the form $\displaystyle\sum_{k=1}^i a$ where $a$ does not change as $k$ goes from $1$ to $i$, so it is $$\underbrace{a+a+a+\cdots+a}_{i\text{ terms}} = ai.$$

-

Perhaps you can show the pointwise identity $$X=\sum_{k=1}^X1=\sum_{k=1}^\infty\mathbf 1_{X\geqslant k}$$ and use linearity of expectation.

-