# Abrazolica

Getting Back to Zero

An interesting gambling question came up recently. Let's say you are playing a game with a probability $$p$$ of winning and $$q=1-p$$ of losing. After playing the game $$2n$$ times, what is the probability that you are right back to where you started? In other words after $$2n$$ games you have neither lost nor won any money. Assuming you always win the same amount that you lose, to get back to zero the number of games played has to be even. That's why I set the number of games at $$2n$$. Let me call $$g_{2n}$$ the probability of getting back to zero after $$2n$$ games, then it's not hard to see that:

$g_{2n} = \binom{2n}{n}p^nq^n$

since $$\binom{2n}{n}$$ is the number of ways of playing $$2n$$ games with $$n$$ wins and $$n$$ losses and each of the ways has a probability of $$p^nq^n$$. When $$n$$ is large you can use Stirling's approximation for factorials to get:

$g_{2n} \approx \frac{(4pq)^n}{\sqrt{\pi n}}$

The interesting thing is when you look at the probability that a return to zero occurs for the first time at game $$2n$$. Call this probability $$f_{2n}$$. The $$g_{2n}$$ and $$f_{2n}$$ probabilities are related as follows

$g_{2n} = f_2g_{2n-2} + f_4g_{2n-4} + f_6g_{2n-6} + \cdots + f_{2n}$

The right hand side of this equation sums up all the ways that a return to zero can occur at game $$2n$$. You can get a first return at game $$2$$ with a return $$2n-2$$ games later or you can get a first return at game $$4$$ with a return $$2n-4$$ games later and so on. This equation lets you relate the probability generating functions for the $$g_{2n}$$ and $$f_{2n}$$ probabilities. The power series expansion of a probability generating function has the probabilities as coefficients of the expansion. If $$G(z)$$ is the generating function for the $$g_{2n}$$ probabilities then its power series expansion would look like:

$G(z) = g_0 + g_2z^2 + g_4z^4 + g_6z^6 + \cdots$

The coefficient of $$z^{2n}$$ in the expansion is $$g_{2n}$$. You can write $$G(z)$$ in the following compact form:

$G(z) = \frac{1}{\sqrt{1-4pqz^2}}$

If $$F(z)$$ is the generating function for the $$f_{2n}$$ probabilities then the above equation for $$g_{2n}$$ means that $$F(z)$$ and $$G(z)$$ must be related as follows

$G(z) - 1 = F(z)G(z)$

If you solve this for $$F(z)$$ you get

$F(z) = 1 - \sqrt{1-4pqz^2}$

If you expand this in a power series you then find that $$f_{2n}$$ is equal to

$f_{2n} = \frac{\binom{2n}{n}}{2n-1}p^nq^n$

This is the probability that you get a return to zero for the first time at game $$2n$$. If you sum the $$f_{2n}$$ probabilities over all values of $$n$$ from 1 to infinity then you get the probability that a return to zero will ever occur. You can get this sum by just evaluating $$F(1)$$

$F(1) = 1 - \left|p-q\right|$

This equation shows that a return to zero is only certain, $$F(1)=1$$, for a fair game where $$p=q=1/2$$. For a game with $$p \ne q$$ you have $$F(1) < 1$$ and it is possible that a return to zero never occurs. The probability of no return to zero is $$\left|p-q\right|$$. So if you are playing a game with the odds against you and you are in the hole but are hoping that some streak of luck will get you back to zero, it may never happen.

© 2010-2012 Stefan Hollos and Richard Hollos