Steven R. Dunbar
Department of Mathematics
203 Avery Hall
University of Nebraska-Lincoln
Lincoln, NE 68588-0130
Probability Theory and Stochastic Processes
Steven R. Dunbar
Duration of the Gambler’s Ruin
Mathematically Mature: may contain mathematics beyond calculus with proofs.
Consider a gambler who wins or loses a dollar on each turn of a fair game with probabilities and respectively. Let his initial capital be $10. The game continues until the gambler’s capital either reduces to 0 or increases to $20. What is the length of the shortest possible game the gambler could play? What are the chances of this shortest possible game? What is the length of the second shortest possible game? How would you ﬁnd the probability of this second shortest possible game occurring?
Start with a sequence of Bernoulli random variables, where with probability and with probability . Start with an initial value and set for convenience. We deﬁne the sequence of sums . The goal is to understand the stochastic process . Look at how many trials the process will experience until it achieves the value or . In symbols, consider . Look at the expected value of the number of trials, . This is a special case of a larger class of probability problems called ﬁrst-passage distributions for ﬁrst-passage times.
The principle of ﬁrst-step analysis, also known as conditional expectations, provides equations for important properties of coin-ﬂipping games and random walks. The important properties include ruin probabilities and the duration of the game until ruin. Diﬀerence equations derived from ﬁrst-step analysis or conditional expectations provide the way to deduce the expected length of the game in the gambler’s ruin, just as for the probability of ruin or victory. Expectation by conditioning is the process of deriving a diﬀerence equation for the expectation by conditioning the outcome over an exhaustive, mutually exclusive set of events, each of which leads to a simpler probability calculation, then weighting by the probability of each outcome of the conditioning events. First Step Analysis is how J. Michael Steele refers to the simple expectation by conditioning process that we use to analyze the ruin probabilities and expected duration. It is a more speciﬁc description for coin-tossing games of the more general technique of expectation by conditioning.
Note that the following implicitly assumes that the expected duration of the game is ﬁnite. This fact is true, see below for a proof.
Proof. If the ﬁrst trial results in success, the game continues as if the initial position had been . The conditional expectation of the duration conditioned on success at the ﬁrst trial is therefore . Likewise if the ﬁrst trial results in a loss, the duration conditioned on the loss at the ﬁrst trial is .
This argument shows that the expected duration satisﬁes the diﬀerence equation, obtained by expectation by conditioning
with the boundary conditions
The appearance of the term 1 makes the diﬀerence equation non-homogeneous. Taking a cue from linear algebra, or more speciﬁcally the theory of linear non-homogeneous diﬀerential equations, we need to ﬁnd the general solution to the homogeneous equation
and a particular solution to the non-homogeneous equation. We already know the general solution to the homogeneous equation is . The best way to ﬁnd the particular solution is inspired guessing, based on good experience. Re-write the non-homogeneous equation for the particular solution as
The right side is a weighted second diﬀerence, a diﬀerence equation analog of the second derivative. Functions whose second derivative is a constant are quadratic functions. Therefore, it make sense to try a function of the form . The exercises show that the particular solution is actually if .
It follows that the general solution of the duration equation is:
The boundary conditions require that
Solving for and ,
The calculations are not valid if . In this case, the particular solution no longer makes sense for the equation
The reasoning about the particular solution remains the same however, and the particular solution is . It follows that the general solution is of the form . The required solution satisfying the boundary conditions is
Proof. Pass to the limit in the preceding formulas. □
The following discussion of ﬁniteness of the duration of the game is adapted from  by J. Michael Steele.
The arguments for the probability of ruin or the duration of the game have a logical gap, assuming that the duration of the game is ﬁnite. Is it sure that the gambler’s net winnings will eventually reach or ? This important fact requires proof.
The proof uses a common argument in probability, an “extreme case argument”. Identify an “extreme” event with a small but positive probability of occurring. A complementary “good” event avoids the extreme event. Therefore the complementary “good” avoidance event must happen with probability not quite . The avoidance must happen inﬁnitely many independent times, but the probability of such a run of “good” events must go to zero.
For the gambler’s ruin, the event of interest is the game continuing forever. Consider the extreme event that the gambler wins times in a row. If the gambler is not already ruined (at ), then such a streak of wins in a row is guaranteed to boost his fortune above and end the game in victory for the gambler. Such a run of luck is unlikely, but it has positive probability, in fact, probability . Let denote the event that the gambler wins on each turn in the time interval , so the are independent events. Hence the complementary events are also independent. Then at least implies that all of the with fail to occur. Thus, we ﬁnd
for all . Hence, , justifying the earlier assumption that the duration must be ﬁnite.
The duration can be considerably longer than naively expected. For instance in a fair game, with two players with $500 each ﬂipping a coin until one is ruined, the average duration of the game is 250,000 trials. If a gambler has only $1 and his adversary $1000, with a fair coin toss, the average duration of the game is 999 trials, although some games will be quite short! Very long games can occur with suﬃcient probability to give a long average.
Stand on a large clock, say on the . Now ﬂip a coin and move ahead one hour if the coin turns up heads, and back one hour otherwise. Keep repeating the process until the walk visits all numbers. How long, on average, will this random walk take? If you generalize to clocks with positions (for the number of Hours), how does the expected time depend on ?
Let be the set of hour marks visited at time , that is, the collection of all vertices already visited up to this time. Let the random variable for be the ﬁrst time to visit distinct vertices. Then for example it is always the case that , and . The goal is to calculate .
The key realization is that the relation between and is simple. Consider the situation at time for . The walk has visited vertices and we are at one extreme of the contiguous set of vertices in . Adding labels, without loss of generality, say the walk is at , and the walk has visited . The next increment is the ﬁrst time the walk hits either or (Note that in the case of , these are the same vertex, but that is irrelevant). Therefore from the basic fact stated above: . Adding all the increments, the sum telescopes on the left to give the sum on the right
for . In particular, .
Remark. This conclusion is intuitively plausible for the following reason. At a given time, the “width” or span of the visited sites should be proportional to the square root of the time. In order to visit the full “width” or span of sites on either side of the starting point, it should take about time about . The example makes it explicit and precise.
The following example appeared as a weekly puzzle at the website FiveThirtyEight, The Riddler, August 4, 2017..
A class of children is playing a game where they all stand in a circle along with their teacher. The teacher is holding two things: a coin and a potato. The game progresses like this: The teacher tosses the coin. Whoever holds the potato passes it to the left if the coin comes up heads and to the right if the coin comes up tails. The game ends when every child except one has held the potato, and the one who hasn’t is declared the winner. How do a child’s chances of winning change depending on where they are in the circle? In other words, what is each child’s win probability?
In the previous section on the probability of ruin applied to show that the probability of any particular child winning the game is . Now the previous analysis shows that the expected duration of the game, when the potato has been in the hands of the teacher and exactly children, leaving only the winner, is steps or passes of the potato.
This section is adapted from  with additional background information from . The example of the walks on a circle is adapted from John Cook, Walks on a Clock. with additional comments from Jeﬀ Garrett. The example of the coin and potato game appeared as a weekly puzzle at the website FiveThirtyEight, The Riddler, August 4, 2017..
The goal is to simulate the duration until ruin or victory as a function of starting value. First set the probability , number of Bernoulli trials , and number of experiments . Set the ruin and victory values and , also interpreted as the boundaries for the random walk. For each starting value from ruin to victory, ﬁll an matrix with the Bernoulli random variables. Languages with multi-dimensional arrays keep the data in a three-dimensional array of size . Cumulatively sum the Bernoulli random variables to create the fortune or random walk. For each starting value, for each random walk or fortune path, ﬁnd the duration until ruin or victory. For each starting value, ﬁnd the mean of the duration until ruin or victory. Finally, ﬁnd a least squares polynomial ﬁt for the duration as a function of the starting value.
R script for duration..
Octave script for ruin probabilities.
Perl PDL script for ruin probabilities.
Scientiﬁc Python script for ruin probabilities.
Python script for random walk on a clock.
Use “ﬁrst step analysis” to write three equations in three unknowns (with two additional boundary conditions) that give the expected duration of the game that the gambler plays. Solve the equations to ﬁnd the expected duration.
Consider a naive model for a stock that has a support level of $20/share because of a corporate buy-back program. (This means the company will buy back stock if shares dip below $20 per share. In the case of stocks, this reduces the number of shares outstanding, giving each remaining shareholder a larger percentage ownership of the company. This is usually considered a sign that the company’s management is optimistic about the future and believes that the current share price is undervalued. Reasons for buy-backs include putting unused cash to use, raising earnings per share, increasing internal control of the company, and obtaining stock for employee stock option plans or pension plans.) Suppose also that the stock price moves randomly with a downward bias when the price is above $20, and randomly with an upward bias when the price is below $20. To make the problem concrete, we let denote the stock price at time , and we express our stock support hypothesis by the assumptions that
We then reﬂect the downward bias at price levels above $20 by requiring that for :
We then reﬂect the upward bias at price levels below $20 by requiring that for :
Using the methods of “single-step analysis” calculate the expected time for the stock to fall from $25 through the support level all the way down to $18. (There is no reasonable way to solve this problem using formulas. Instead you will have to go back to basic principles of single-step or ﬁrst-step analysis to solve the problem.)
I check all the information on each page for correctness and typographical errors. Nevertheless, some errors may occur and I would be grateful if you would alert me to such errors. I make every reasonable eﬀort to present current and accurate information for public use, however I do not guarantee the accuracy or timeliness of information on this website. Your use of the information from this website is strictly voluntary and at your risk.
I have checked the links to external sites for usefulness. Links to external websites are provided as a convenience. I do not endorse, control, monitor, or guarantee the information contained in any external website. I don’t guarantee that the links are active at all times. Use the links here with the same caution as you would all information on the Internet. This website reﬂects the thoughts, interests and opinions of its author. They do not explicitly represent oﬃcial positions or policies of my employer.
Information on this website is subject to change without notice.
Steve Dunbar’s Home Page, http://www.math.unl.edu/~sdunbar1
Email to Steve Dunbar, sdunbar1 at unl dot edu
Last modiﬁed: Processed from LATEX source on September 28, 2017