Today, we are going to solve Optiver’s challenges from their second installment of their new Prove It series which I have really enjoyed. I will just be providing the mathematical proofs, but if you are interested to see what these formulas and equations mean, please see this video for reference (problems are near the end): https://www.youtube.com/watch?v=u76c4QDHXME
Prove that for a random walk from to , the expected number of blocks is .
For some context, we are walking on the integer number line from to where moving one block means moving from to either or . The walk ends when we reach . When we are at , we automatically move to the next turn. For any other place we move to either or with equal probability.
We can encode all of this information using states and expected value. Let denote the expected value of the number of steps we need to take when at before reaching . For , we have
since its equally likely we move in either direction, towards or towards . Note that we also have
and
based on the boundary conditions.
To solve this problem, we are going to try and find a closed form for . Note that
rearranges to
and shifting the index down by gives
so each state depends recursively on the previous two states.
Let . Since , we have . We now have our base states and we can recursivly generate the rest of them. For example, using , we find that
and
so it looks like our closed form is
which we can prove with induction.
The base cases are trivial (we already did them). Hence, assume and for the inductive hypothesis.
For the inductive step, compute
which completes the induction.
So we know that so all we need is to compute . Fortunately, recall that Thus so . This tells us that and specifically as required.
What is the expected number of blocks to go from to if the coin is biased and is twice as likely to land on tails.
The setup for this problem is exactly the same as the first one, except instead of moving equally likely to and , we now have a chance of moving to and a chance of moving to if we are at state . Thus,
which rearranges to
Again, let the base cases be and . We can then compute the first few terms
which don’t appear to have an easy pattern to observe. Thus, this time we are going to have to solve the recursion directly using characteristic equations. We already have
Shifting the index down by and moving everything to the right hand side of the equation gives
Subtracting the second from the first, we get
and shifting the index down by gives us
so each state depends recursively on the previous three states. The base cases are and we can check that this recursion is correct by computing which is what we got earlier.
The characteristic equation of the recursive formula is
which has roots . Because it has a double root at , the general solution to this equation is
for constants . Setting gives us the system
which solves to .Thus,
As before, so . This tells us that and specifically .
Find an interesting solution? Feel free to submit it to Optiver directly at https://optiver.com/prove-it-2