Tutorials › Stochastic Processes › Exact Expected-Duration Calculations

Gambler's Ruin · Tutorial 312 of 994

Exact Expected-Duration Calculations

Learn to calculate and check exact expected game durations for finite gambler’s ruin chains with rational win and loss probabilities.

Intermediate 12 min read

What You'll Learn

  • Set up expected-duration recurrences for finite gambler’s ruin games.
  • Convert the recurrence into equations for successive differences.
  • Solve those equations using exact rational arithmetic.
  • Check boundary values and every interior recurrence.
  • Identify and correct a common error in assigning transition probabilities.

From the Game to an Exact Calculation

In a finite gambler’s ruin game, the capital changes by one unit at each play until it reaches either boundary. The expected duration depends on both the starting capital and the win probability. When the probabilities are rational, the first-step equations can be solved exactly: no approximation or simulation is needed. This tutorial focuses on carrying out those calculations and checking each answer against the original equations.

Fix an integer \(N\ge1\). On a probability space \((\Omega,\mathcal{F},\mathbb{P})\), let \((X_n)_{n\ge0}\) be the capital after \(n\) plays, with state space \(S=\{0,1,\ldots,N\}\) and discrete time \(n\). At each play before absorption, the capital increases by \(1\) with probability \(p\) and decreases by \(1\) with probability \(q=1-p\), where \(0<p<1\). States \(0\) and \(N\) are absorbing. The transition rows are \(p_{00}=1\), \(p_{NN}=1\), and, for \(1\le i\le N-1\), \(p_{i,i+1}=p\), \(p_{i,i-1}=q\), with all other entries zero. Thus the boundary rows sum to \(1\), and every interior row sums to \(p+q=1\).

Let \(T=\inf\{n\ge0:X_n\in\{0,N\}\}\), and define \(t_i=\mathbb{E}_i[T]\), where the subscript means \(X_0=i\). In particular, \(t_0=t_N=0\). The natural filtration is \(\mathcal{F}_n=\sigma(X_0,\ldots,X_n)\). For \(1\le i\le N-1\), conditioning on the first play gives the expected-duration recurrence

$$ t_i=1+p\,t_{i+1}+q\,t_{i-1}. $$

The \(1\) counts the play just made. The coefficient \(p\) belongs to the transition to \(i+1\), and \(q\) belongs to the transition to \(i-1\). The boundary conditions are \(t_0=t_N=0\). To use this recurrence reliably, first check that the expected duration is finite, then solve the equations and substitute the proposed values back into every equation.

Theorem: For \(N\ge1\) and \(0<p<1\), the expected absorption time \(t_i\) is finite for each state \(i\), and it is the unique solution of \(t_0=t_N=0\) and \(t_i=1+p\,t_{i+1}+q\,t_{i-1}\) for \(1\le i\le N-1\).

Proof. Write \(q=1-p\), so \(0<q<1\). For any interior state \(i\), the event that the next \(i\) potential tosses are all losses has probability \(q^i\), and on that event the chain reaches \(0\) within \(i\le N\) plays. Here the independent tosses are defined even if the game has already stopped; tosses after absorption do not change the chain. Let \(r=\min(p,q)>0\). Since \(i\le N\), \(q^i\ge q^N\), and since \(q\ge r\), \(q^N\ge r^N\). Consequently, from every interior state the probability of absorption within the next \(N\) steps is at least \(\delta=r^N>0\). Applying the same bound conditionally at successive multiples of \(N\) gives \(\mathbb{P}_i(T>kN)\le(1-\delta)^k\) for every integer \(k\ge0\). For a nonnegative integer-valued random variable, \(\mathbb{E}_i[T]=\sum_{n\ge0}\mathbb{P}_i(T>n)\). Grouping terms into blocks of \(N\), this sum is at most \(N\sum_{k\ge0}(1-\delta)^k=N/\delta<\infty\). Conditioning on the first step is therefore valid and gives the stated recurrence. To prove uniqueness, subtract any two solutions. Their difference \(x_i\) has \(x_0=x_N=0\) and satisfies \(x_i=p x_{i+1}+q x_{i-1}\). If some \(x_i>0\), a positive maximum is attained at an interior state. Because \(p,q>0\), an average of the two neighboring values can equal that maximum only if both neighbors equal it. Repeating this implication reaches a boundary, contradicting its value \(0\). If some \(x_i<0\), apply the same argument to a negative minimum. Thus \(x_i=0\) for all \(i\), proving uniqueness. \(\square\)

Solving by Successive Differences

Instead of solving directly for all the \(t_i\), define the successive differences \(d_i=t_i-t_{i-1}\) for \(1\le i\le N\). This turns the second-order recurrence into a first-order recurrence. It also makes the boundary condition easy to enforce: because \(t_0=t_N=0\), the differences must sum to zero.

Calculation rule: For \(1\le i\le N-1\), the duration recurrence is equivalent to \(p\,d_{i+1}-q\,d_i=-1\). After finding \(d_1,\ldots,d_N\), impose \(\sum_{i=1}^N d_i=0\), then recover \(t_i=\sum_{j=1}^i d_j\).

