A fair coin is tossed repeatedly and independently until two consecutive heads or two consecutive tails appear. Find the PMF, the expected value, and the variance of the number of tosses. Let X be a total number of tosses And it is a problem of geometric distribution.
1)The pmf is clear for me: $ pmf = (1/2)^{k-1}$
The problem is with expected value:
2)My solution: $E[X] = 1/p = 2$
Solution of the book: $E[X] = E[Y] + 1 = 3$
I can't understand the book's solution. How we came to this? I need some explanation. Thanks.
Quite simply you cannot have two consecutive head-or-tails until you have at least the second flip. If $X$ is the count of flips required, then: $\mathsf P(X{=}1)=0,\, \mathsf P(X{=}2)=\tfrac 1 2, \,\ldots,\, \mathsf P(X{=}k) = \frac 1{2^{k-1}} \;\mathbf 1_{k\in\{2;\infty\}}$
That is, to have a consecutive head-or-tail on flip $k$, you need the first flip (what ever it is), the next $k-2$ flips to all be different to each of their predecessors, and last flip to be identical to its predecessor.
This means: $(X-1)\sim \mathcal{Geo_1}(\frac 1 2)$, that is $X$ has a shifted geometric distribution.
Let $Y\sim\mathcal{Geo_1}(\frac 1 2)$, then $X=Y+1$ and $\mathsf E(X)=1+\mathsf E(Y)=1+2=3$
That is all.