# Expectation of a positive integer?

Let's suppose we know that if $X \ge 0$ and X is integer-valued, then: $$E(X) = \sum_{n \ge 1} Pr(X \ge n)$$ For more info please visit: 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)$

My question is how to get $E(X^2)$.

Thanks,

-
 see this thread math.stackexchange.com/questions/231832/… – Jean-Sébastien Nov 7 '12 at 3:18 Thanks @Jean-Sébastien. Do you have any hint on how to get E(X^2). I'll edit my question and I'll ask E(X^2) part only. – Eli Nov 7 '12 at 3:40

$$X^2=\sum_{n\geqslant1}(2n-1)\cdot\mathbf 1_{X\geqslant n}\implies\mathbb E(X^2)=\sum_{n\geqslant1}(2n-1)\cdot\mathbb P(X\geqslant n)$$

-
 Nice answer...thanks. – Eli Nov 7 '12 at 17:21