Proof. Substitute \(t_{i+1}=t_i+d_{i+1}\) and \(t_{i-1}=t_i-d_i\) into \(t_i=1+p\,t_{i+1}+q\,t_{i-1}\). Using \(p+q=1\), the right side becomes \(1+(p+q)t_i+p\,d_{i+1}-q\,d_i=1+t_i+p\,d_{i+1}-q\,d_i\). Subtracting \(t_i\) from both sides gives \(p\,d_{i+1}-q\,d_i=-1\). Also, \(\sum_{i=1}^N d_i=\sum_{i=1}^N(t_i-t_{i-1})=t_N-t_0=0\). Conversely, if the differences satisfy these equations and sum to zero, defining \(t_0=0\) and \(t_i=\sum_{j=1}^i d_j\) gives \(t_N=0\), and reversing the substitution gives every interior duration equation. The theorem’s uniqueness then identifies these values with the expected durations. \(\square\)

The method is particularly useful for exact arithmetic. Each step is linear, and the final sum determines the one initially unknown difference \(d_1\). The examples below show the full calculation, followed by checks in the original first-step equations.

Worked Example: A Four-Unit Game with Win Probability Two-Thirds

Let \(N=4\), \(p=\tfrac23\), and \(q=\tfrac13\). The states are \(0,1,2,3,4\). The transition rows are \(0\to0\) with probability \(1\); \(1\to2\) with probability \(\tfrac23\) and \(1\to0\) with probability \(\tfrac13\); \(2\to3\) with probability \(\tfrac23\) and \(2\to1\) with probability \(\tfrac13\); \(3\to4\) with probability \(\tfrac23\) and \(3\to2\) with probability \(\tfrac13\); and \(4\to4\) with probability \(1\). Each interior row sums to \(\tfrac23+\tfrac13=1\), and each boundary row sums to \(1\).

The difference recurrence is \(\tfrac23d_{i+1}-\tfrac13d_i=-1\), or \(d_{i+1}=\tfrac12d_i-\tfrac32\). Writing \(d_1=x\), compute each difference:

$$ d_2=\frac{x}{2}-\frac32,\qquad d_3=\frac{x}{4}-\frac94,\qquad d_4=\frac{x}{8}-\frac{21}{8}. $$

The boundary condition requires \(d_1+d_2+d_3+d_4=0\). Substitution gives \(\tfrac{15}{8}x-\tfrac{12+18+21}{8}=0\), so \(\tfrac{15}{8}x=\tfrac{51}{8}\) and \(x=\tfrac{17}{5}\). Therefore \(d_1=\tfrac{17}{5}\), \(d_2=\tfrac{17}{10}-\tfrac{15}{10}=\tfrac15\), \(d_3=\tfrac{17}{20}-\tfrac{45}{20}=-\tfrac75\), and \(d_4=\tfrac{17}{40}-\tfrac{105}{40}=-\tfrac{11}{5}\). Their sum is \(\tfrac{17+1-7-11}{5}=0\). Accumulating from \(t_0=0\) gives \(t_1=\tfrac{17}{5}\), \(t_2=\tfrac{18}{5}\), \(t_3=\tfrac{11}{5}\), and \(t_4=0\).

Check in the original recurrence: At state \(1\), \(1+\tfrac23t_2+\tfrac13t_0=1+\tfrac{12}{5}=\tfrac{17}{5}=t_1\). At state \(2\), \(1+\tfrac23t_3+\tfrac13t_1=1+\tfrac{22}{15}+\tfrac{17}{15}=\tfrac{18}{5}=t_2\). At state \(3\), \(1+\tfrac23t_4+\tfrac13t_2=1+\tfrac65=\tfrac{11}{5}=t_3\). The boundary values are \(t_0=t_4=0\), as required.

Worked Example: A Three-Unit Game with Win Probability Three-Fifths

Let \(N=3\), \(p=\tfrac35\), and \(q=\tfrac25\). The boundary rows are \(0\to0\) and \(3\to3\), each with probability \(1\). The interior rows are \(1\to2\) with probability \(\tfrac35\), \(1\to0\) with probability \(\tfrac25\); and \(2\to3\) with probability \(\tfrac35\), \(2\to1\) with probability \(\tfrac25\). Both interior rows sum to \(\tfrac35+\tfrac25=1\).

The difference equation is \(\tfrac35d_{i+1}-\tfrac25d_i=-1\), or \(d_{i+1}=\tfrac23d_i-\tfrac53\). Put \(d_1=x\). Then \(d_2=\tfrac23x-\tfrac53\), and \(d_3=\tfrac23(\tfrac23x-\tfrac53)-\tfrac53=\tfrac49x-\tfrac{25}{9}\). Enforcing \(d_1+d_2+d_3=0\) gives \(\tfrac{19}{9}x-\tfrac{15+25}{9}=0\), hence \(x=\tfrac{40}{19}\). It follows that \(d_2=\tfrac{80}{57}-\tfrac{95}{57}=-\tfrac5{19}\) and \(d_3=\tfrac{160}{171}-\tfrac{475}{171}=-\tfrac{35}{19}\). The sum is \(\tfrac{40-5-35}{19}=0\), so \(t_1=\tfrac{40}{19}\), \(t_2=\tfrac{35}{19}\), and \(t_3=0\).

