# Proof of $\sum_{k=0}^n k \text{Pr}(X=k) = \sum^{n-1}_{k=0} \text{Pr}(X>k) -n \text{Pr}(X>n)$

$X$ is a random variable defined in $\mathbb N$. How can I prove that for all $n\in \mathbb N$?

• $\text E(X) =\sum_{k=0}^n k \text{Pr}(X=k) = \sum^{n-1}_{k=0} \text{Pr}(X>k) -n \text{Pr}(X>n)$
• $\text E(X) =\sum_{k=0}^n k \text{Pr}(X=k)=\sum_{k\ge 0} \text{Pr}(X>k)$
-

## 2 Answers

For part $a)$, use Thomas' hint. You get $$\sum_{i=0}^{n}k(P(X>i-1)-P(X>i)).$$

This develops as $P(X>0)-P(X>1)+2P(X>1)-2P(X>2)+3P(X>2)-3P(X>3)+\cdots nP(X>n-1)-nP(X>n)$

for part $b)$:

In general, you have

$\mathbb{E}(X)=\sum\limits_{i=1}^\infty P(X\geq i).$

You can show this as follow: $$\sum\limits_{i=1}^\infty P(X\geq i) = \sum\limits_{i=1}^\infty \sum\limits_{j=i}^\infty P(X = j)$$

Switch the order of summation gives \begin{align} \sum\limits_{i=1}^\infty P(X\geq i)&=\sum\limits_{j=1}^\infty \sum\limits_{i=1}^j P(X = j)\\ &=\sum\limits_{j=1}^\infty j\, P(X = j)\\ &=\mathbb{E}(X) \end{align}

$$\sum\limits_{i=0}^{\infty}iP(X=i)=\sum\limits_{i=1}^\infty P(X\geq i)=\sum\limits_{i=0}^{\infty} P(X> i)$$

-
I was proving the wrong thing, when I saw your edit :P – Jean-Sébastien Nov 7 '12 at 2:19
Thank you very much. – user31280 Nov 7 '12 at 2:33
Hi @Jean-Sébastien, can you explain the part you switch the summation a little more? while in the first sum Pr(X = 1) appears once, in the switched one, however, Pr(x = 1) appears many times which seems not to be equal to the first one. – Sam Nov 7 '12 at 3:37
@Sepehr If you look at it carefully, it only appears once. The second summation is of index $i$, while the inside sum has not $i$, just a $j$. this is why it becomes $j\times P(X=j$) in the second line. Try writing the first two sums in a array, lines being on $j$ and column on $i$. First line sums each line while second sums each column. I'll edit if you can't get it. – Jean-Sébastien Nov 7 '12 at 13:17
Hi @Jean-Sébastien, I see what you are saying. Now I get it. Thanks. – Sam Nov 9 '12 at 18:07

Hint: $Pr(X=k) = Pr(X>k-1)-Pr(X>k)$

-