conditional expectation? I'm trying to solve an expected value problem where a biased coin is flipped until a run of five heads is achieved. I need to compute the $E(X)$ where $X$ is the number of tails expected before the run of five heads.
Would this require conditional expectation, since $E(X)$ is dependent on $P(Y)$ which is the probability of a run of five heads? 
I know how to calculate the expected value of flips, but I'm pretty lost on counting the number of tails. 
If $E(Y)$ is value $n$, then would I solve like so?
$P(X = k \mid X E {n})$
$E(X) = P(X)E(Y)$
 A: The following is a conditional expectation argument. We first deal with an unbiased coin, and then a biased coin. Let $e$ be the required expectation. 
Unbiased Coin: If the first toss is a tail (probability $\frac{1}{2}$) then the expected number of tails is $1+e$. 
If first toss is a head and the second is a tail (probability $\frac{1}{4}$, then the expected number of tails is $1+e$.
If first two tosses are head and the third is a tail, then the expected number of tails is $1+e$.
Same for first three heads, and fourth a tail.
Same for first four heads, and fifth a tail.
If first five tosses are heads, then expected number of tails is $0$. 
Thus
$$e=\frac{1}{2}(1+e)+\frac{1}{4}(1+e)+\cdots +\frac{1}{32}(1+e).$$
Solve for $e$. 
Biased Coin: The same idea works for a biased coin. Let the probability of head be $p\ne 0$. Then the probability of tail is $1-p$, the probability of head followed by tail is $p(1-p)$, the probability of two heads followed by tail is $p^2(1-p)$, and so on. Thus
$$e=(1-p)(1+e)+p(1-p)(1+e)+\cdots +p^4(1-p)(1+e).$$
Solve for $e$.
A: Let $p$ be the chance of a head on a single toss of the coin.
Every time you try to throw 5 heads in a row, you either succeed or fail
 by getting a tail "too soon". 
$$\underline{HHT}\ \ \underline{T}\ \ \underline{HT}\cdots\underline{HHT}\ \ \underbrace{\underline{HHHHH}}_{\mbox{success!}} $$
The number of tails $X$ observed is the same 
as the number of failures before the first success, so $X$ has a geometric 
distribution with $\mathbb{P}(\mbox{success})=p^5$. 
Therefore $\mathbb{E}(X)={1\over p^5}-1.$