Check: At state \(1\), \(1+\tfrac35t_2+\tfrac25t_0=1+\tfrac{21}{19}=\tfrac{40}{19}\). At state \(2\), \(1+\tfrac35t_3+\tfrac25t_1=1+\tfrac{16}{19}=\tfrac{35}{19}\). Both recurrences hold, and the two boundary values are zero.

Worked Example: A Three-Unit Game with Win Probability Three-Fourths

Now take \(N=3\), \(p=\tfrac34\), and \(q=\tfrac14\). The boundary rows are \(0\to0\) and \(3\to3\), each with probability \(1\). From state \(1\), the chain goes to \(2\) with probability \(\tfrac34\) and to \(0\) with probability \(\tfrac14\). From state \(2\), it goes to \(3\) with probability \(\tfrac34\) and to \(1\) with probability \(\tfrac14\). Each interior row sums to \(\tfrac34+\tfrac14=1\).

Here \(\tfrac34d_{i+1}-\tfrac14d_i=-1\), so \(d_{i+1}=\tfrac13d_i-\tfrac43\). Set \(d_1=x\). Then \(d_2=\tfrac13x-\tfrac43\) and \(d_3=\tfrac13(\tfrac13x-\tfrac43)-\tfrac43=\tfrac19x-\tfrac{16}{9}\). The boundary condition becomes \(\tfrac{13}{9}x-\tfrac{12+16}{9}=0\), giving \(x=\tfrac{28}{13}\). Thus \(d_2=\tfrac{28}{39}-\tfrac{52}{39}=-\tfrac8{13}\), and \(d_3=\tfrac{28}{117}-\tfrac{208}{117}=-\tfrac{20}{13}\). The sum \(\tfrac{28-8-20}{13}=0\) checks the upper boundary. Therefore \(t_1=\tfrac{28}{13}\), \(t_2=\tfrac{20}{13}\), and \(t_3=0\).

Check: At state \(1\), \(1+\tfrac34t_2+\tfrac14t_0=1+\tfrac{15}{13}=\tfrac{28}{13}\). At state \(2\), \(1+\tfrac34t_3+\tfrac14t_1=1+\tfrac7{13}=\tfrac{20}{13}\). The boundary values are again zero.

Reading and Checking the Answer

The values \(t_i\) are expected numbers of plays, not probabilities. A value such as \(\tfrac{28}{13}\) is therefore meaningful even though a realized game lasts an integer number of plays: an expectation can be noninteger. In these examples, the starting state matters because the boundaries are at different distances, and the direction of the bias matters because it changes which boundary is reached more readily.

A practical check has three parts. First, verify the transition probabilities: every boundary row must sum to \(1\), and each interior row must sum to \(p+q=1\). Second, check the two boundary values \(t_0=t_N=0\). Third, substitute the calculated values into every interior recurrence, not just the recurrence at the starting state. Exact fractions make discrepancies visible instead of hiding them through rounding.

Common mistake: reversing the win and loss probabilities. In the last example, a mistaken first-step equation at state \(1\) might be written as \(t_1=1+\tfrac14t_2+\tfrac34t_0\). Substituting the calculated values into that incorrect equation gives \(1+\tfrac14\cdot\tfrac{20}{13}+\tfrac34\cdot0=\tfrac{18}{13}\), not \(t_1=\tfrac{28}{13}\). The transition description says a win, of probability \(\tfrac34\), takes state \(1\) to state \(2\); a loss, of probability \(\tfrac14\), takes it to state \(0\). The correct equation is \(t_1=1+\tfrac34t_2+\tfrac14t_0\), and its right side is \(1+\tfrac{15}{13}=\tfrac{28}{13}\). Always attach each probability to its destination before solving.

The recurrence calculation is not a substitute for checking the model. If either boundary were not absorbing, or if a play could change capital by more than one unit, the transition equations would differ. Here the finite state space, the absorbing boundary rows, and the two specified one-unit moves are exactly the conditions used in the calculations.

Check Your Understanding

For each calculation, use the stated transition probabilities and check the boundary values as well as the interior equations.

  1. For \(N=2\), \(p=\tfrac12\), and \(q=\tfrac12\), find \(t_1\) from the first-step equation.
  2. In the \(N=3\), \(p=\tfrac35\) example, verify directly that the differences sum to zero and recover \(t_2\).
  3. For a general interior state, derive \(p\,d_{i+1}-q\,d_i=-1\) from the duration recurrence.
  4. Explain why the boundary condition on the differences is \(\sum_{i=1}^N d_i=0\).
  5. In the \(N=3\), \(p=\tfrac34\) example, write the correct first-step equation at state \(2\) and verify it using the calculated values.