Where am I going wrong with this proof of expected value of a geometric random variable? 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?

Set $r=1-p$ and recall geometric series formula
$$
\sum\limits_{x=1}^\infty r^x=\frac{r}{1-r}
$$
Then 
$$
\sum\limits_{x=1}^\infty x r^x=
r\sum\limits_{x=1}^\infty x r^{x-1}=
r\sum\limits_{x=1}^\infty  \frac{d}{dr} r^x=
r \frac{d}{dr}\sum\limits_{x=1}^\infty r^x=
r\frac{d}{dr}\frac{r}{1-r}
$$
Is the rest clear?
