Q:

Play until one is bust

If player A and B have $a$ and $b$ millions pounds respectively, where $a,b$ are natural numbers. They play a series of games in which the winner receives one million pounds from the loser (draws CAN'T occur). They stop until one player has lost their entire fortune. The probability Player A wins is $0<p<1$ and Probability Player B wins is $q=1-p$, where $q$ and $p$ aren't equal.
I need to find the expected number of games until they stop playing?
Any help will be appreciated. 

A:

(sketch) This is not an easy calculation.  I'll outline one way to do it, but will leave off details (high probability of arithmetic error if nothing else).
At any stage of play, we can describe the state just by saying how many (millions) A has.  Therefore we'll denote states by $(i)$ for $i\in \{0,1,..., a+b\}$ and we will denote by $E[i]$ the expected number of games still to be played from the state $(i)$.  We know that $E[0]=0=E[a+b]$ and we have the recursion: $$E[i]=pE[i+1]+(1-p)E[i-1]+1$$
Of course the answer to the question at hand is $E[a]$.  All we have to do is to solve this recursion.
Oddly, it turns out that $p=\frac 12$ is inconvenient. For the moment, assume that $p≠\frac 12$.
If we play with the recursion long enough we will find that $E[i]=\frac{i}{1-2p}$ is one solution (hence the aversion to $p=\frac 12$). The general solution is then found by looking at the homogeneous equation $$E[i]=pE[i+1]+(1-p)E[i-1]$$  As is the case with simple ODE we look for exponential solutions and we quickly see that the general solution is of the form:
$$E[i]=\frac{i}{1-2p}+C +D\left(\frac{1-p}{p}\right)^i$$
It is "easy" to find the constants $C$ and $D$ from the boundary values and the desired answer follows (after a fair bit of calculating).
Now, if $p=\frac 12$ we have to stare at the recursion even longer before we notice that $E[i]=-i^2$ is a particular solution. Happily in this case a linear solution exists for the homogeneous problem and we get the general form:$$E[i]=-i^2+C+Di$$  That one I'll do!  The boundary conditions come to $$E[0]=0 = C\;\;\;and\;\;\;E[a+b]=0=-(a+b)^2+D(a+b)$$  Whence we see that $D = a+b$  It follows that $$E[a]=-a^2+(a+b)a=ab$$

