<s>[INST] What is the probability f(p) of A winning the match? 
Here's my approach:
Let A denote the event "A wins the game" and B denote the event "B wins the game"
I am supposed to calculate the probability f(p)
There are two possible cases:-
i) A wins within 4 games
Possible cases: AAA,ABAA,BAAA,AABA
ii) A doesn't win within 4 games
Possible cases: AABB(A and B occur 2 times each) ABABABAB...(A and B occur k times each) AA
AABB can be arranged in 6 ways
ABABAB.... can be arranged in $(2!)^k$ ways (A and B are adjacent to one another)
Now :
f(p) = P(case i) + P(case ii)
P(case ii) = $(6 (p^2) (1-p)^2 ) \sum_{k=1}^∞  2^k . p^k . (1-p)^k. p^2  $=$(6 (p^4) (1-p)^2 ) \sum_{k=1}^∞  2^k . p^k . (1-p)^k$
= $(6. 2 . p^5 . (1-p)^3)/(1-2p+2p^2)$ (The denominator seems correct)
P(case i ) = $p^3 +3p^3(1-p)$
f(p) = $p^3 +3p^3(1-p) + \frac{(6. 2 . p^5 . (1-p)^3)}{(1-2p+2p^2)}$
The expected answer is not produced by solving the above equation.Where did I go wrong?
Edit:-
I finally figured out the mistake that I made in the above solution.
In P(case ii) = $(6 (p^4) (1-p)^2 ) \sum_{k=1}^∞  2^k . p^k . (1-p)^k $, I replaced $\sum_{k=1}^∞$ with $\sum_{k=0}^∞$ . There has to be one case when B does not occur after the tie, i.e. A occurs only two times.
P(case ii) =  $(6 (p^4) (1-p)^2 ) \sum_{k=0}^∞  2^k . p^k . (1-p)^k $
=  $(6 (p^4) (1-p)^2 ) .[1+2p(1-p)^1+2^2.p^2.(1-p)^2+...]$
=$(6 (p^4) (1-p)^2 ) .\frac{1}{1-2p(1-p)}$
f(p) = P(case i) + P(case ii)
=$p^3 +3p^3(1-p)+(6 (p^4) (1-p)^2 ) .\frac{1}{1-2p(1-p)}$
=$p^3[1+3(1-p)+\frac{6p(1-p)^2}{1-2p(1-p)}]$
=$p^3[1+(3-3p)+\frac{6p-12p^2+6p^3}{1-2p+2p^2)}]$
=$p^3[\frac{(1-2p+2p^2)+(3-6p+6p^2-3p+6p^2-6p^3)+(6p-12p^2+6p^3)}{1-2p+2p^2)}]$
=$p^3\frac{(4-5p+2p^2)}{1-2p+2p^2}$
 [/INST] Let $q = 1 - p.$

Suppose that the match is tied 2-2 after 4 games.
Let $R$ denote the probability of A's winning the match, in that event.
Then
$$R = p^2 + 2pqR \implies R(1 - 2pq) = p^2 \implies R = \frac{p^2}{1 - 2pq}.$$
After $4$ games either A has won all $4$, A has won $3$ out of $4$ (where it is harmless to play the 4th game if A won the first three games), the match is split 2-2, or A has lost.
Therefore, A's probability of winning is
$$p^4 + 4p^3q + 6p^2q^2R = p^4 + 4p^3q + \left[6p^2q^2 \times \frac{p^2}{1 - 2pq}\right]$$
$$= p^3 \times \left\{ ~  p + 4q + \frac{6pq^2}{1 - 2pq}
~\right\}$$
$$= 
p^3 \times \left\{ ~\frac{[ ~(1 - 2pq)(p+4q) ~] + 6pq^2}{1 - 2pq}
 ~\right\}. \tag1 $$
Then:

*

*$1 - 2pq = 1 - 2p(1 - p) = 1 - 2p + 2p^2.$

*$p + 4q = p + 4(1 - p) = 4 - 3p.$

*$6pq^2 = 6p(1 - 2p + p^2) = 6p - 12p^2 + 6p^3.$
The given answer is
$$\frac{p^3(4 - 5p + 2p^2)}{1 - 2p + 2p^2}. \tag2 $$
Comparing (1) and (2), the problem reduces to showing that
$$[(1 - 2pq)(p + 4q)] + (6p - 12p^2 + 6p^3) = (4 - 5p + 2p^2). \tag3 $$

$$(1 - 2p + 2p^2)(4 - 3p) = 4 - 11p + 14p^2 - 6p^3.$$
Therefore, the equality in (3) above is established.
</s>