Gambler's Ruin variation

Gambler $A$ has a dollars, gambler $B$ $- b$ dollars. $P(A \text{ wins}) = p$. When a player loses, he loses 1 dollar, when a player wins, his fortune does not change. Find Expected number of plays until $B$ has 0 dollars.

So if Ei - event that in first $(b+i)$ games, $B$ loses $b$ times (therefore $B$'s result is 0 dollars) $A' - A$ wins

$$P(A') = \sum_{i=0}^{a-1} \binom{i+b-1}{b-1} p^bq^i$$

N = # of games until B ruined then the Expected value is $E(N) =\sum_{i=b}^{b+a-1} i \binom{i+b-1}{b-1} p^bq^{i-b}$.

how can I get this expectation in closed form? does this seem to be correct at all?

I have calculated the expected value based on A starting with 10 dollars and $B$ with 5, with probability of $A$ winning $=0.3$. So according to my formula above, the expected number of steps until $B$ is ruined is actually less than 5, which seems to be impossible. How can the expected number of steps be less than the minimum $(5)$ number of steps ?

• I do not understand the problem. Player A may go broke. So the random variable $N$ has not been defined. For the conditional expectation of the length of the game, given that B goes broke, divide the "expected value" (which is not really an expected value) that you calculated by your $P(A')$. That should yield a number that accords better with the intuition. – André Nicolas Oct 21 '13 at 21:53
• @AndréNicolas I'm sorry, but I have problems understanding the reasoning behind your suggestion. I agree with you that we should probably calculate the number of games until B goes broke with the assumption the he goes broke, but why dividing by P(A') which is the probability of B going broke? – dark blue Oct 22 '13 at 1:41
• @André Nicolas I'm sorry, but I have problems understanding the reasoning behind your suggestion. I agree with you that we should probably calculate the number of games until B goes broke with the assumption the he goes broke, but why dividing by P(A') which is the probability of B going broke? – dark blue Oct 22 '13 at 1:42
• The conditional probability that she goes broke in $b+i$ trials, given that she goes broke, is $\binom{b+i-1}{b-1}p^bq^{i}$ divided by $P(A')$. So we need $\frac{1}{P(A')}\sum_{i=0}^{a-1}(b+i)\binom{b+i-1}{b-1}p^bq^{i}$. – André Nicolas Oct 22 '13 at 1:53
• The last expression I wrote is an expected value. The $(b+i)$ term produces the expectation, the $\binom{b+i-1}{b-1}p^bq^i$ is the probability term. – André Nicolas Oct 22 '13 at 2:06

We should be able to get a quick answer for the case when Player A has infinite capital. The number of steps until B's stake is gone will be a negative binomial random variable. The expected value is given by $$E[T]={b(1-p) \over p}$$ For the example you give we get $$E[T]={5(0.7) \over 0.3}= 11.6667$$
Follow-Up: Using Andre's definition of $N$ and his solution, the mean number of steps before B runs out, conditioned on B losing, is $$E[T] = 11.1584$$