# Use cdf to find expectation

I have a cdf for a $\mathbf {discrete}$ random variable, $X$,

$$F_X(x)=1-(1-p)^{xn}$$

where $p\in(0,1)$, $n\in\mathbb N$, $x\in\mathbb N$

My thought is to use

$$E[X]=\sum_{x=0}^\infty (1-F_X(x))=\frac {1}{1-(1-p)^n}$$ the final answer correct but I'm not sure about my work.

Does the expected value equal to this in the discrete case? If it does, why is that? And is writing the sum starting from $x=0$ correct and why?

Or is there any other way to get the expected value using cdf?

On the other hand, does the equation of expected value and cdf correct in the continuous case by changing the sum into integral?

• This is the tail sum formula.
– Em.
May 10, 2016 at 0:26
• Should x starting form 0? and why? May 10, 2016 at 0:54
• Please google tail sum. No, it does not have to start at $0$.
– Em.
May 10, 2016 at 0:55

Does the expected value equal to this in the discrete case? If it does, why is that? And is writing the sum starting from $x=0$ correct and why?

It holds for when $X$ is a strictly non-negative integer random variable (ie the support is a subset of $~\{0, 1, 2, ...\}~$), and the expectation exists.

\begin{align} \mathsf E(X) ~=~& \sum_{k=0}^\infty k~\mathsf P(X=k) & \text{by definition of expectation} \\[1ex]~=~& 0+\sum_{k=1}^\infty \sum_{x=1}^{k} \mathsf P(X=k) & \text{when k is a positive integer, }k=\sum_{x=1}^k 1 \\[1ex]~=~& \sum_{x=1}^\infty \sum_{k=x}^\infty \mathsf P(X=k) & \text{swap order of summation}\\[1ex]~=~& \sum_{x=1}^\infty \mathsf P(X \geq x) \\[1ex]~=~&\sum_{x=0}^\infty \mathsf P(X>x) & \text{change of index of summation} \\[1ex]~=~& \sum_{x=0}^\infty \Big(1-\mathsf P(X\leq x)\Big)\end{align}

$\Box$