Expected value and variance of number of coin flips until two consecutive tails are flipped I'm working with a problem from an old exam where one had to calculate the expected value and variance of the number of throws, let's call it $N$, before we get two tails in a row.
We also assume the coin to be fair, meaning the probability of getting head and tails is just as equal. For our sake, let's also form the events $T$ for flipping a tail, and $H$ for flipping a head.
In order to calculate the expected value, we need to find the pmf of our stochastic variable $N$. This can easily be done by first examining some base cases of $p(k):=P(N=k)$.
Furthermore, we have that $V_N \in \{2,3,\dots\}$.
For $N = 2$, $P(N=2) = P(T \cap T) = 1/4$ trivially.
For $N = 3$, $P(N=3) = P(H \cap T \cap T) = 1/8$ also trivially.
From this we notice a pattern, before every ending $TT$ we have to place out a $H$, meaning this position is always determined.
For instance $N = 4$, we have that the last three letters are $HTT$, and for the first position, we have 2 choices, meaning $P(N=4) = 2 / 2^4 = 1/8$
So what about the case when $N = k$?
We already know that the last three letters are determined. Meaning we have a total of $2^{k-3}$ choices left to do. But from this, we have to subtract the number of $TT$ - "strings" that may arise in the rest of our $k-3$ positions.
However, from here, I struggle to find the number of combinations for which we don't get a $TT$ somewhere along the $k-3$ positions. I know that as soon as we get $T$, we must choose $H$, but as soon as we get $H$, we have $2$ choices to make. Maybe this is a better way of tackling the problem instead of the method I used above. Still, I don't really see how to cover all the cases, and I'd be glad if anyone could share these details.
Also, I'd be thankful if you didn't share a whole solution to the expected value and variance, since I'll try to solve it on my own.
Thanks.
 A: Let $H_i, T_i$ being the events that you get a head/tail in the throw $i$. The idea is that every time you throw a head, all the throws up to that point are wasted and you start fresh (unless you throw two tails in a row, in which case you are done).
Then:
$$E[N] = E[N|H_1]P(H_1)+E[N|T_1]P(T_1)=\frac{1}{2}\left(E[N]+1\right)+\frac{1}{2}E[N|T_1]$$
And:
$$E[N|T_1]=E[N|T_1H_2]P(H_2)+E[N|T_1T_2]P(T_2)=\frac{1}{2}\left(E[N]+2\right)+\frac{1}{2}\cdot 2$$
Putting it all together:
$$E[N] = \frac{1}{2}\left(E[N]+1\right)+\frac{1}{4}\left(E[N]+4\right) = \frac{3}{4}E[N]+\frac{3}{2}$$
So $E[N]=6$
For variance, you need $E[N^2]$, which is calculated with the same idea.
$$E[N^2] = E[N^2|H_1]P(H_1)+E[N^2|T_1]P(T_1)=\frac{1}{2}E[(N+1)^2]+\frac{1}{2}E[N^2|T_1]\\=\frac{1}{2}E[N^2]+\frac{13}{2}+\frac{1}{2}E[N^2|T_1]$$
And:
$$E[N^2|T_1]=E[N^2|T_1H_2]P(H_2)+E[N^2|T_1T_2]P(T_2)=\frac{1}{2}\left(E[(N+2)^2]\right)+\frac{1}{2}\cdot 4\\
=\frac{1}{2}E[N^2]+16$$
I think you can finish it from here. You may use this simulation to check your answer.
A: EDIT: My previous idea is right, but not the execution. Indeed, see comments below, we that $\mathbb E(N)\geq 2$.
If we now condition on the last two flips after the initial two, we get
$$\mathbb E(N)=2+\mathbb E(N|TT)\mathbb P(TT)+2\mathbb E(N|HT)\mathbb P(HT)+\mathbb E(N|HH)\mathbb P(HH)\\
=\frac14+\frac12(\mathbb E(N)+1)+\frac14(\mathbb E(N)+1)\\
\Leftrightarrow \mathbb E(N)=6$$
