TITLE: Where am I going wrong with this proof of expected value of a geometric random variable?
QUESTION [8 upvotes]: I know that the expected value of a geometrically distributed random variable is $\frac1p$ but how do we get there. This is what I got so far: $$\sum_{x=1}^\infty xP(X=x)$$ where X is the number of failures until first success. Since it's geometric we have:$$\begin{align} \sum_{x=1}^\infty xp(1-p)^{x-1}\\ \frac{p}{1-p} \sum_{x=1}^\infty x(1-p)^x\\ ....  \end{align}$$ How do we sum that?

REPLY [7 votes]: An experiment has probability of success $p\gt 0$, and probability of failure $1-p$. We repeat the experiment until the first success. Let $X$ be the total number of trials. We want $E(X)$. 
Do the experiment once. So we have used $1$ trial. If this trial results in success (probability: $p$), then the expected number of further trials is $0$. If the first trial results in failure (probability: $1-p$), our experiment has been wasted, and the expected number of trials remains at $E(X)$. Thus 
$$E(X)=1+(p)(0)+(1-p)E(X).$$
If $E(X)$ exists, we can solve for $E(X)$ and obtain $E(X)=\dfrac{1}{p}$.