Draw On
The 100 prisoner problem is considered one of the best examples of a game theory problem where a different stategy greatly changes the probability of success. In 2003 Danish computer scientist Peter Bro Miltersen published a paper that studied "time-space tradeoffs for static data structure problems".
Miltersen
Peter Bro Miltersen
To demonstrate some results, he introduced a game in which one player randomly places one of two colored slips of paper in boxes. A second player opens some of the boxes and makes a best guess of the contents of the remaining boxes. He gave an upper bound for the probability of player 2 being correct that decreased very rapidly with the number of boxes.

Skyum
Sven Skyum
He then conjectured that if player 2 was replaced by a team of players independently opening boxes, the results would be similar. His collegue Sven Skyum pointed out to him that this is not necessarily true and that the probability of team success could be much greater than expected.

The 100 prisoner problem evolved from Miltersen's problem to demonstrate Skyum's remarkable observation.
The director of a prison offers 100 death row prisoners, who are numbered from 1 to 100, a last chance. A room contains 100 boxes. The director randomly puts one prisoner's number in each closed box. The prisoners enter the room, one after another. Each prisoner may open and look into 50 boxes in any order. The boxes are closed again afterwards. If, during this search, every prisoner finds his number in one of the boxes, all prisoners are pardoned. If just one prisoner does not find his number, all prisoners die. Before the first prisoner enters the room, the prisoners may discuss strategy but may not communicate once the first prisoner enters to look in the boxes. What is the prisoners' best strategy?
Page 2
No matter what strategy we use, the probabilty of any given prisoner succeeding is
50
100
= .5. Our only way to significantly improve their chances is to make the events highly dependent (despite the fact that the prisoners do not communicate).

The strategy we choose is the following. Let each prisoner go to the box labeled with his prisoner number. If the number inside that box is his prisoner number, then he was successful; otherwise, the prisoner goes to the box labeled with the number inside the first box. The process is repeated until he finds his prisoner number or he has opened 50 boxes. If he finds his box within 50 tries he is successful; otherwise, he has failed and the game is over. The prisoners win their freedom only if all 100 prisoners successfully find their number.

At first thought, this does not seem to be a better strategy than the previous one. But let's check it out.
 0
73
77
77
Page 2
The path 92, 31, 14, 82, 31, 12 looks like this.
This path is also impossible. Box 12 must contain some number. That number cannot be 12 since both boxes 34 and 12 would contain 12. So the path must continue to 92 or somewhere it hasn't gone before. In either case, the path eventually comes back to 92 without revisiting any of the other boxes.
Page 1
We know that the paths that the prisoners take through the boxes are cycles with lengths between 1 and 100 and that any two distinct cycles are disjoint. This tells us that the prisoners succeed if and only if the maximum cycle length in their permutation is less than or equal to 50.

Page 2
Let's look at the simpler case of 4 prisoners. The following table gives the possible permutations of the numbers with the possible cycles.

Permutation Cycles Cycle Length Max Length
1 1, 2, 3, 4 1;  2;  3;  4 4, 0, 0, 0 1
2 1, 2, 4, 3 1;  2;  4,3 2, 1, 0, 0 2
3 1, 3, 2, 4 1;  3,2;  4 2, 1, 0, 0 2
4 1, 3, 4, 2 1;  3,4,2 1, 0, 1, 0 3
5 1, 4, 2, 3 1;  4,3,2 1, 0, 1, 0 3
6 1, 4, 3, 2 1;  4,2;  3 2, 1, 0, 0 2
7 2, 1, 3, 4 2,1;  3;  4 2, 1, 0, 0 2
8 2, 1, 4, 3 2,1;  4,3 0, 2, 0, 0 2
9 2, 3, 1, 4 2,3,1;  4 1, 0, 1, 0 3
10 2, 3, 4, 1 2,3,4,1 0, 0, 0, 1 4
11 2, 4, 1, 3 2,4,3,1 0, 0, 0, 1 4
12 2, 4, 3, 1 2,4,1;  3 1, 0, 1, 0 3
13 3, 1, 2, 4 3,2,1;  4 1, 0, 1, 0 3
14 3, 1, 4, 2 3,4,2,1 0, 0, 0, 1 4
15 3, 2, 1, 4 3,1;  2;  4 2, 1, 0, 0 2
16 3, 2, 4, 1 3,4,1;  2 1, 0, 1, 0 3
17 3, 4, 1, 2 3,1;  4,2 0, 2, 0, 0 2
18 3, 4, 2, 1 3,2,4,1 0, 0, 0, 1 4
19 4, 1, 2, 3 4,3,2,1 0, 0, 0, 1 4
20 4, 1, 3, 2 4,2,1;  3 1, 0, 1, 0 3
21 4, 2, 1, 3 4,3,1;  2 1, 0, 1, 0 3
22 4, 2, 3, 1 4,1;  2;  3 2, 1, 0, 0 2
23 4, 3, 1, 2 4,2,3,1 0, 0, 0, 1 4
24 4, 3, 2, 1 4,1;  3,2 0, 2, 0, 0 2
24, 12, 8, 6

We count the number of permuations with a given maximum length and get 1, 9, 8, and 6 respectively. This tells us that the probability of longest cycles of length k is 1/24 , 9/24 , 8/24 , and 6/24 respectively. The probability that the prisoners succeed is 1/24 + 9/24 = 10/24 ≈ .4167.

Note for future reference that a given number appears in a cycle of length k (not necessarily of maximum length k) exactly 6 times.

 

 
Page 3
We consider the general case of n boxes. Let N(n,k) denote the number of cycles of length k. We can choose the numbers in the cycles
C(n, k)
ways. We can arrange the k boxes in the cycle
(k-1)!
ways and we can arrange the remaining
n - k
boxes
(n-k)!
ways. Then by the counting principle,

N(n,k) = C(n,k)(k-1)!(n-k)! =
n! (k-1)!
(n-k)!
k!
(n-k)!
=
n!
(k-1)!
k
!
=
n!
k
.

Notice that when n=4, this gives the 24, 12, 8, and 6 on the previous page.

However, this tells us the number of cycles of a given length but not necessarily the number of cycles with k as the maximum length. But, if
k > n/2,
each of the k cycles must be of maximum length since the remaining
n - k
boxes could not have a cycle of length greater than or equal to k.

It follows for
k > n/2,
the probability of a maximal cycle of length k is
n!
k
n!
=
1/k,
Note that this is independent of n. For n = 4, P(k ≤ 2) = 1 - [1/3 + 1/4] ≈ 1 - .5833 = .4167. And for 100 prisoners, P(k    50)  [ 1 __ _ 51   +   1 __ _ 52   +   1 __ _ 53   +   1 ___ _ 100 ]   ≈  .3118.

Page 4
Wow! While the odds are still against them, the prisoners went from no chance of success to a reasonable chance with this simple change in strategy.
37
Page 5
The case where
k ≤ n/2
is much more difficult. We discuss this case for completeness but it is not needed to solve the problem as stated.

Let L(n,k) denote the number of times that k is the maximum cycle length for n boxes. The following recursive formula gives the number of partitions of n that have a maximum length of k and is presented with the derivation discussed later.

L(n,k) =
n/k
j=1
[
n!
j! kj (n-jk)!
min(k-1,n-kj)
t=1
L(n-kj,t)
]

where
0
t=1
is interpreted as 1a. To use a recursive formula, you must know some "base" values. In this case it is sufficient to know
L(n,1) = 1
for all n. We use this formula when k ≤ n/2. Note that we already have the formula when
k > n/2,

Of course once
L(n,k)
is computed, the probability that k is a maximum cycle length can be found by dividing
L(n,k)
by n!.
a This notation is very clumsy but was the notation used by Miltersen in the original paper where he presented the formula without derivation.
Page 6
We give an example of using the recursive formula:
L(n,k) =
n/k
j=1
[
n!
j! kj (n-jk)!
min(k-1,n-kj)
t=1
L(n-kj,t)
]
.

We calculate L(7,3).

L(7,3) =
2
j=1
7!
j! 3j (7-3j)!
min(2,7-3j)
t=1
L(7-3j,t)
1
=
7!
1! 31 4!
[
L(4,1) +L(4,2)
]
+
7!
2! 32 1!
[
L(1,1)
]
2
=
70[1 + L(4,2)] + 280 • 1
3

We now calculate L(4,2).
L(4,2) =
2
j=1
4!
j! 2j (4-2j)!
min(1,4-2j)
t=1
L(4-2j,t)
4
=
4!
1! 21 2!
[
L(2,1)
]
+
4!
2! 22 0!
• 1
5
= 6 + 3 = 9 6

We plug 9 into line 3 and get
L(7,3)
= 700 + 280 = 980.

This recursive formula is difficult to use by hand but is easy to program into a computer.

 

 

Page 7
The first few values of L(n, k)
Page 8
The General Formula for
L(n, k)
In 1997, S. W. Golomb and P. Gaal of the University of Southern California, published a paper in Probabilistic Methods in Discrete Mathematics entitled On The Number of Permutations of n Objects With Greatest Cycle Length k in which they derived the general formula
L(n,k) =
n/k
j=1
[
n!
j! kj (n-jk)!
min(k-1,n-kj)
t=1
L(n-kj,t)
]
where k ≤ n/2. Their method involved building up to the result by considering cases n/3 < k ≤ n/2, n/4 < k ≤ n/3, and so on. The computation was long and nasty.

With the benefit of hindsight from the formula, a perhaps more esthically pleasing method of deriving the formula has evolved. If we let

Lj(n,k) =
n!
j! kj (n-jk)!
min(k-1,n-kj)
t=1
L(n-kj,t)
, then it turns out that the formula gives the number of permutations of n things with maximum cycle length k where cycles of length k occur exactly j times.

Each Lj(n,k) can be generated by decomposing previous values of L(n,k). While this method is beyond the scope of this page, we will give a simple example of decomposing a value of L(4,3) to get a corresponding value of L(7,3). Consider the permutaion 2,1,4,3. This gives two cycles of length 2; namely 2,1; 4,3. We could add three elements, 5, 6, and 7, to this permuation like following: 2,5,1; 4,6,3; 8 to get two cycles of length 3 and one of length 1. Of course there are many rearrangements of this permutation that produce the same pattern of two cycles of length 3 and one of length 1.

By decomposing earlier permutations in a very carefull way, it is possible to generate each Lj(n,k). Perhaps the biggest obstacle is to guarantee that each permulation is generated only once.

 

 

Page 1
Monte Carlo Method
We estimate the probability distribution by creating random permutations of the numbers in the boxes.
  • It has been shown using tools in Game Theory that no strategy is better than the one given.
  • The original paper by Miltersen was concerned with time-space tradeoffs for certain computer problems such as substring searches. When he refered to a team of players, he most likely was concerned with a "team" of computers, or more succinctly parallel processing. Skyum's observation showed that under some conditions, independent parallel processing can be remarkably effective.
  • Even though the prisoners did not communicate, the structure implied by the strategy made their actions highly dependent.
100 Prisoners Problem
Pen Help
Pen Thickness
Set Erase Mode
Clear Sheet
×
Close
Current Path -