Probability of two consecutive successes before two consecutive failures An infinite sequence of independent trials is to be performed. Each trial results in a success with probability $p$ and a failure with probability $1-p$. What is the probability that we see two successes in a row before we see two consecutive failures?
So far I have
$$p^2+(1-p)p^2+(1-p)p^3+(1-p)^2p^3+ (1-p)^2p^4+\cdots$$
But I am not sure how to simplify this and get a proper answer in a single term.
 A: Possibilities are starting with a success
$$
\color{#C00}{(SF)^n}\color{#090}{SS}=\frac{\color{#090}{p^2}}{\color{#C00}{1-p(1-p)}}
$$
and starting with a failure
$$
F\color{#C00}{(SF)^n}\color{#090}{SS}=\frac{(1-p)\color{#090}{p^2}}{\color{#C00}{1-p(1-p)}}
$$
giving a total of
$$
\frac{(2-p)p^2}{1-p(1-p)}
$$
A: Solution 1
Let's denote 


*

*$P_{S}$ probability that the current trial is success and previous trial is not success (i.e., either the current trial is the first trial or the previous trial is failure);

*$P_{F}$ probability that the current trial is failure and previous trial is not failure (i.e., either the current trial is the first trial or the previous trial is success)

*$P_{SS}$ probability of 2 consecutive successes before 2 consecutive failures.


Then


*

*$P_{SS}=pP_S$

*$P_S=p+pP_F$

*$P_F=(1-p)+(1-p)P_S$


and finally after solving the above system
$$P_{SS}=\frac{p^2(2-p)}{1-p(1-p)}$$

Solution 2
Given the first trial is success, the probability of 2 consecutive successes before 2 consecutive failures is
$$P(SS|S_1)=p+p^2(1-p)+p^3(1-p)^2+\cdots=\frac{p}{1-p(1-p)}$$
Given the first trial is failure, the probability of 2 consecutive successes before 2 consecutive failures is
$$P(SS|F_1)=p^2+p^3(1-p)+p^4(1-p)^2+\cdots=\frac{p^2}{1-p(1-p)}$$
The total probability
$$P(SS)=pP(SS|S_1)+(1-p)P(SS|F_1)=\frac{p^2}{1-p(1-p)}+\frac{p^2(1-p)}{1-p(1-p)}=\frac{p^2(2-p)}{1-p(1-p)}$$
