IBM Research | Ponder This | June 2011 solutions

# Ponder This

## June 2011

<<May June July>>

The first car can park in any spot, transforming the 100-unit-long circle into a 98-unit-long segment. Denote by f(n) the expected number of cars that can park in a segment of n units.

f(0) = f(1) = 0, since there is not enough space for a 2-unit-long car and
f(n+1) = 1 + {2\over n}\sum_{i=0}^{n-1} f(i).

Many of you just wrote a simple program to compute f(98), which is approximately 42.23; some of you used generating function methods to compute the answer; and a few of you gave the *exact* solution:

699873064207163672981688052775691404824955584422721836264226250973752499660
28469857171531088252341276109306476631593119274564 / 1618831092881708654907243444916671169624056573581564142797360830774247469534
546482996222387966854760679126713275909423828125 = 43.233235838169....

Many of you noticed that f(n) is very close to (n/2)(1-1/e^2)-1/e^2, and one of you even programmed it as a game (link resides outside of ibm.com).

Joe Riel even waited till the end of June and posted a solution (link resides outside of ibm.com).

Arthur Breitman was the first to send us a closed formula, but we choose to quote Michael Brand's proof for it:

f(n) = 0.5*(n-(n-2)*(-2)^(n-3)/(n-3)!-n \sum_{k=0}^{n-4} (-2)^k/k!)

His proof: Instead of counting parked cars, one can just as easily calculate the expected number of free parking spaces at the end of the process.
For each parking space, we calculate the probability for it to remain empty.
We then sum all probabilities to arrive at the expectation.
The probability for a parking space with x free parking spaces to its left and y free parking spaces to its right to remain empty can be described by the following 2D-recursive formula: p(x,y)=(\sum_{i=0}^{x-2} p(i,y) + \sum_{i=0}^{y-2} p(x,i))/(x+y). (To derive this formula, consider what happens after the first car parks inside this free interval.)
The 2D recursion can be solved more simply using a regular 1D recursion if one takes into account that the probabilities relating to the free parking spaces to the left are independent from those relating to the parking spaces on the right.
The solution is p(x,y)=D_x D_y, where D_k=\sum_{i=0}^{k} (-1)^i / i!, and from it the formula above can be derived directly.

However, we received the best solution from Austin Shapiro, who referenced an old paper (link resides outside of ibm.com) and sent us an elegant and concise original proof, which we enclose here as is (in his perfect handwriting):

Notes on the continuous version of this problem can be seen here (link resides outside of ibm.com).

If you have any problems you think we might enjoy, please send them in. All replies should be sent to: ponder@il.ibm.com