[Math] A and B play a series of games. Find the probability that a total of 4 games are played.

probability

A and B play a series of games. Each game is independently
won by A with probability $p$ and by B with probability $1 􀀀- p$. They stop when the
total number of wins of one of the players is two greater than that of the other player.
The player with the greater number of total wins is declared the winner of the series.

(a) Find the probability that a total of 4 games are played.
(b) Find the probability that A is the winner of the series.

I though I could do this using conditional probability and independent trials/bernoulli trials but I am really confused.

let's say I want to find the probability that A wins three games and B wins 1 game and add that to the probability of B wins 3 games and A wins 1 game, but I am not sure of how to do that because B has to win at least 1 game before A wins 2.
If I set $n$ = number of games played would the sample space equal $p^n * (1-p)^n$?
How do I solve this? is there an easier way?

Best Answer

The first question is best done by enumeration, as suggested in the comments.

To handle the second one:

Let's introduce the relevant states of the game. We will index these by the number of games by which $A$ is ahead. Thus we have $5$ states: $(0),(1),(-1),Win,Loss$. Let $p(state)$ denote the probability that $A$ will win if the teams are in the given state. Thus the answer we seek is $p(0)$. Obviously $p(Win)=1$ and $p(Loss)=0$. By considering the possible outcomes of the next game, we get some basic relations between the probabilities as: $$p(0)=p(1)p+p(-1)(1-p)$$ $$p(1)=1^*p+p(0)(1-p)$$ $$p(-1)=p(0)p+0^*(1-p)$$ This system is easily solved to get $$p(0)=\frac {p^2}{1-2p(1-p)}$$ As a sanity check observe that this correctly gives $\frac 12$ if $p=\frac 12$.