Keep flipping a biased coin until the first head is observed and let X be the number of flips resulting. Find E[X]. Question: Keep flipping a biased coin (π = p [heads] = 1/3). We will not stop until the first head is observed and let X be the number of flips resulting. Find E[X].
My answer:
$E(X) = \sum_{x=1}^\infty(x\cdot(1-\pi)^{x-1}\cdot\pi) = \pi\sum_{x=1}^\infty(x\cdot(1-\pi)^{x-1})$
I am stucked here....
The answer key is 3
 A: Doesn't the thing that is being summed look like the derivative of some function in $\pi$ to you ? 
Try to do the sum before differentiating and then finally differentiate, you should find what you are looking for (if you can commute infinite sum and derivation in this case it is because of a particular case of dominated convergence theorem).
A: While it's a good idea to memorize the fact that a geometrically distributed random variable with parameter $p$ has expectation $1/p$, you can solve this problem without computing the sum by finding a recursive equation (this is called conditioning the expectation).
Let's look at only the outcome of the first coin flip. There are two cases to consider. If we flip heads (with probability $1/3$), our number of coin flips has increased by one, and we'll stop the coin flipping process. On the other hand, if we flip tails (with probability $2/3$), we will add one to our coin flip count, but now we've effectively "restarted" our coin flipping process (with our count increased by one).
By the law of total probability, this gives the equality
$$E(X) = \underbrace{\frac{1}{3} (1)}_{\text{heads}} + \underbrace{\frac{2}{3}(E(X) + 1)}_{\text{tails}}$$
You can solve this equation to find $E(X) = 3$.
