# Gambler in a casino

Suppose that a gambler visits casino X and Y alternately. He wins 2 dollar at casino X with probability $p_x$ and get nothing with probability $1-p_x$. The same at casino Y with probability $p_y$ and $1-p_y$. He starts at casino X with two dollar. Every trial costs 1 dollar in both casinos. He stops if he has zero dollar or if he has five dollar. What is the probability that he ends with five dollar?

We interpret "wins two dollars" as meaning wins a net one dollar, because of the one dollar fee per trial. It follows that if we have $2$ or $4$ dollars, we are about to enter Casino $X$, and if we have $1$ or $3$ dollars we are about to enter $Y$.

Introduce $4$ variables $w_1,w_2,w_3,w_4$, where $w_k$ is the probability of ultimately ending up with $5$ dollars if we have $k$ dollars. We are only interested in $w_2$, but it is useful to consider all four.

Now we write down a bunch of transition equations. For example, if we have $2$ dollars, we will either have a net gain of a dollar (probability $p_x$) or a net loss of a dollar (probability $1-p_x$). That gives the simple linear equation $$w_2=p_x w_3+(1-p_x)w_1.$$ More simply, if we have a dollar, and are therefore about to enter $Y$, we either lose, in which case we will never have $5$ dollars, or we can win. That gives equation $$p_1=p_yw_2.$$ We end up with $4$ equations in $4$ unknowns. Solve. It is not hard, mechanical substitution will do it, since two of the equations are particularly simple.

Added: The equations are 1) $w_1=p_y w_2$; 2) $w_2=p_xw_3+(1-p_x)w_1$; 3) $w_3=p_y w_4+(1-p_y)w_2$; and finally 4) $w_4=p_x+(1-p_x)w_3$. The last equation holds because if we have $4$ dollars and win the next game, we end up with $5$ dollars for sure, while if we lose we have $3$ dollars left. If you like you can think of the $p_x$ as $p_x\cdot 1$.

Replace $w_1$ in Equation 2) by $p_yw_2$. Replace $w_4$ in Equation 3) by $p_x+(1-p_x)w_3$, and simplify. We end up with two linear equations in two unknowns $w_2$ and $w_3$. Solve in any of the usual ways. Life will be easier if you write $q_x$ for $1-p_x$ and $q_y$ for $1-p_y$.

• What if, at the start when he has 2 dollars, he wins 2 dollars at casino X, then loses 1 dollars at casino Y; Would he then not first enter casino Y with 4 dollars, and then enter casino enter casino X with 3 dollars, as he visits them alternately? – JohnWO Sep 24 '15 at 23:42
• I am interpreting wins two dollars as a net of $1$ dollar, because of the one dollar fee. If it is a net win of $2$ dollars, we need more variables since we also need to know what casino we will enter next, but the basic strategy is the same. – André Nicolas Sep 24 '15 at 23:46
• @AndréNicolas: I almost got it. I guess the two simple equations are $w_1 = p_y w_2$ and $w_4 = (1-p_x) w_3$. Not sure about $w_4$. Is it possible to find an expression for $w_2$ as function of only $p_x$ and $p_y$? Substitutions gives expressions for the $w_i$ as function of $w_j$, $i \neq j$. – clubkli Sep 25 '15 at 13:00
• Sorry, I did not get your message, despite the correct addressing. Will add to the answer, since typing in comments is unpleasant, particularly if one is typo-prone. – André Nicolas Sep 25 '15 at 17:48

I would begin whit a three diagram, so in each trial I would consider the possibility of winning or losing. Then, notice than winning or losing in casino X is independent of winning or losing in casino Y. So probability of intersection is product of probabilities.

After each casino visit, the gambler's money either increases by \$1 or decreases by \$1. Meaning that after each visit to Casino X, he has an odd amount of money, and after each visit to Casino Y, he has an even amount. That's useful to know, because it means he can only go bust after losing at Casino Y, and can only cash out after winning at Casino X.

Then we can describe the transition probabilities between the possible dollar amounts as (where $p_{ij}$ is the probability of going to \$j from \$i):

$p_{10} = p_{32} = 1 - p_y \\ p_{12} = p_{34} = p_y \\ p_{21} = p_{43} = 1 - p_x \\ p_{23} = p_{45} = p_y \\ p_{00} = p_{55} = 1$

With all other values being 0. So you can then just muck about with the transition matrix to see what the equilibrium state is, which will be a combination of the probabilities of being at \$0 and \$5.