# Compute the distribution function when $n=2$ and $n=3$

Two players $$A$$ and $$B$$ play a series of games that ends when one of them has won $$n$$ games.

Suppose that each game played is, independently, won by player $$A$$ with probability $$p$$. Let $$X$$ be the number of games that are played. Compute the distribution of $$X$$ when $$n = 2$$ and $$n = 3$$.

How would one solve this?

I give an answer for $$n=2$$. (The case when $$n=3$$ goes the same way.)
First of all $$P(X=0)=P(X=1)=P(X>3)=0.$$ What is the probability that $$X=2$$? That event takes place if we have $$AA$$ or $$BB$$. (Meening that $$A$$ wins twice or $$B$$ wins twice.) Then
$$P(X=2)=p^2+(1-p)^2.$$
If $$X=3$$ then there are the following possibilities $$BAA, ABA, ABB, BAB$$. That is,
$$P(X=3)=2p^2(1-p)+2p(1-p)^2.$$
• Note that the sum of these is $1$, so you could avoid the computation of $P(X=3)$ and subtract $P(X=2)$ from $1$ instead – Ross Millikan May 16 '19 at 16:14