Skip to content
← Back to all questions
FreeProbabilityHard

At Least Six II

Asked atCitadelJump Trading

Question

You roll a fair nn-sided die (faces 1,2,…,n1, 2, \dots, n) again and again, keeping a running total. Let TT be the number of rolls it takes for the total to reach nn or more. Find E[T]E[T] as a formula in nn. What is its value for n=18n = 18?

Solution

Try it yourself first. Open a hint if you get stuck.

Hint 1

Work backwards from the target. Let EiE_i be the expected number of further rolls when the running total is ii, so Ei=0E_i = 0 once i≥ni \ge n. What is En−1E_{n-1}, and how does EiE_i depend on the totals above it?

Hint 2

Compute En−1E_{n-1}, En−2E_{n-2} and En−3E_{n-3} and spot the pattern. To prove it, write the equations for two neighbouring totals and subtract: almost everything cancels.

Show solution

Method 1: work backwards (recursion and induction). This is the same approach as At Least Six I, generalised.

Let EiE_i be the expected number of further rolls when the running total is ii. We stop once the total reaches nn, so Ei=0E_i = 0 for i≥ni \ge n. From a total i<ni < n you always spend one roll, then land on i+1,…,i+ni + 1, \dots, i + n with chance 1n\tfrac1n each, and only landings below nn add anything:

Ei=1+1n(Ei+1+Ei+2+⋯+En−1).E_i = 1 + \tfrac1n\big(E_{i+1} + E_{i+2} + \dots + E_{n-1}\big).

The first few values.

  • En−1=1E_{n-1} = 1, since any roll finishes.
  • En−2=1+1nEn−1=n+1nE_{n-2} = 1 + \tfrac1n E_{n-1} = \tfrac{n+1}{n}.
  • En−3=1+1n(En−1+En−2)=1+1n+n+1n2=(n+1)2n2E_{n-3} = 1 + \tfrac1n\big(E_{n-1} + E_{n-2}\big) = 1 + \tfrac1n + \tfrac{n+1}{n^2} = \tfrac{(n+1)^2}{n^2}.

The pattern suggests

En−k=(n+1n)k−1,k=1,2,…,n.E_{n-k} = \left(\frac{n+1}{n}\right)^{k-1}, \qquad k = 1, 2, \dots, n.

Proof by induction. The base case k=1k = 1 is En−1=1E_{n-1} = 1. For the step, write the equations for two neighbouring totals, n−kn - k and n−k+1n - k + 1:

En−k=1+1n(En−1+⋯+En−k+2+En−k+1),E_{n-k} = 1 + \tfrac1n\big(E_{n-1} + \dots + E_{n-k+2} + E_{n-k+1}\big),
En−k+1=1+1n(En−1+⋯+En−k+2).E_{n-k+1} = 1 + \tfrac1n\big(E_{n-1} + \dots + E_{n-k+2}\big).

The two sums are the same except for the last term En−k+1E_{n-k+1}. Subtracting the second equation from the first, everything else cancels:

En−k−En−k+1=1nEn−k+1,soEn−k=n+1n En−k+1.E_{n-k} - E_{n-k+1} = \tfrac1n E_{n-k+1}, \qquad\text{so}\qquad E_{n-k} = \frac{n+1}{n}\, E_{n-k+1}.

So each step back from the target multiplies the expected number of rolls by n+1n\tfrac{n+1}{n}. If En−k+1=(n+1n)k−2E_{n-k+1} = \left(\tfrac{n+1}{n}\right)^{k-2}, then En−k=(n+1n)k−1E_{n-k} = \left(\tfrac{n+1}{n}\right)^{k-1}, which completes the induction.

Answer. Starting from total 00 means k=nk = n:

E[T]=E0=(n+1n)n−1=(1+1n)n−1.E[T] = E_0 = \left(\frac{n+1}{n}\right)^{n-1} = \left(1 + \frac1n\right)^{n-1}.

For n=6n = 6 this is (76)5≈2.16139\left(\tfrac76\right)^5 \approx 2.16139, matching At Least Six I. For n=18n = 18:

E[T]=(1918)17≈2.50714.E[T] = \left(\tfrac{19}{18}\right)^{17} \approx 2.50714.

Method 2: count the ways to stay below the target. A second proof, which also explains why the answer is a clean power.

Let SkS_k be the running total after kk rolls, with S0=0S_0 = 0, and write m=n−1m = n - 1 for the largest total that has not yet reached the target.

Step 1: Turn E[T]E[T] into a sum of probabilities. Any whole number T≥1T \ge 1 can be counted as

T=1(T>0)+1(T>1)+1(T>2)+⋯T = \mathbf{1}(T > 0) + \mathbf{1}(T > 1) + \mathbf{1}(T > 2) + \cdots

For example, if T=3T = 3, the terms for 0,1,20, 1, 2 are each 11 and the rest are 00. Taking expectations,

E[T]=∑k≥0P(T>k).E[T] = \sum_{k \ge 0} P(T > k).

And "T>kT > k" means "after kk rolls we still haven't reached nn", i.e. Sk≤mS_k \le m. So

E[T]=∑k≥0P(Sk≤m).E[T] = \sum_{k \ge 0} P(S_k \le m).

Step 2: Count the ways to stay at or below mm. Suppose kk rolls keep the total at most mm. The running totals S1,S2,…,SkS_1, S_2, \dots, S_k are

  • strictly increasing, since every roll is at least 11, and
  • all between 11 and mm.

So they are kk different numbers chosen from {1,…,m}\{1, \dots, m\}.

It also works the other way round. Pick any kk different numbers from {1,…,m}\{1, \dots, m\}, sort them and treat them as the running totals. Each roll is the gap between neighbouring totals, which is at least 11 and at most m=n−1m = n - 1, so it is always a legal face of the die.

That is a one-to-one match, so the number of roll sequences is (mk)\binom{m}{k}, out of nkn^k equally likely sequences:

P(Sk≤m)=(mk)nk.P(S_k \le m) = \frac{\binom{m}{k}}{n^k}.

Check with n=6n = 6, k=2k = 2: (52)=10\binom{5}{2} = 10, and directly, the pairs of rolls with sum at most 55 are 4+3+2+1=104 + 3 + 2 + 1 = 10 out of 3636. They match.

Step 3: Add them up. (mk)=0\binom{m}{k} = 0 once k>mk > m, so

E[T]=∑k=0m(mk)(1n)k=(1+1n)m=(1+1n)n−1,E[T] = \sum_{k=0}^{m} \binom{m}{k}\left(\frac1n\right)^k = \left(1 + \frac1n\right)^{m} = \left(1 + \frac1n\right)^{n-1},

using the binomial theorem (1+x)m=∑k(mk)xk(1 + x)^m = \sum_k \binom{m}{k} x^k with x=1nx = \tfrac1n.

Answer. E[T]=(1+1n)n−1E[T] = \left(1 + \frac1n\right)^{n-1}. For n=6n = 6 this is (76)5≈2.16139\left(\tfrac76\right)^5 \approx 2.16139, matching At Least Six I. For n=18n = 18:

E[T]=(1918)17≈2.50714.E[T] = \left(\tfrac{19}{18}\right)^{17} \approx 2.50714.

As nn grows, (1+1n)n−1\left(1 + \frac1n\right)^{n-1} approaches e≈2.71828e \approx 2.71828, the same answer as adding uniform random numbers until the sum passes 11.