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 and , both independently drawn from the uniform distribution . 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 with expected value . Using the improved strategy, our waiting time is . What is the expected value of this random variable?

For two elevators, the solution is straightforward: consider every possible value of and and find the average of . In other words, the expected value of is

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 .

Therefore, the expected value of is , which is a 33% improvement over the naive strategy with expected value .

Forget about elevators for now; let’s generalize!

We know that the expected value of two uniform random variables is , 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 , 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 be the c.d.f for , where each is i.i.d with uniform distribution . Then the formula for is

*Proof*:

Now to prove the main claim:

Claim: The expected value of is

*Proof*:

Let be the p.d.f of , so . From this, the expected value is

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!*

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

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!

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

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

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?

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

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

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.

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