Quoto

Learn / Library / Expected value

Bankroll random walk

Expected valueHard

You start with a bankroll of . Each round a fair coin is flipped independently: heads wins , tails loses . You stop as soon as the bankroll reaches or . What is the expected number of rounds played?

Checking an answer needs JavaScript. The hint and the solution open without it.

A whole number, a decimal, a fraction like 3/8 or a percent.

Hint

Look for a function of the bankroll that drops by exactly on average each round and vanishes at both boundaries.

Solution
  1. Let be the expected remaining rounds from bankroll , with .
  2. For , .
  3. Try . The average of neighbours is , which fits the recurrence, and it vanishes at both ends.
  4. So .
  5. The expected number of rounds is .

Answer: