Expected time until you reach the top of staircase in a dice game

323 Views Asked by At

I received this question during an online assessment and it continues to bug me. The setup is the following: you have a staircase with $100$ stairs in front of you, and at each time step $t$ you roll a fair six-sided die. You climb the same number of stairs as your roll except if you roll the same amount as the previous time step. If you roll the same number at time $t$ as you did in time $t - 1$ then you take a step back. For example, if you start on the $0$th step and roll a $6$, you go to stair $6$. Then if you roll a $6$ again, you take one step back to be on stair $5$. What is the expected number of rolls until you reach the top of the staircase?

This was my reasoning: let $X_t$ be a random process denoting the position of the player after t rolls and let $d_t$ be the roll at time t. $E[d_t] = 3.5$ and we can calculate the expectation of $X_t$ using the law of iterated expectations and the law of total expectation. But first we consider the term $E[X_{t}|d_t \neq d_{t-1}] = X_{t-1} + E[d_t|d_t \neq d_{t-1}] = X_{t-1} + \frac{(1+2+...+6 - d_{t-1})}{5} = X_{t-1} + \frac{21-d_{t-1}}{5}.$

Then, \begin{align*} E[X_t] &= E[E[X_t|d_{t-1}]] = E\left[\frac{1}{6}(X_{t-1} - 1) + \frac{5}{6}(X_{t-1} + \frac{21-d_{t-1}}{5})\right] \\ & = E\left[X_{t-1} -\frac{d_{t-1}}{6} + \frac{20}{6} \right] = E[X_{t-1}] + \frac{11}{4} \end{align*}

So it seems that at each time step, we are advancing on average $2.5$ stairs. Since $X_t$ is not a martingale, I cannot simply use the optional stopping theorem to calculate the stopping time. This is where I doubt my calculation. $E[X_t]$ is a recurrence relation with a solution of $E[X_t] = 3.5 + 2.75(t-1)$, so what if we simply calculate the time until the expected position is at least $100$? Doing that we find $t = 36.0909...$ so would our answer then be $t = 37$?

I suppose another way to do it is by using random variables $t_{i}$ to denote the time until you reach the end of the staircase starting at staircase $i$. Then of course $E[t_{100}] = 0$, $E[t_{99}] = \frac{5}{6}(1) + \frac{1}{6}E[t_{98}]$ but this soon gets complex as to calculate $E[t_{98}]$ we have to keep track of $d_{98}$ and $d_{97}$ and so on and so on.