# 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 $\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} \int_0^1 x m_n(x) \mathrm{d}x} & = \int_0^1 x n (1-x)^{n-1} \mathrm{d} x} \\ & = \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!

## 9 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..

Like

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!

Like

1. luckytoilet says:

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

Like

3. damiansire@hotmail.com says:

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

Like

4. Adam S says:

It’s only 17%, not 33%. The actual range of your random variable is [2,6] rather than [0,1], so only half of the expected waiting time is due to the random variation. Your trick saves 33% of the *random* waiting time, but doesn’t cut into the constant 2-minute factor. (Also, it’s slightly less than that because you also have to climb a flight of stairs!)
It’s kind of mysterious that you saved 1 minute, since it should have saved you only 40 seconds even ignoring the stairs. Maybe the odd-floor elevator is faster or less busy?

Like

1. luckytoilet says:

I know, my claim is that I reduced my elevator *waiting* time by 33%, you’re correct that the total elevator travel time is only reduced by 17%. And the expected saving is 40 seconds, which I would count as “about a minute” if we’re being optimistic :p

Like

5. Nexaelevator says:

Nexa Elevator is one of the best Elevator & lift manufacturers in Bangalore, India. You can call at +91- 7259815331 and get the best quotes for Residential Elevator, Residential lifts, Commercial Elevator, Hospital Elevators, Passenger Elevators, Luxury Home Elevators, MRL Lifts,Hydralic Lifts, Goods lifts etc. We have been working good market of home /office lifts. You can visit our website: http://www.nexaelevator.com

Like

6. Fx says:

In my first year of undergraduate I lived on the 15th floor of an 18 story building. This made returning to my room from fire drills a nuisance as there would always be a massive hoard of people waiting to get on the elevator on the first floor.

While waiting to get on an elevator during one of the drills I realized that the elevator was always empty going down. So instead of waiting on floor 1 I’d just go up to floor 3 (as there was no elevator door on floor 2) and call the elevator down, effectively putting me at the front of the line! Reducing the wait considerably!

Not as exciting as your elevator story, but still fun.

Like

1. luckytoilet says:

Nice! Not quite as amenable to mathematical analysis, but time saved is time saved nevertheless.

Like