I'm refreshing my knowledge in probability and I cam across the following:
Let $X$ be a discrete R.V that takes only non-negative values, then $E[X]=\sum_{i=1}^{n}P(X\geq i)$
I have a small problem understating the proof given:
$$ \sum_{i=1}^{\infty}P(X\geq i) $$
$$ =\sum_{i=1}^{\infty}\sum_{j=i}^{\infty}P(X=j) $$
$$ \overset{=}{\text{?}}\sum_{j=1}^{\infty}\sum_{i=1}^{j}P(X=j) $$
$$ =\sum_{j=i}^{\infty}jP(X=j)=E[X] $$
I don't understand the second equality - how did the second sum became from $i=1$ to $i=j$ and the order of the inner and outer sums were switched ?
Consider
The sum $$ \sum_{i=1}^\infty\sum_{j=i}^\infty\Pr(X=j) $$ adds the probabilities at the ordinates of the dots with the dots listed by columns proceeding left to right. The sum $$ \sum_{j=1}^\infty\sum_{i=1}^j\Pr(X=j) $$ computes the same sum with the dots listed by rows proceeding from bottom to top. Of course, in each row, all the dots have the same ordinates and that's why you get the simplification on the very next step in the proof.