Two groups A and B are playing a game…

Two groups A and B are playing a game.
The first group that wins 3 times is the winner.

The probability that group A will win at on game is $\frac12$ and the same thing for group B.

$X$ = The number of games until one of the groups (A or B) will be the winner.

What is the probability function of $X$? (as table).
[We know that there is only three options].

Thank you so much!

Here is my try after your help:

-
What have you tried so far? :) –  Shaun Jul 15 at 8:09
@Shaun, I edit and put my try, thank you! –  Yoar Jul 15 at 8:14
You have missed the possibility that $X=0$ –  Henry Jul 15 at 8:37
@Henry, but the option of $X=3$ is same as $X=0$, right? Becuase if we are at $X=0$ it means that both groups are equal... –  Yoar Jul 15 at 8:43
Read the question again, please. Are you really saying that there is a positive probability that after a single game team A has won three games? –  Jyrki Lahtonen Jul 15 at 8:48

There must be at least three games for somebody to win, and cannot be more than five as somebody would have already won.

One approach (not the most efficient in general) would be to list the possible outcomes

AAA
AABA
AABBA
AABBB
ABAA
ABABA
ABABB
ABBAA
ABBAB
ABBB
BAAA
BAABA
BAABB
BABAA
BABAB
BABB
BBAAA
BBAAB
BBAB
BBB


Those of length $3$ each have a probability of $2^{-3}$, of length $4$ have $2^{-4}$ and of length $5$ have $2^{-5}$.

So to answer your question, just add up the probabilities for those of length $3$, and similarly those of length $4$ and of $5$. The three probabilities should add up to $1$.

-
And what about if it's A or B? It doesn't matter? –  Yoar Jul 15 at 9:47
@Yoar: The question is defining $X$ as the number of games played when either A or B wins, so both cases must be counted together. I recommend this approach first, because you need to understand what the question is asking. After that I suggest you look at my answer and try to understand it. –  user21820 Jul 15 at 9:52
I add my new table... I hope it's correct now... –  Yoar Jul 15 at 10:06
$$Pr(X=3) = 2 \times 2^{-3}$$ $$Pr(X=4) = 6 \times 2^{-4}$$ $$Pr(X=5) = 12 \times 2^{-5}$$ The error in your revised table is in the coefficients –  Henry Jul 15 at 11:23
Consider something like @user21820 's reply, so $2={(3-1)+0 \choose (3-1)}+{0+(3-1) \choose 0}$ while $6={(3-1)+1 \choose (3-1)}+{1+(3-1) \choose 1}$ and $12={(3-1)+2 \choose (3-1)}+{2+(3-1) \choose 2}$ –  Henry Jul 15 at 12:14

Here is a more elegant answer than Henry's, but you need more work. Let $n$ be the number of wins that one player needs to obtain for the game to end.

Start at the single "1" at the apex of Pascal's triangle. For every game, go down one row, left if A wins and right if B wins. Notice that as long as each of A and B have less than $n$ wins, the number of games that gets to a point in the Pascal's triangle will be equal to the number at that point in the triangle. When A wins, it is because we last went left onto the $n$-th right-downward diagonal. Likewise when B wins, it is because we last went right onto the n-th left-downward diagonal. Therefore we can now easily write down all the probabilities we want. For example there are $\binom{n-1+k}{k}$ games with $n-1$ A-wins and $k$ B-wins, for any natural $k \le n-1$, and hence the probability that a game would have $n$ A-wins and $k$ B-wins would be $\binom{n-1+k}{k} 2^{-(n+k)}$.

-
I add new table, hope it's correct! –  Yoar Jul 15 at 10:08
@Yoar: Your table does not make sense, given what Henry said in the first line of his answer. –  user21820 Jul 15 at 10:09
I still don't understand... Where is my mistake? :-( –  Yoar Jul 15 at 10:10
You have a list of mutually exclusive outcomes. Each outcome has a certain probability determined by how many games it took. An outcome that took only 3 games would be more likely than one that took longer. Now all you have to do is find the probability that the outcome takes 3 games, then 4, then 5. –  user21820 Jul 15 at 10:35
Ok but you'll have to write it. If $X=4$, there are two cases, either ( 3 A-wins and ? B-wins ) or ( 3 B-wins and ? A-wins ).. Each of these two cases are mutually exclusive, and my formula gives the probability for each. So what is the sum? –  user21820 Jul 15 at 11:03