- #1
pdrjuarez
- 7
- 0
Homework Statement
There is a parking lot outside a building with n evenly spaced parking spaces that are numbered 1 through N with parking space #1 being closest to the entrance of the building, and parking space #n being the furthest away from the entrance to the building. A driver enters the parking lot, starting at parking space N, moving his way through to parking space #1. His goal is to park as close to the entrance of the building possible, but there's a few restrictions:
1) He knows nothing at all about the arrangement of the cars inside the parking lot (This means that all possible arrangements of cars are possible; there may be 0 cars inside the parking lot, there may be n cars, or anything in between, in any order) 2^n arrangements in total
2) He will drive all the way from parking space n to parking space k, with k in between 1 and n. Once he's reached the k'th spot, he will take the k'th spot (if available). Otherwise, he will take the next available parking space after k (could be k-1, k-2 etc)
3) he can't see spaces that are ahead of him. If he is at spot k, he can't see the k-1th spot
4) If he reaches spot #1 and still hasn't parked, he must park outside the parking lot (which I labeled as the n+1 spot, since its farther away than the n'th spot
Q 1: How close to the entrance of the building can he expect to be, on average? (in other words, what's his expected value. this is a function of which spot, k, he chooses)
Q 2: For a parking lot that is n spaces big, what is the optimal K value? (Which value of k will make the average distance from Q1 the smallest?)
Homework Equations
The Attempt at a Solution
If he picks spot #k, he has exactly k chances to park before he is sent outside the building.
The chance of him parking exactly at k is 1/2 (since it's completely random),
the chance of him parking exactly at k-1 is 1/4 (Since spot k had to be filled, and k-1 must be empty
The chance of him parking exactly at k-2 is 1/8 (Since spot k and k-1 had to be filled, and k-2 had to be empty
etc etc
So, the expected value came out to be something of this nature
(k/2)+ (k-1)/22 +(k-2)/23 etc etc
Which can be written as
Expected value = Sum from i=0 to k-1 of ((k-i)/(2i+1)
We also have to consider the possibility that there are absolutely no parking spaces available from the k'th spot, which would put him at the n+1th spot. There's a 1/2k chance of this happening, since ALL k spots from k to 1 have to be taken. I added that to my expected value
Expected value= Sum from i=0 to k-1 of ((k-i)/(2i+1)) + (n+1)/2k
So, that's question #1
For question #2, I tried taking the derivative with respect to K of this really messy function (I changed the sum to an integral with respect to the variable i), and set it equal to 0 to find the critical points... After much messy calculus which would be a pain to post here, I managed to get to this point
(1-ln(2)* (n+1))/2k) = 0
Now... I am not very sure if i even managed to do all of that right. But, the only way that can be 0 is if the numerator is 0, which would mean that n = (1 - ln(2))/(ln(2))... Which doesn't make sense because I wanted some function of k in terms of n that would give me the optimal k value, and this just gives me a constant n value (as if k didn't matter when calculating the expected value, but it really seems like it should)
Last edited: