Given two biased coins, find probability that one gets $k$ heads before the other Assume two coins, where the probabilities of flipping heads for the first is $a$ and similarly the heads probability for the second is $b$.
I start flipping the two coins in parallel and want to calculate the probability that the first coin will get $k$ heads before coin $b$.
So far I have the following:
$$\sum_{i=1}^\infty  a^k \cdot \binom{i-1}{k-1} \cdot (1 - a)^{i - k} \cdot \sum_{\tau=0}^{k - 1}  \binom{i}{\tau} \cdot b^\tau \cdot (1 - b)^{i - \tau}  $$
I ended up with this formula thinking that, given the round $i$ when the first coin gets its $k$-th head, I need to ensure that the second coin has at most $k-1$ heads; then, summing for $i$ up to infinity I get all the possible rounds when this is true.
I am not completely sure if my thought process is correct though. Also I don't know how to evaluate the infinite sum or what kind of limits I can use for such probabilities.
Any help is much appreciated. Thanks in advance.
 A: For $k=1$:
Let $P_A$ be the probability that $A$ eventually wins the game.
Consider the possible outcomes of the first toss (of the two coins).  $A$ wins the game with probability $a(1-b)$, $A$ loses the game with probability $(1-a)b+ab=b$ and the game restarts with probability $(1-a)(1-b)$ in which scenario the probability of $A$ eventually winning is $P_A$ again.  Thus $$P_A=a(1-b)\times 1+b\times 0+(1-a)(1-b)\times P_A\implies P_A=\frac {a(1-b)}{1-(1-a)(1-b)}$$
A: Your formula is right. 
But it's not very useful for numerical computation.
Let's call $P_{x,y}$ the probability of the first player winning, given that the first player still needs to get $x$ heads, and the second needs $y$ heads.
Then we  have the boundary conditions: $P_{x,0}=0$ and $P_{0,y}=1$ for $y>0$. 
Elsewhere, for $x,y>0$:
$$ P_{x,y}=
a \, b \, P_{x-1,y-1} + a \, \overline{b} \,P_{x-1,y} +\overline{a} \,  b \, P_{x,y-1} + \overline a \, \overline b \, P_{x,y} 
$$ 
or 
$$ P_{x,y}=\frac{1}{1- \overline a \, \overline b } \left( 
a \, b \, P_{x-1,y-1} +
a \, \overline{b} \,P_{x-1,y} +\overline{a} \,  b \, P_{x,y-1}
\right)
$$ 
where $\overline a = 1-a$, etc. 
This is apt for numerical computation.
Of course, we are interested in $P_{k,k}$.
Google sheet (editable).
