# How a simple trick decreased my elevator waiting time by 33%

Last month, when I traveled to Hong Kong, I stayed at a guesthouse in a place called the Chungking Mansions. Located in Tsim Sha Tsui, it’s one of the most crowded, sketchiest, and cheapest places to stay in Hong Kong.

Chungking Mansions in Tsim Sha Tsui

Of the 17 floors, the first few are teeming with Indian and African restaurants and various questionable businesses. The rest of the floors are guesthouses and private residences. One thing that’s unusual about the building is the structure of its elevators.

The building is partitioned into five disjoint blocks, and each block has two elevators. One of the elevators only goes to the odd numbered floors, and the other elevator only goes to the even numbered floors. Neither elevator goes to the second floor because there are stairs.

Elevator Schematic of Chungking Mansions

I lived on the 14th floor, and man, those elevators were slow! Because of the crazy population density of the building, the elevator would stop on several floors on the way up and down. Even more, people often carried furniture on the elevators, which took a long time to load and unload.

To pass the time, I timed exactly how long it took between arriving at the elevator on the ground floor, waiting for the elevator to come, riding the elevator up, and getting off at the 14th floor. After several trials, the average time came out to be about 4 minutes. Clearly, 4 minutes is too long, especially when waiting in 35 degrees weather without air condition, so I started to look for optimizations.

The bulk of the time is spent waiting for the elevator to come. The best case is when the elevator is on your floor and you get in, then the waiting time is zero. The worst case is when the elevator has just left and you have to wait a full cycle before you can get in. After you get in, it takes a fairly constant amount of time to reach your floor. Therefore, your travel time is determined by your luck with the elevator cycle. Assuming that the elevator takes 4 minutes to make a complete cycle (and you live on the top floor), the best case total elevator time is 2 minutes, the worst case is 6 minutes, and the average case is 4 minutes.

It occurred to me that just because I lived on the 14th floor, I don’t necessarily have to take the even numbered elevator! Instead, if the odd numbered elevator arrives first, it’s actually faster to take the elevator to the 13th floor and climb the stairs to the 14th floor. Compared to the time to wait for the elevator, the time to climb one floor is negligible. I started doing this trick and timed how long it took. Empirically, this optimization seemed to speed my time by about 1 minute on average.

Being a mathematician at heart, I was unsatisfied with empirical results. Theoretically, exactly how big is this improvement?

Let us model the two elevators as random variables $X_1$ and $X_2$, both independently drawn from the uniform distribution $[0,1]$. The random variables represent model the waiting time, with 0 being the best case and 1 being the worst case.

With the naive strategy of taking the even numbered elevator, our waiting time is $X_1$ with expected value $E[X_1] = \frac{1}{2}$. Using the improved strategy, our waiting time is $\min(X_1, X_2)$. What is the expected value of this random variable?

For two elevators, the solution is straightforward: consider every possible value of $X_1$ and $X_2$ and find the average of $\min(X_1, X_2)$. In other words, the expected value of $\min(X_1, X_2)$ is

${\displaystyle \int_0^1 \int_0^1 \min(x_1, x_2) \mathrm{d} x_1 \mathrm{d} x_2}$

Geometrically, this is equivalent to calculating the volume of the square pyramid with vertices at (0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0), and (1, 1, 1). Recall from geometry that the volume of a square pyramid with known base and height is $\frac{1}{3} bh = \frac{1}{3}$.

Therefore, the expected value of $\min(X_1, X_2)$ is $\frac{1}{3}$, which is a 33% improvement over the naive strategy with expected value $\frac{1}{2}$.

Forget about elevators for now; let’s generalize!

We know that the expected value of two uniform $[0,1]$ random variables is $\frac{1}{3}$, but what if we have n random variables? What is the expected value of the minimum of all of them?

I coded a quick simulation and it seemed that the expected value of the minimum of n random variables is $\frac{1}{n+1}$, but I couldn’t find a simple proof of this. Searching online, I found proofs here and here. The proof isn’t too hard, so I’ll summarize it here.

Lemma: Let $M_n(x)$ be the c.d.f for $\min(X_1, \cdots, X_n)$, where each $X_i$ is i.i.d with uniform distribution $[0,1]$. Then the formula for $M_n(x)$ is

$M_n(x) = 1 - (1-x)^n$

Proof:

$\begin{array}{rl} M_n(x) & = P(\min(X_1, \cdots, X_n) < x) \\ & = 1 - P(X_1 \geq x, \cdots, X_n \geq x) \\ & = 1 - (1-x)^n \; \; \; \square \end{array}$

Now to prove the main claim:

Claim: The expected value of $\min(X_1, \cdots, X_n)$ is $\frac{1}{n+1}$

Proof:

Let $m_n(x)$ be the p.d.f of $\min(X_1, \cdots, X_n)$, so $m_n(x) = M'_n(x) = n(1-x)^{n-1}$. From this, the expected value is

$\begin{array}{rl} {\displaystyle \int_0^1 x m_n(x) \mathrm{d}x} & = {\displaystyle \int_0^1 x n (1-x)^{n-1} \mathrm{d} x} \\ & = {\displaystyle \frac{1}{n+1}} \end{array}$

This concludes the proof. I skipped a bunch of steps in the evaluation of the integral because Wolfram Alpha did it for me.

For some people, this sort of travel frustration would lead to complaining and an angry Yelp review, but for me, it led me down this mathematical rabbit hole. Life is interesting, isn’t it?

I’m not sure if the locals employ this trick or not: it was pretty obvious to me, but on the other hand I didn’t witness anybody else doing it during my stay. Anyhow, useful trick to know if you’re staying in the Chungking Mansions!

Read further discussion of this post on Reddit!

## 6 thoughts on “How a simple trick decreased my elevator waiting time by 33%”

1. nymonym says:

Why not go to #15 and climb one down? Slightly longer delay >> slightly more tiredness, esp. on a hot, humid day..

2. jamineast says:

If you are feeling a little selfish, don’t just press the down button, press the up and down button (why does this work and when?). This won’t work if everyone does it though!

1. I don’t think this does anything: if you get into an elevator going the wrong way, you spend more time in the elevator.

3. Hello, my name is damian, i’m studying a math grade in uruguay (latin america) and i think you blog is a very interessent,
I will start to see him often. Kiss