# How to calculate expectation of a discrete random variable using CDF? [duplicate]

Please refere to the attached image (source: Wikipedia). They have derived the formula (summation one) for discrete random variable as a special case. Can anybody please help me understand how to derive that formula from the integral formula? I already have understanding for the integral formula(continuous case).

• Two hints: You have $P(X>n)=1-F(n)$. If $X$ can only be an integer, then $F(x)=F(n)$ for $n \le x \lt n+1$ so $\int\limits_{x=n}^{n+1} (1-F(x))\, dx = \int\limits_{x=n}^{n+1} (1-F(n))\, dx = 1-F(n)$ Nov 24, 2022 at 12:27
• Please type your question as text, do not just post a photograph or screenshot (see here). When you retype the question, add the self-study tag & read its wiki. Then tell us what you understand thus far, what you've tried & where you're stuck. We'll provide hints to help you get unstuck. Nov 24, 2022 at 12:34
• Summarion by parts, already answred here: stats.stackexchange.com/questions/305031/… Nov 24, 2022 at 13:42

Henry has provided rather ingenious hints which OP can use to formally jot down the proof. Unless OP adds anything further regarding their attempt, I am not proceeding on that front.

For broader purpose, here is another take and a commentary.

$$\bullet$$ Observe

\begin{align}\sum_{n~=~0}^\infty \mathbf P[X >n] &= \sum_{n~=~1}^\infty \mathbf P[X \geq n]\\ &=\sum_{n~=~1}^\infty \left\{ \sum_{x~=~n}^\infty\mathbf P[X = x] \right\}\\ &= \sum_{x~=~1}^\infty \left\{ \sum_{n~=~1}^x\mathbf P[X = x] \right\}~~~~~~~~~\because\textrm{(Fubini's Theorem)}\\ &= \sum_{x~=~1}^\infty \left\{\mathbf P[X = x] \sum_{n~=~1}^x1\right\}; \tag 1\label 1\end{align}

from $$\eqref 1$$ the rest follows.

$$\bullet$$ If $$X$$ is only a non-negative random variable, then

\begin{align}\sum_{n~=~1}^\infty \mathbf P[X \geq n] & = \sum_{n~=~1}^\infty \left\{ \mathbf P[n \leq X < n+1] + \mathbf P[n+1 \leq X < n+2]+ \ldots\right\}\\ &=\sum_{\ell~=~1}^\infty \ell\times \mathbf P[\underbrace{\ell \leq X < \ell+1}_{\lfloor X\rfloor ~=~ \ell}]\\ &= \mathbb E\lfloor X\rfloor.\tag 2\end{align}

## Reference:

$$\rm [I]$$ A First Look at Rigorous Probability Theory, Jeffrey S. Rosenthal, World Scientific Publishing, $$2006,$$ sec. $$4.3,$$ p. $$49.$$