By purchasing “Lightning Lane Multi Pass,” you can reserve three of the many rides in a park, with each ride occurring at a different hourlong time slot. For simplicity, suppose the park you’re visiting (let’s say it’s Magic Kingdom) has 12 such time slots, from 9 a.m. to 9 p.m. So if you have the 3 p.m. time slot for a ride, then you can skip the “standby lane” and board the much shorter “Lightning Lane” at any point between 3 and 4 p.m. Assume you can complete at most one ride within each hourlong time slot.
Once you have completed the first ride on your Multi Pass, you can reserve a fourth ride at any time slot after your third ride. This way, you always have at most three reservations. Similarly, after you have completed your second ride, you can reserve a fifth ride at any time slot after your fourth, and so on, up until you are assigned a ride at the 9 p.m. time slot. That will be your final ride of the day.
Magic Kingdom happens to be very busy at the moment, and so each ride is randomly assigned a valid time slot when you request it. The first three rides of the day are equally likely to be in any of the 12 time slots, whereas subsequent rides are equally likely to occur in any slot after your currently latest scheduled ride.
On average, how many rides can you expect to “Lightning Lane” your way through today at Magic Kingdom?
Let's denote the slots that I get as S \subseteq \{1, 2, 3, \dots, 12 \}. Since after each ride I take, the probability distribution of what additional slots I add to S only depend on m = \max S. Additionally, since we care about the total ending size of S, let's keep track of n = |S|.
Define R(n,m) to be the expected total number of rides I take given that I currently have n slots and the a maximum time slot is m. Since once the 12th time slot is filled, you do not end up adding any more rides, we have R(n,12) = n for n = 3, 4, \dots, 12. Otherwise, we have the following recursion formula R(n,m) = \frac{ \sum_{j=m+1}^{12} R(n+1,j)}{12 - m}, \,\,\,\ m \lt 12.
Using the recursion formula, we see that R(n,11) = R(n+1,12) = n+1, \,\,\,n = 3, 4, \dots, 11. Similarly, we get R(n,10) = \frac{R(n + 1, 11) + R(n + 1, 12)}{2} = \frac{2n+3}{2} = n + \frac{3}{2}, \,\,\,n = 3, 4, \dots, 10. Once more, we get R(n,9) = \frac{R(n+1,10) + R(n+1,11) + R(n+1, 12)}{3} = n + \frac{11}{6}, \,\,\, n = 3, 4, \dots, 9. Another time, we get R(n,8) = \frac{\sum_{i=9}^{12} R(n+1,i)}{4} = n + \frac{25}{12}, \,\,\, n = 3, 4, \dots, 8. Further, we get R(n,7) = \frac{\sum_{i=8}^{12} R(n+1,i)}{5} = n + \frac{137}{60}, \,\,\, n = 3, 4, \dots, 7. Continuing onward, we get \begin{align*}
R(n,6) &= n + \frac{49}{20}, \,\,\, n = 3, 4, 5, 6; \\
R(n,5) &= n + \frac{363}{140}, \,\,\, n = 3, 4, 5; \\
R(n,4) &= n + \frac{761}{280}, \,\,\, n = 3, 4; \\
R(n,3) &= n + \frac{7129}{2520}, \,\,\, n = 3.\end{align*}
Let's pause to define p_m as the probability that in your first three randomly assigned timeslots, the maximum time slot is m, That is, p_m = \frac{ \binom{m-1}{2} }{ \binom{12}{3} } = \frac{ (m-1)(m-2) }{ 440 }. So using the law of total expectation, we get that the total average number of rides that you expect to go on using the Lightning Lane Multi Pass is R = \sum_{m=3}^{12} p_m R(3,m) = \sum_{m=3}^{12} \frac{(m-1)(m-2)}{440} R(3,m) = \frac{118361}{27720} \approx 4.2698773\dots
To confirm the calculations here, I put together a small Python code for testing purposes (as well as for working on the Extra Credit problem that will be featured in a later post). Below find the code:
import numpy as np
rng = np.random.default_rng()
def lightning_classic(rng):
slots = sorted(list(rng.choice(12,size=3, replace=False)))
last = slots[-1]
while last < 11:
new = rng.integers(last+1, high=12)
slots.append(new)
last = new
return slots
def lightning_xc(rng):
slots = sorted(list(rng.choice(12,size=3, replace=False)))
for i in range(12):
if i in slots:
open_slots = [j for j in range(i+1, 12) if j not in slots] ## figure out which ones are still open
if open_slots:
new = open_slots[rng.integers(len(open_slots))] ## get new slot
slots.append(new)
return slots
After running the code with N = 1,000,000, we get the following histogram, which gives a mean of m = 4.269231, standard deviation of s = 1.032058, which implies that the true mean 95\% confidence interval is R \in [4.2672, 4.2713].