probability puzzles
hard | probability |
You are initially located at the origin on the -axis. You start a random walk with an equal probability of moving left or right, one step at a time. What is the probability that you will reach point before reaching point ?
Assume and are natural numbers.
Consider the expected value of the position at the end of the game.
Probability
Let us assume that we stop walking the moment we reach any of or . As we keep walking randomly, we'll eventually hit one of the two points, and the game will surely end.
Suppose is the probability that we end at , and is the probability that we end with .
Let be the position on the -axis at the end of this game.
Also note that the walk is symmetric (equal probability in either direction), so, logically,
Solve to get
Follow up Question
What is the expected number of steps to reach either or ?
Follow up Solution
Warning: This solution uses the knowledge of Martingales and advanced stochastic theory.
In probability theory, a Martingale is a model of a fair game where knowledge of past events does not help to predict the mean of the future winnings, and where the expected value of the next play, given all the plays so far, is the same as the present value, even though the next play could have several possible outcomes.
Formally, the sequence is a Martinagle if:
Since we're conducting a random walk, where each step can either be (right) or (left). This type of problem can be analyzed using a Martingale approach.
Let be the position on the -axis after steps.
Here is a Martingale because:
In other words, given we are standing at position , the expected value of the next step is the current value.
End Game: Let = the number of steps to reach any of or starting from position . We end the game when we reach either or .
is either or , with probability and respectively.
Note that because we start from , and all future expected values are equal to the position. This property can be used to find
We want to calculate , i.e. the number of steps taken to end the game.
Leap-of-faith: Consider the special variable , what's the expected value in the next step?
This satisfies the martingale property!
Hence, at the end of the game, the expected value is: The current value of (because no moves have been made yet)
Now, we just expand , and we can reach the result with a snap.
Hence it takes on average steps to end the game
Notes
-
If we take where takes either 1 or -1 with probability 0.5 each, then
-
is a commonly used martingale. This can be used to show that the gambler's total gain or loss varies roughly between plus or minus the square root of the number of steps
-
We do not denote as because is not an unknown, it is always zero. But any new knowledge like can impact the expected value, i.e.
-
is our position after steps, while is our position at the end of the game.