Gamblers ruin formula Hello , I have been reading about gamblers ruin and I found this formula
can anyone confirm its accuracy ?   I assume they only bet one chip a time 

 A: To derive that formula, let $A(n)$ be the probability that Anne wins if she started with $n$ coins; clearly $A(32) =1$ since Carol has nothing to bet, and $A(0) = 0$ since Anne has nothing to bet.  We are looking to determine $A(23)$.
Equally clearly, if $0 < n < 32$, then after one betting outcome the players are playing the same game but with a starting $n$ which is one different from the original $n$, so for $0 < n < 32$,
$$
A(n) = \frac{5}{12} A(n+1) + \frac{7}{12} A(n-1) = pA(n+1)+qA(n-1)
$$
which we can re-arrange (by solving for $A(n+1)$) to
$$
A(n+1) =  \frac{1}{p}A(n) - \frac{q}{p}A(n-1) = \frac{p+q}{p}A(n) + \frac{q}{p}A(n-1)
\\ 
 A(n+1) = A(n)+\frac{q}{p} \left[ A(n) - A(n-1) \right] 
$$
Now let's look in particular at the difference $A(2)-A(1)$ (this is the clever step in the proof):
$$
 A(n+1) - A(n)=\frac{q}{p} \left[ A(n) - A(n-1) \right] 
$$
$$
A(2) - A(1)  =  pA(2)+qA(0) =  \frac{q}{p} \left[ A(1) - A(0) \right] =  \frac{q}{p}A(1)
$$
and then
$$
A(3) - A(2)  =  \frac{q}{p} \left[ A(2) - A(1) \right] = \left( \frac{q}{p} \right)^2 A(1) \\A(4) - A(3)   = \left( \frac{q}{p} \right)^3 A(1) 
 $$
and eventually $$ A(32) - A(31) = \left( \frac{q}{p} \right)^{31} A(1)$$
But that means (by telescoping the differences) that 
$$A(32) = \sum_{i=1}^{31}\left( \frac{q}{p} \right)^{31} A(1)$$ and of 
of course $A(32) = 1$ from above.
The geometric sum for the expression for $A(32)$ can be expressed in closed form, and this gives an equation which can be solved for $A(1)$.  That in turn leads to the formula for all the $A(n)$, which is the formula you were concerned with. 
