5.2 Martingale and Random walk
Random walk: The process is called a random walk if are IID (identical and independently distributed) random variables and , where . The term comes from the fact that we can think of as the position at time for a walker who makes successive random steps
If takes values 1 and -1 with probabilities and respectively, is called a simple random walk with parameter . Furthermore, if , the process is a symmetric random walk. For symmetric random walk, it’s easy to show that and .5
Symmetric random walk is the process that is most often tested in quantitative interviews. The interview questions on random walk often revolve around finding the first for which reaches a defined threshold , or the probability that reaches for any given value of .
Martingale: a martingale is a stochastic process with the properties that for all and . The property of a martingale can be extended to , which means the conditional expected value of future is the current value .6
A symmetric random walk is a martingale. From the definition of the symmetric random walk we have , so . Since , is a martingale as well.
116Stopping rule: For an experiment with a set of IID random variables , a stopping rule for is a positive integer-value random variable (stopping time) such that for each , the event is independent of . Basically it says that whether to stop at depends only on (i.e., no look ahead).
Wald’s Equality: Let be a stopping rule for IID random variables and let , then .
Since it is an important—yet relatively little known—theorem, let’s briefly review its proof. Let be the indicator function of the event . So can be written as
, where if and if .
From the definition of stopping rules, we know that is independent of (it only depends on ). So and
A martingale stopped at a stopping time is a martingale.
Drunk man
A drunk man is at the 17th meter of a 100-meter-long bridge. He has a 50% probability of staggering forward or backward one meter each step. What is the probability that he will make it to the end of the bridge (the 100th meter) before the beginning (the 0th meter)? What is the expected number of steps he takes to reach either the beginning or the end of the bridge?
Solution: The probability part of the problem—often appearing in different disguises—is among the most popular martingale problems asked by quantitative interviewers. Interestingly, few people use a clear-cut martingale argument. Most candidates either use Markov chain with two absorbing states or treat it as a special version of the gambler’s ruin problem with . These approaches yield the correct results in the end, yet a martingale argument is not only simpler but also illustrates the insight behind the problem.
117Let’s set the current position (the 17th meter) to 0; then the problem becomes a symmetric random walk that stops at either 83 or -17. We also know that both and are martingales. Since a martingale stopped at a stopping time is a martingale, and (where with being the stopping time) are martingales as well. Let be the probability that it stops at , be the probability it stops at (), and be the stopping time. Then we have
Hence, the probability that he will make it to the end of the bridge (the 100th meter) before reaching the beginning is 0.17, and the expected number of steps he takes to reach either the beginning or the end of the bridge is 1441.
We can easily extend the solution to a general case: a symmetric random walk starting from 0 that stops at either () or (). The probability that it stops at instead of is . The expected stopping time to reach either or is .
Dice game
Suppose that you roll a dice. For each roll, you are paid the face value. If a roll gives 4, 5 or 6, you can roll the dice again. If you get 1, 2 or 3, the game stops. What is the expected payoff of this game?
Solution: In Chapter 4, we used the law of total expectation to solve the problem. A simpler approach—requiring more knowledge—is to apply Wald’s Equality since the problem has clear stopping rules. For each roll, the process has 1/2 probability of stopping. So the stopping time follows a geometric distribution with and we have . For each roll, the expected face value is . The total expected payoff is .
Ticket line
At a theater ticket office, people are waiting to buy tickets. of them have only $5 bills and the other people have only $10 bills. The ticket seller has no change to start 118 with. If each person buys one $5 ticket, what is the probability that all people will be able to buy their tickets without having to change positions?
Solution: This problem is often considered to be a difficult one. Although many can correctly formulate the problem, few can solve the problem using the reflection principle.8 This problem is one of the many cases where a broad knowledge makes a difference.
Assign to the people with $5 bills and to the people with $10 bills. Consider the process as a walk. Let represent that after steps, the walk ends at . So we start at and reaches after steps. For these steps, we need to choose steps as , so there are possible paths. We are interested in the paths that have the property steps. It’s easier to calculate the number of complement paths that reach . As shown in Figure 5.6, if we reflect the path across the line after a path first reaches -1, for every path that reaches at step , we have one corresponding reflected path that reaches at step . For a path to reach , there are steps of and steps of . So there are such paths. The number of paths that have the property , given that the path reaches is also and the number of paths that have the property is
Hence, the probability that all people will be able to buy their tickets without having to change positions is .
119Coin sequence
Assume that you have a fair coin. What is the expected number of coin tosses to get heads in a row?
Solution: Let be the expected number of coin tosses to get heads in a row. In the Markov chain section, we discussed the case where (to get the pattern ). For any integer , we can consider an induction approach. Using the Markov chain approach, we can easy get that , and . A natural guess for the general formula is that . As always, let’s prove the formula using induction. We have shown the formula is true for . So we only need to prove that if , . The following diagram shows how to prove that the equation holds for :
The state before heads in a row (denoted as ) must be heads in a row (denoted as ). It takes an expected tosses to reach . Conditioned on state , there is a 1/2 probability it will go to (the new toss yields ) and the process stops. There is also a 1/2 probability that it will go to the 120 starting state 0 (the new toss yields ) and we need another expected tosses to reach . So we have
General Martingale approach: Let’s use to explain a general approach for the expected time to get any coin sequence by exploring the stopping times of martingales.9 Imagine a gambler has $1 to bet on a sequence of heads () in a fair game with the following rule: Bets are placed on up to consecutive games (tosses) and each time the gambler bets all his money (unless he goes bankrupt). For example, if appears at the first game, he will have $2 and he will put all $2 into the second game. He stops playing either when he loses a game or when he wins games in a roll, in which case he collects $ (with probability ). Now let’s imagine, instead of one gambler, before each toss a new gambler joins the game and bets on the same sequence of heads with a bankroll of $1 as well. After the -th game, gamblers have participated in the game and the total amount of money they have put in the game should be $. Since each game is fair, the expected value of their total bankroll is $ as well. In other words, if we denote as the amount of money all the participating gamblers have after the -th game, then is a martingale.
Now, let’s add a stopping rule: the whole game will stop if one of the gamblers becomes the first to get heads in a roll. A martingale stopped at a stopping time is a martingale. So we still have . If the sequence stops after the -th toss (), the -th player is the (first) player who gets heads in a roll with payoff . So all the players before him went bankrupt; the -th player gets heads in a roll with payoff ; …; the -th player gets one head with payoff 2. So the total payoff is fixed and .
Hence, .
This approach can be applied to any coin sequences—as well as dice sequences or any sequences with arbitrary number of elements. For example, let’s consider the sequence . We can again use a stopped martingale process for sequence . The gamblers join the game one by one before each toss to bet on the same sequence until one gambler becomes the first to get the sequence . If the sequence stops after the -th toss, the th gambler gets the with payoff 121 . All the players before him went bankrupt; the th player loses in the second toss (); the th player and the th player lose in the first toss (); the th player gets sequence with payoff and the -th player gets with payoff 2.
Hence, .