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?

-
Differentiate a well-known series. – M.B. Nov 12 '12 at 20:51

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?

-
then wouldn't we have $\sum_{x=1}^\infty xr^x$? How do we take care of the extra x? – TheHopefulActuary Nov 12 '12 at 20:53
Oh sorry, i'll fix it – Norbert Nov 12 '12 at 20:56

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}$.

-
I like the insight you made, but can you tell me why 1 isn't multiplied by $p$? since $E[X]= \displaystyle\sum_{k=0}^{\infty} x(Pr(X=k))$? – adam Dec 18 '13 at 4:33
We could do it your way. With probability $p$ we get $X=1$ (giving a term $p$, or with probability $1-p$, $E(X)=1+E(X)$. That gives $E(X)=p+(1-p)(1+E(X))$, giving exactly the same thing for $E(X)$ as was obtained in (I think) a marginally simpler way. – André Nicolas Dec 18 '13 at 6:48
let me try to see if I follow with what you are doing. Are you evaluating the summation by parts? meaning $\displaystyle\sum_{k=1}^1 1(Pr(X=1))?$ and than representing the other half of the sum as E[X]? – adam Dec 18 '13 at 7:38
The argument uses conditional expectation, conditioning on the first outcome. In this example, it can also be viewed as a summation trick or technique. – André Nicolas Dec 18 '13 at 14:50
so its the probability of success p + the probability of failure 1-p times the expected value if we fail the 1st trial 1 + E [X]. if I got the logic down. – adam Dec 18 '13 at 18:49