A particular elevator picks people up one at a time and brings them to their destination in the following manner:
Consider the sequence of floors that an elevator stops on. If the building has 9 floors, and every person using the elevator has an equal chance of being on any floor and wanting to go to any other floor, then the average floor number that the elevator visits is q p . If p and q are coprime integers, what is p + q ?
Examples:
Notes:
Assume that there is only one person waiting for the elevator at any given time.
Assume that the number of people lining up to use this elevator is infinite.
Bonus: Can you find the general formula for N floors?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I actually love this approach, just wanted to note that I think the sum of pick up vectors for M = 1 and K = 1 should be [ ( N − 1 ) ( N − 2 ) , 2 ( N − 2 ) , … , 2 ( N − 2 ) ] . That should make the sum of all pick up vectors work out! Thanks for writing a solution!
Log in to reply
Yes, I had that in my notes, but due to copy-pasting I managed to make that mistake consistently everywhere in my solution. Thanks for pointing it out!
Each person riding the elevator can be considered to make up a subsequence of the infinite sequence of floors that the elevator visits. Finding the average value of this entire sequence can be solved by finding the average value of each of its subsequences. This problem can be solved by considering the 2 different cases of people riding the elevator: those who are on or want to go to Floor 1, and those who are not. We can find the answer by finding the average floor number of each case, and then taking the expected value depending on how often we see each case to find the average value of the entire sequence. It is important to note that in both cases, we begin on Floor 1, so lets assume that each subsequence begins with a 1. We disregard the fact that the elevator ends on Floor 1, as this will be the first floor in the subsequence of the next person. We now consider each of the two cases separately, and let a and b be the floor number that a person is currently on and the floor that a person wants to go to, respectively.
First Case: a = 1 or b = 1 :
In this case, note that it doesn't which variable equals 1, as the sequence will always be { 1 , k } , where k = a if b = 1 and vice-versa. To find the average value of this subsequence, we first find the average value of k , which we label as k ^ . k can be anything from 2 to 9 , so we have: k ^ = 8 1 x = 2 ∑ 9 x = 2 1 1
Since one of the values in our subsequence will always be 1, our average value of this subsequence must be:
2 1 + k ^ = 2 1 + 2 1 1 = 4 1 3
Second Case: a = 1 and b = 1 :
The sequence we'll be looking at here will be of the form { 1 , a , b } . We treat this case similarly as the first, by finding some k ^ such that k ^ is the average sum of a and b . This can be expressed using the following formula:
k ^ = 8 ⋅ 7 1 x = 2 ∑ 9 [ 7 x + ( y = 2 ∑ 9 y ) − x ] = 5 6 1 [ 6 ( 2 9 ( 1 0 ) − 1 ) + 8 ( 2 9 ( 1 0 ) − 1 ) ] = 1 1
Note now that the average for the sequence { 1 , a , b } is the same as the sequence 1 , k ^ , but note that k ^ takes the place of 2 variables, so to find the average of 1 and k ^ , we need to divide by 3 instead of 2.
3 1 + k ^ = 3 1 + 1 1 = 4
Now that we've determined the averages of each subsequence, we need to determine how frequently each subsequence type occurs within the whole sequence. Note that for 9 floors, The odds that a = 1 and b = 1 (the second case) is 9 ⋅ 8 8 ⋅ 7 = 9 7 . This means that the first case should appear with odds 9 2 . Combining these odds with our subsequence averages, remembering that the first case has subsequence lengths of 2 and the second case has subsequence lengths of 3, yields the final solution.
E [ X ] = 9 2 ( 2 ) + 9 7 ( 3 ) 9 2 ( 2 ) ( 4 1 3 ) + 9 7 ( 3 ) ( 4 ) = 2 5 9 7
With 9 7 and 2 5 being coprime, this gives us our final answer of 9 7 + 2 5 = 1 2 2
In my opinion, since the full elevator sequence includes a return to floor one the average is only 424/136 = 53/17 -> 53+17=70 as final answer.
Note that the subsequences don't overlap. We cannot consider the stop on floor 1 to be at the end of one subsequence and at the start of another since it would double count that stop.
For this specific problem, it is sufficient to consider all 72 pairs of 1 through 9 where the the numbers are not the same. This removes the nonsense trips to the same floor. The specification of an infinite number of passengers means that the initial state of the elevator starting on floor 1 can be ignored in the calculations. A passenger starting or ending on floor 1, contributes 2 stops and the floors 1 and the destination floor. The remaining combinations contribute 3 stops and both the starting and ending floor plus floor 1. The sum of all the floors under those conditions is n 3 + n 2 − 4 n + 2 . The number of stops is 3 n 2 − 5 n + 2 . The fraction simplifies to 3 n − 2 n ( n + 2 ) − 2 . When n is even, the GCD of the numerator and the denominator is 2 and both the numerator and denominator can be divided by 2. In this case, the GCD is 1 and therefore, the reduced fraction is 2 5 9 7 , which gives the problem answer of 122.
Read the Wolfram article on Finite Difference to learn how the formulas were computed.
I modeled 2 through 10 floor buildings and computed the formulae. The columns from left to right are: the number of floors in the building, the number of distinct trips, the sum of floors reached, the count of floors reached and the floor average fraction as appropriately reduced.
2 3 4 5 6 7 8 9 1 0 2 6 1 2 2 0 3 0 4 2 5 6 7 2 9 0 6 2 6 6 6 1 3 2 2 3 0 3 6 6 5 4 6 7 7 6 1 0 6 2 4 1 4 3 0 5 2 8 0 1 1 4 1 5 4 2 0 0 2 5 2 2 3 7 1 3 5 1 1 1 3 3 3 8 2 3 1 9 6 1 1 1 3 9 2 5 9 7 1 4 5 9
122 not 112
You are correct. It was an arithmetic error while writing the explanation. As, you can see in the table, the computation was done correctly.
Problem Loading...
Note Loading...
Set Loading...
Let's try to tackle the general case where we have N floors.
We notice that all legal 4 -step pick ups are as likely to happen. For each pick up we can calculate the sum of the floor numbers and the number of floors on which the elevator stops on. We can add together these numbers for all possible pick ups to get the total sum of the floor numbers and total number of floors on which the elevator stops on when performing each possible pick up once. Then the average floor number stopped on is the total sum of the floor numbers divided by the total number of floors .
Let's now try to actually calculate these totals.
Let's model each pick up as a N -element row vector where each element tells how many times the elevator stopped on that floor.
If the person who the elevator is going to pick up is on the floor 1 and wants to go to the floor K where K = 1 then the elevator goes to floor K stops and then goes to floor 1 and stops . Thus the pick up vector has 1 at indices 1 and K and 0 everywhere else. Sum of all these pick up vectors is [ ( N − 1 ) , 1 , … , 1 ] .
If the person is on floor K where K = 1 and wants to floor 1 the path of the elevator is the same as in the previous case so the sum of the pick up vectors is also the same, i.e. [ ( N − 1 ) , 1 , … , 1 ] .
If the person is on floor K where K = 1 and wants to floor M where M = 1 , M = K then the pick up vector has 1 at the indices 1 , K and M and 0 everywhere else. Sum of all these pick up vectors is [ ( N − 1 ) ( N − 2 ) , 2 ( N − 2 ) , … , 2 ( N − 2 ) ] .
Thus the sum of all of the pick up vectors from all the possible cases is [ ( N − 1 ) , 1 , … , 1 ] + [ ( N − 1 ) , 1 , … , 1 ] + [ ( N − 1 ) ( N − 2 ) , 2 ( N − 2 ) , … , 2 ( N − 2 ) ] = ( N − 1 ) [ N , 2 , … , 2 ] .
The total sum of the floor numbers and total number of floors can be calculated by taking its dot product with [ 1 , 2 , … , N ] and [ 1 , 1 , … , 1 ] respectively.
Thus, the total sum of the floor numbers is ( N − 1 ) ( N 2 + 2 N − 2 ) and the total number of floors is ( N − 1 ) ( 3 N − 2 ) .
Hence, the average floor number is 3 N − 2 N 2 + 2 N − 2 .
In the case of N = 9 , the average floor number is 2 5 9 7 , yielding the answer 1 2 2 .