# Coin tossing with random throws

Consider the following game: two people play at tossing coins; each one of them has only one coin (1 & 2) which is toss repeatedly and the first player to obtain "head" wins. However there some particular aspects for this game:

1. The coins are biased: they have probabilities $q_1$ and $q_2$ respectively to turn up head.
2. The two players have at their disposal only $m,n$ throws respectively. The throw order is random: any permutation of the $m+n$ throws has the same probability to occur. This means that there is a probability $(1-q_1)^m(1-q_2)^n$ that no one wins.

My question is: what is the probability $p_{m,n}$ that the first player wins? Unfortunately I could find a solution only for the particular case $q_1=q_2$.

My solution attempt is as follows: I condition on the number of failures (from both sides) before player 1 wins:

$p_{m,n}=\dfrac{m q_1}{m+n}\sum\limits _{m_1=0}^{m-1} \sum\limits _{m_2=0}^{n}\dfrac{\binom{m-1}{m_1}\binom{n}{m_2}}{\binom{m+n-1}{m_1+m_2}}\left(1-q_1\right) ^{m_1} \left(1-q_2\right) ^{m_2}$

I change index from $m_2$ to $M=m_1+m_2$:

$p_{m,n}=\dfrac{m q_1}{m+n}\sum\limits _{m_1=0}^{m-1} \sum\limits _{M=0}^{m+n-1}\dfrac{\binom{m-1}{m_1}\binom{n}{M-m_1}}{\binom{m+n-1}{M}}\left(1-q_1\right)^{m_1} \left(1-q_2\right)^{M-m_1}$

Now if $q_1=q_2$ the sum over $m_1$ gives just 1 and the sum over $M$ is a geometric series:

$p_{m,n}=\dfrac{m}{m+n}(1-(1-q_1)^{m+n})$

Is it possible to obtain a closed form for the general case? I also tried to set up a recurrence relation by conditioning on the outcome of the first toss:

$p_{m,n}=\dfrac{m}{m+n}(1-q_1)p_{m-1,n}+\dfrac{n}{m+n}(1-q_2)p_{m,n-1}+\dfrac{m}{m+n}q_1$

with the boudary conditions: $p_{0,n}=0$ and $p_{m,0}=1-(1-q_1)^m$, however I do not know how to solve it. Maybe using generating functions yields any useful result? Any hint and/or advice would by highly appreciated!

Let A be the first player with probability $p_1$ to throw a head and has n throws available and let B be the second player with probability $p_2$ to throw a head and has m throws available . Each player's throw of coming up with heads first follows geometric distribution.

and let n> m for argument sake

Then

$P(A<B)$ is the probability that A wins.

$P(A<B) = \sum_{k=1}^{n} (1-p_1)^{k-1}.p_1 \left(\sum_{i = k+1}^{m} (1-p_2)^{i-1}.p_2\right)$

$P(A=B) = \sum_{k = 1}^{\text{min(n,m)}} p_1p_2\left[(1-p_1)(1-p_2)\right]^{k-1}$

Is there something that I am missing? If you give values for n,m,$p_1$,$p_2$ and compute this, you shall verify the correctness of the solution which I will leave it to you.

I have worked out for n=10, m = 12, $p_1$ = 0.4 and $p_2$ = 0.6. Take a look at it and let me know if you have any questions. • I think there is a misunderstanding: of course A wins if he throws head before B, however the order in which they throw their coins is important and such ordering is selected at random at the beginning of the game. For instance consider the case $n=3$,$m=1$. In this case there are 4 possible throwing orderings: AAAB,AABA,ABAA,BAAA. The "draw" condition occurs only if they both fail all their attempts. And I think that $P(A<B)$ should not be proportional to $p_2$ since it can't be $0$ if $p_2 = 0$. – Francesco Aug 9 '16 at 20:40