Elevator Math!

by greenturtle3141, Apr 5, 2024, 8:30 PM

Reading Difficulty: 1.5/5

Can you solve a real life math puzzle?

I currently I live in an apartment complex for my PhD program. My apartment building has $13$ floors: $T$ ("Terrace"), $M$ ("Mezzanine"), $1$, $2$ $\cdots$, $10$ and $11$. Since it's a tall building, there are two elevators.

One day, I called an elevator and stepped in, but forgot to press a button to tell it to go to another floor. The elevator proceeded to automatically go to the Terrace. Interesting. This elevator seems to have a default floor: $T$, that it goes to whenever it thinks nobody is using the elevator.

I guess it made sense for one elevator to default to the bottom-most floor. What about the other elevator? After stepping outside and messing around a bit, it was clear that the other elevator also had a default floor.

What floor does the other elevator default to when nobody is using the elevators?

(It may seem like you have basically no information to work with, and that's true! In real life, we often have to make some reasonable assumptions before math can be done. Good luck!)

Hint 1

Hint 2

Hint 3

A more complete problem statement

Answer


Elevator math!

Alright let's get some math done.

The floor names are annoying so let's rename them to $0,1,\cdots,12$. Then the default floor of the "first elevator" is $0$ and the default floor of the "second elevator" is $a$, and we want to solve for $a$ such that travel time is optimized.

Choose a floor $X$ from these 13 floors uniformly at random. Take a resident of floor $X$ that wants to use the elevators at some random point in the day. There are two cases.
  • There is a $50\%$ chance that this resident is coming home, in which case they start at floor $0$ and use the first elevator to go up $X$ floors.
  • There is a $50\%$ chance that this resident is leaving home, in which case they start at floor $X$ and call the nearest elevator, which has to travel $\min(|a-X|, |X-0|)$ floors to reach floor $X$, and then they use the elevator to go down $X$ floors.

Thus the expected travel time given a random resident at a random time of day (in terms of how many floors the elevator they use needs to travel) is
$$\mathbb{E}\left[\frac12 \cdot X + \frac12 \cdot \left(\min(|a-X|, |X-0|) + X\right)\right].$$We want to find the value of $a$ that minimizes this.

First, note that we can rewrite this as
$$\mathbb{E}\left[X + \frac12 \cdot \min(|a-X|, |X-0|) \right].$$This makes sense because no matter what, a resident of a floor $X$ will always have to travel at least $X$ floors. So all we need to do is minimize the expression
$$\mathbb{E} \min(|a-X|,X),$$because the only thing we can try to minimize is how long it would take for the nearest elevator to reach floor $X$. All other time expenses are inevitable.

Now, using the definition of expected value, we want to minimize the quantity
$$\sum_{k=0}^{12} \min(|a-k|,k).$$At this point there's not much we can do besides listing out the values of this sum over all $a$.
\begin{tabular}{c|c}
$a$ & Sum\\
\hline
0 & 78 \\
1 & 66 \\
2 & 56 \\
3 & 47 \\
4 & 40 \\
5 & 34 \\
6 & 30 \\
7 & 27 \\
8 & 26 \\
9 & 26 \\
10 & 28 \\
11 & 31 \\
12 & 36 
\end{tabular}
So it looks like the sum is minimized when $a = 8$ or $a=9$. In the original problem, this corresponds to floors $7$ and $8$. So if you answered $8$, you get partial credit!

...so why is the answer $7$? Was it just arbitrary?


Continuous abstraction

Let's put that question aside and instead try to make some general assertions when there are more floors. If there were, say, $1000$ floors, what's a very good educated guess for where the second elevator should be?

Obviously I don't want to list out $1000$ different values. But $1000$ is such a big number that we can effectively study the problem by making a sort of abstract "idealization": Let's just pretend that there are uncountably infinite many floors!

That is, let's model the building as the interval $[0,1]$. We choose a random "floor" $X \in [0,1]$ uniformly at random, and we now want to minimize the expected value of $\min(|X-a|,X)$, where $a$ is where the second elevator is. The expected value is given by the integral
$$\int_0^1 \min(|x-a|,x)\,dx.$$Integrals are so much easier to deal with than sums, which is why we're motivated to make this abstraction. To evaluate this, we split up into three intervals to get
$$\int_0^1 \min(|x-a|,x)\,dx = \int_0^{a/2} \min(|x-a|,x)\,dx + \int_{a/2}^a\min(|x-a|,x)\,dx + \int_a^1 \min(|x-a|,x)\,dx.$$$$ = \int_0^{a/2} x\,dx + \int_{a/2}^a a-x\,dx + \int_a^1 x-a\,dx$$$$ = \frac{a^2}{8} + \frac{a^2}{2} - \frac{3a^2}{8} + \frac12 - \frac12 a^2 - a(1-a)$$$$ = \frac{3}{4}a^2 - a + \frac12.$$This is minimized when $a = \frac{1}{2 \cdot \frac34} = \boxed{\frac23}$! So the general heuristic is that the second elevator should be $2/3$ of the way up the building.

So, in a building with $13$ floors, numbered $0$ through $12$, we should expect that the second elevator defaults to the floor $2/3$ of the way up, which is $8$. In the original problem, this corresponds to floor $7$. That's why $7$ is the most reasonable answer.


Even more elevators

Now, what if instead of just two elevators, there were actually $n$ elevators? Again, just for the sake of heuristics, let's assume that the apartment building's floors are given by the interval $[0,1]$.

I leave it as an exercise to show that one of the elevators has to be at floor $0$ (intuitively, this is because half the time, people are coming home, and placing one elevator at $0$ minimizes all their travel times). So it remains to place the other $n-1$ elevators.

Let's say that the other elevators are at floors $a_1,\cdots,a_{n-1}$ with $a_1 < a_2 < \ldots < a_{n-1}$. We can draw a graph of how much time it takes for the nearest elevator to get to you.

[asy]
size(6cm);
real[] a = {0.1, 0.3, 0.4, 0.7, 0.85};
int n = a.length;
real L = 5;
path gr = (0,0)--(a[0]/2*L,a[0]/2*L)--(a[0]*L,0);
for(int i=0; i<n-1; ++i){
gr = gr--((a[i]+a[i+1])/2*L,(a[i+1]-a[i])/2*L)--(a[i+1]*L,0);
}
gr = gr -- (L, L*(1-a[n-1])) -- (L,0);
fill(gr--cycle, p=rgb(1,0.8,0.8));
draw(gr,p=red);
draw((0,0)--(5,0));
dot("$0$", (0,0), S);
label("$1$", (L,0),S);
for(int i=0; i<n; ++i){
dot("$a_"+((string) (i+1))+"$", (a[i]*L,0),S);
}
[/asy]

We're trying to minimize the area under the graph. This area is comprised of $n$ triangular "mountains" and $1$ more triangle at the very end.

Let's consider two adjacent mountains: The one between $a_{i-1}$ and $a_i$, and the one between $a_i$ and $a_{i+1}$, for some $i$.

The base of the first mountain is $x = a_i- a_{i-1}$, and the base of the second mountain is $y = a_{i+1}-a_i$.

[asy]
size(6cm);
path gr = (0,0)--(1,1)--(2,0)--(3.5,1.5)--(5,0);
fill(gr--cycle, p=rgb(1,.8,.8));
draw(gr, p=red);
draw((0,0)--(5,0));
label("$x$", (1,0), N);
label("$y$", (3.5,0),N);
dot("$a_i$", (2,0), S);
dot("$a_{i-1}$", (0,0),S);
dot("$a_{i+1}$", (5,0),S);
[/asy]

The combined area of the mountains is then $\frac{x^2+y^2}{4}$. Where could we move $a_i$ so that this is minimized?

Aha! We are trying to minimize $\frac{x^2+y^2}{4}$ subject to the constraint $x+y = a_{i+1}-a_{i-1}$. By the QM-AM inequality, the minimum is obtained exactly when $x=y$. Therefore, in the minimum configuration, each pair of adjacent mountains must be of the same size! Because otherwise, there must be two adjacent mountains with different sizes, and then we can move the point in between them so that their area goes down.

Let's update what the full graph looks like now.

[asy]
size(6cm);
real[] a = {0.15, 0.3, 0.45, 0.6, 0.75};
int n = a.length;
real L = 5;
path gr = (0,0)--(a[0]/2*L,a[0]/2*L)--(a[0]*L,0);
for(int i=0; i<n-1; ++i){
gr = gr--((a[i]+a[i+1])/2*L,(a[i+1]-a[i])/2*L)--(a[i+1]*L,0);
}
gr = gr -- (L, L*(1-a[n-1])) -- (L,0);
fill(gr--cycle, p=rgb(1,0.8,0.8));
draw(gr,p=red);
draw((0,0)--(5,0));
dot("$0$", (0,0), S);
label("$1$", (L,0),S);
for(int i=0; i<n; ++i){
dot("$a_"+((string) (i+1))+"$", (a[i]*L,0),S);
}
[/asy]

With the above positions for the elevators, we can't move $a_1, a_2,\cdots,a_{n-2}$ to make the area go down. So we can only move the elevator at the end, $a_{n-1}$ (in the above picture, this is $a_5$).

Where do we move the final elevator to minimize the area of the two triangles next to it? We could do another QM-AM-type argument. But we actually don't have to do any work: We've done this before! This just reduces to the case with two elevators (restricted to just the interval $[a_{n-2},1]$)! So, it is optimal to put $a_{n-1}$ exactly $2/3$ of the way between $a_{n-2}$ and $1$.

Therefore, in the optimal configuration, we must have
$$a_1 = a_2-a_1 = a_3 - a_2 = \ldots = a_{n-1} - a_{n-2},$$and
$$a_{n-1} - a_{n-2} = \frac23(1 -a_{n-2}).$$
[asy]
size(6cm);
real[] a = {2/11, 4/11, 6/11, 8/11, 10/11};
int n = a.length;
real L = 5;
path gr = (0,0)--(a[0]/2*L,a[0]/2*L)--(a[0]*L,0);
for(int i=0; i<n-1; ++i){
gr = gr--((a[i]+a[i+1])/2*L,(a[i+1]-a[i])/2*L)--(a[i+1]*L,0);
}
gr = gr -- (L, L*(1-a[n-1])) -- (L,0);
fill(gr--cycle, p=rgb(1,0.8,0.8));
draw(gr,p=red);
draw((0,0)--(5,0));
dot("$0$", (0,0), S);
label("$1$", (L,0),S);
for(int i=0; i<n; ++i){
dot("$a_"+((string) (i+1))+"$", (a[i]*L,0),S);
}
[/asy]

Some basic algebra reveals the final answer: When there are $n$ elevators, it is optimal to place them at the following floors:
$$0, \frac{2}{2n-1}, \frac{4}{2n-1}, \cdots, \frac{2(n-1)}{2n-1}$$


It's always a great joy to discover compelling and intricate mathematics in the wild!
This post has been edited 4 times. Last edited by greenturtle3141, Apr 6, 2024, 1:13 AM

Comment

2 Comments

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
That's like actually kinda cool wow

by fruitmonster97, Apr 5, 2024, 9:31 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Amazing.

by mathlearner2357, Apr 6, 2024, 4:44 PM

Turtle math!

avatar

greenturtle3141
Archives
+ October 2024
Shouts
Submit
  • Can you give some thought to dropping a guide to STS? Just like how you presented your research (in your paper), what your essays were about, etc. Also cool blog!

    by Shreyasharma, Mar 13, 2025, 7:03 PM

  • this is so good

    by purpledonutdragon, Mar 4, 2025, 2:05 PM

  • orz usamts grader

    by Lhaj3, Jan 23, 2025, 7:43 PM

  • Entertaining blog

    by eduD_looC, Dec 31, 2024, 8:57 PM

  • wow really cool stuff

    by kingu, Dec 4, 2024, 1:02 AM

  • Although I had a decent college essay, this isn't really my specialty so I don't really have anything useful to say that isn't already available online.

    by greenturtle3141, Nov 3, 2024, 7:25 PM

  • Could you also make a blog post about college essay writing :skull:

    by Shreyasharma, Nov 2, 2024, 9:04 PM

  • what gold

    by peace09, Oct 15, 2024, 3:39 PM

  • oh lmao, i was confused because of the title initially. thanks! great read

    by OlympusHero, Jul 20, 2024, 5:00 AM

  • It should be under August 2023

    by greenturtle3141, Jul 11, 2024, 11:44 PM

  • does this blog still have the post about your math journey? for some reason i can't find it

    by OlympusHero, Jul 10, 2024, 5:41 PM

  • imagine not tortoise math

    no but seriously really interesting blog

    by fruitmonster97, Apr 2, 2024, 12:39 AM

  • W blog man

    by s12d34, Jan 24, 2024, 11:37 PM

  • very nice blog greenturtle it is very descriptive and fascinating to pay attention to :-D

    by StarLex1, Jan 3, 2024, 3:12 PM

  • orz blog

    by ryanbear, Dec 6, 2023, 9:23 PM

67 shouts
Tags
About Owner
  • Posts: 3553
  • Joined: Oct 14, 2014
Blog Stats
  • Blog created: Oct 23, 2021
  • Total entries: 54
  • Total visits: 40654
  • Total comments: 126
Search Blog
a