Você está na página 1de 7

9/26/2014

100 prisoners problem - Wikipedia, the free encyclopedia

100 prisoners problem


From Wikipedia, the free encyclopedia

The 100 prisoners problem is a mathematical problem from probability theory and combinatorics. In this
problem, in order to survive, 100 prisoners have to find their own numbers in one of 100 drawers. Thereby, each
prisoner may open only 50 of the drawers and cannot communicate with the other prisoners. At first glance the
situation appears hopeless, but a clever strategy exists which offers the prisoners a realistic chance of survival.
The problem was first posed in 2003 by Danish computer scientist Peter Bro Miltersen.

Contents
1 Problem
2 Solution
2.1 Strategy
2.2 Examples
2.3 Permutation representation
2.4 Probability of success
2.5 Asymptotics
2.6 Optimality
3 History
4 Variants
4.1 Empty boxes
4.2 Monty Hall problem
5 See also
6 References
7 Literature
8 External links

Problem
The 100 prisoners problem has different renditions in the literature. The following version is by Philippe Flajolet
and Robert Sedgewick:[1]
The director of a prison offers 100 prisoners on death row, which are numbered from 1 to 100, a last
chance. In a room there is a cupboard with 100 drawers. The director puts in each drawer the number of
exactly one prisoner in random order and closes the drawers afterwards. The prisoners enter the room
one after another. Each prisoner may open and look into 50 drawers in any order and the drawers are
closed again afterwards. If during this search every prisoner finds his number in one of the drawers, all
prisoners are pardoned. If just one prisoner does not find his number, all prisoners have to die. Before the
first prisoner enters the room, the prisoners may discuss their strategy, afterwards no communication of
any means is possible. What is the best strategy for the prisoners?

http://en.wikipedia.org/wiki/100_prisoners_problem

1/7

9/26/2014

100 prisoners problem - Wikipedia, the free encyclopedia

If every prisoner selects 50 drawers at random, the probability that a single prisoner finds his number is 50%.
Therefore, the probability that all prisoners find their numbers is the product of the single probabilities which is
()100 0.0000000000000000000000000000008, a vanishingly small number. The situation appears hopeless
for the prisoners.

Solution
Strategy
Surprisingly, there is a strategy which gives the prisoners a survival probability of more than 30%. The key to
success is that the prisoners do not have to decide beforehand which drawers they are going to open. Each
prisoner can use the information gained from the contents of previously opened drawers to help him decide
which drawer to open next. Another important observation is that this way the success of one prisoner is not
independent of the success of the other prisoners.[2]
In order to describe the strategy, not only the prisoners, but also the drawers are numbered from 1 to 100. The
strategy is now as follows:[3]
1. Each prisoner first opens the drawer with his own number.
2. If this drawer contains his number he is finished with his search and was successful.
3. Otherwise, the drawer contains the number of another prisoner and he next opens the drawer with this
number.
4. The prisoner repeats steps 2 and 3 until he finds his own number or has opened 50 drawers.
This approach ensures that every time a prisoner opens a drawer he either finds his own number or the number of
another prisoner he has not encountered so far.

Examples
That this is a promising strategy is illustrated with the following example using eight prisoners and drawers,
whereby each prisoner may open four drawers. The prison director has distributed the prisoners' numbers into the
drawers in the following fashion
number of drawer

number of prisoner 7

The prisoners now act as follows:


Prisoner 1 first opens drawer 1 and finds number 7. Then he opens drawer 7 and finds number 5. Then he
opens drawer 5 where he finds his own number and is successful.
Prisoner 2 opens drawers 2, 4, and 8 in this order. In the last drawer he finds his own number 2.
Prisoner 3 opens drawers 3 and 6, where he finds his own number.
Prisoner 4 opens drawers 4, 8, and 2 where he finds his own number. An outside observer could have
derived this from the information gained by prisoner 2.
That prisoners 5 to 8 will also find their numbers can also be derived from the information gained by the
first three prisoners.
In this case, all prisoners will be successful in finding their numbers. This is, however, not always the case. In
the following example the prison director has distributed the numbers like this:
http://en.wikipedia.org/wiki/100_prisoners_problem

2/7

9/26/2014

100 prisoners problem - Wikipedia, the free encyclopedia

number of drawer

number of prisoner 3

In this case, prisoner 1 opens drawers 1, 3, 7, and 4, at which point he has to stop unsuccessfully. Except for
prisoner 6, who directly finds his number, all other prisoners are also unsuccessful.

Permutation representation
The prison director's assignment of prisoner numbers to drawers can
mathematically be described as a permutation of the numbers 1 to 100.
Such a permutation is a one-to-one mapping of the set of natural
numbers from 1 to 100 to itself. A sequence of numbers which after
repeated application of the permutation returns to the first number is
called a cycle of the permutation. The numbers in such a cycle are
arranged in a circular fashion (see pictures). Every permutation can be
decomposed into disjoint cycles and thus can be classified by its cycle
type. The permutation of the first example above can be written in cycle
notation as

Graph representations of the


permutations (1 7 5)(2 4 8)(3 6) and
(1 3 7 4 5 8 2)(6)

and thus consists of two cycles of length 3 and one cycle of length 2. The permutation of the second example is
accordingly

and consists of a cycle of length 7 and a cycle of length 1. The cycle notation is not unique since a cycle of
length can be written in different ways depending on the starting number of the cycle. During the opening the
drawers in the above strategy, each prisoner follows a single cycle which ends with his own number. In the case
of eight prisoners, this cycle-following strategy is successful if and only if the length of the longest cycle of the
permutation is at most 4. If a permutation contains a cycle of length 5 or more, all prisoners whose numbers lie
in such a cycle will not have reached their own number after 4 steps.

Probability of success
In the initial problem, the 100 prisoners will be successful if the longest
cycle of the permutation has a length of at most 50. Their survival
probability is therefore equal to the probability that a random permutation
of the numbers 1 to 100 contains no cycle of length greater than 50. This
probability is now determined.
A permutation of the numbers 1 to 100 can contain at most one cycle of
length
. There are exactly
ways to select the numbers of
such a cycle (see combination). Within this cycle, these numbers can be
arranged in
ways since there are possibilities to select the
starting number of the cycle. The remaining numbers can be arranged in
ways. Therefore, the number of permutations of the numbers
1 to 100 with a cycle of length
is equal to

Probability distribution of the length


of the longest cycle of a random
permutation of the numbers 1 to 100.
The green area corresponds to the
survival probability of the prisoners

http://en.wikipedia.org/wiki/100_prisoners_problem

3/7

9/26/2014

100 prisoners problem - Wikipedia, the free encyclopedia

The probability, that a (uniformly distributed) random permutation contains no cycle of length greater than 50 is
with the formula for single events and the formula for complementary events thus given by

,
where
is the -th harmonic number. Therefore, using the cycle-following strategy the prisoners survive in a
surprising 31% of cases.[3]

Asymptotics
If
instead of 100 prisoners are considered, where an arbitrary
natural number, the prisoners' survival probability with the cyclefollowing strategy is given by

The harmonic numbers are


approximately given by the area
under the hyperbola and can therefore
be approximated by a logarithm

.
With the Euler Mascheroni constant

for

holds, which results in an asymptotic survival probability of


.
Since the sequence of probabilites is monotonically decreasing, the prisoners survive with the cycle-following
strategy in more than 30% of cases independently of the number of prisoners.[3]

Optimality
In 2006, Eugene Curtin and Max Warshauer gave a proof for the optimality of the cycle-following strategy. The
proof is based on an equivalence to a related problem in which all prisoners are allowed to be present in the room
and observe the opening of the drawers, This equivalence is based on the correspondence of the (normalized)
cycle notation and the one-line notation of permutations. In the second problem, the survival probability is
independent of the chosen strategy and equal to the survival probability in the original problem with the cyclefollowing strategy. Since an arbitrary strategy for the original problem can also be applied to the second
problem, but cannot attain a higher survival probability there, the cycle-following strategy has to be optimal.[2]

History
http://en.wikipedia.org/wiki/100_prisoners_problem

4/7

9/26/2014

100 prisoners problem - Wikipedia, the free encyclopedia

The 100 prisoners problem was first considered in 2003 by Danish computer scientist Peter Bro Miltersen who
published it with Anna Gl in the proceedings of the 30. International Colloquium on Automata, Languages and
Programming (ICALP).[4] In their version, player A (the prison director) randomly colors strips of paper with
the names of the players of team B (the prisoners) in red or blue and puts each strip into a different box. Every
player of team B has to guess his color correctly after opening half of the boxes in order for their team to win.
Initially, Milterson assumed that the winning probability quickly tends to zero with increasing number of
players. Sven Skyum, a colleague of Miltersen at Aarhus University, however brought his attention to the cyclefollowing strategy. To find this strategy was left open as an exercise in the publication. The paper was honored
with the best paper award.[2]
In spring 2004, the problem appeared in Joe Buhler and Elwyn Berlekamp's puzzle column of the quarterly The
Emissary of the Mathematical Sciences Research Institute. Thereby, the authors replaced boxes by ROMs and
colored strips of paper by signed numbers. The authors noted that the winning probability can be increased also
in the case where the team members don't find their own numbers. If the given answer is the product of all the
signs found and if the length of the longest cycle is half the (even) number of players plus one, then the team
members in this cycle either all guess wrong or all guess right. Even if this extension of the strategy offers a
visible improvement for a small number of players, it becomes neglibile when the number of players becomes
large.[5]
In the following years, the problem entered the mathematical literature, where it was shaped in further different
ways, for example with cards on a table[6] or wallets in lockers (locker puzzle).[2] In the form of a prisoner
problem it was posed in 2006 by Christoph Pppe in the journal Spektrum der Wissenschaft and in 2007 by Peter
Winkler in his book Mathematical Mind-Benders.[7][8] With slight alterations this form was adopted by Philippe
Flajolet, Robert Sedgewick und Richard P. Stanley in their textbooks on combinatorics.[1][3]

Variants
Empty boxes
At first, Gl and Miltersen considered in their paper the case that the number of boxes is twice the number of
team members while half of the boxes are empty. This is a more difficult problem since empty boxes lead
nowhere and thus the cycle-following strategy cannot be applied. It is an open problem if in this case the
winning probability tends to zero with growing number of team members.[4]
In 2005, Navin Goyal and Michael Saks developed a strategy for team B based on the cycle-following strategy
for a more general problem in which the fraction of empty boxes as well as the fraction of boxes each team
member is allowed to open are variable. The winning probability still tends to zero in this case, but slower than
suggested by Gl and Miltersen. If the number of team members and the fraction of boxes which are opened is
fixed, the winning probability stays strictly larger than zero when more empty boxes are added.[9]
David Avis and Anne Broadbent considered in 2009 a quantum theoretical variant in which team B wins with
certainty.[10]

Monty Hall problem


In 2009, Adam S. Landsberg proposed the following simpler variant of the 100 prisoners problem which is based
on the well-known Monty Hall problem:[11]
Behind three closed doors a car, the car keys and a goat are randomly distributed. There are two players:
the first player has to find the car, the second player the keys to the car. Only if both players are successful
they may drive the car home. The first player enters the room and may consecutively open two of the three
doors. If he is successful, the doors are closed again and the second player enters the room. The second
http://en.wikipedia.org/wiki/100_prisoners_problem

5/7

9/26/2014

100 prisoners problem - Wikipedia, the free encyclopedia

player may also open two of the three doors, but he cannot communicate with the first player in any form.
What is the winning probability if both players act optimally?
If the players select their doors randomly, the winning probability is only 4/9 (about 44%). The optimal strategy
is, however, as follows:
Player 1 first opens door 1. If the car is behind the door, he is successful. If the keys are behind the door,
he next opens door 2, if the goat is behind the door, he next opens door 3.
Player 2 first opens door 2. If the keys are behind the door, he is successful. If the goat is behind the door,
he next opens door 3, if the car is behind the door, he next opens door 1.
In the six possible distributions of car, keys and goat behind the three doors, the players open the following doors
(in the green cases, the player was successful):

Player
1
Player
2

Car Keys

Car Goat

Keys Car

Keys Goat Goat Car

Goat Keys

Goat

Keys

Goat

Car

Keys

Car

Door 1: Car

Door 1: Car

Door 1: Keys

Door 1: Keys

Door 1: Goat

Door 1: Goat

Door 2: Car

Door 2: Goat

Door 3: Keys

Door 3: Car

Door 2: Goat

Door 2: Car

(Door 2: Goat) (Door 2: Car)

Door 3: Keys

Door 1: Keys

(Door 3: Car)

Door 2: Keys

(Door 1: Goat)

Door 2: Keys

The success of the strategy is based on building a correlation between the successes and failures of the two
players. Here, the winning probability is 2/3 which is optimal since the first player does not have a higher
winning probability.[11] In a further variant, three prizes are hidden behind the three doors and three players have
to independently find their assigned prizes with two tries. In this case the winning probability is also 2/3 when
the optimal strategy is employed.[12]

See also
Prisoner's dilemma
Three prisoners problem
Random permutation statistics
Golomb-Dickman constant

References
1. ^ a b Philippe Flajolet, Robert Sedgewick (2009), Analytic Combinatorics, Cambridge University Press, p. 124
2. ^ a b c d Eugene Curtin, Max Warshauer (2006), "The locker puzzle
(http://link.springer.com/article/10.1007/BF02986999)", Mathematical Intelligencer 28: 2831
3. ^ a b c d Richard P. Stanley (2013), Algebraic Combinatorics: Walks, Trees, Tableaux, and More, Springer, pp. 187
189
4. ^ a b Anna Gl, Peter Bro Miltersen (2003), "The cell probe complexity of succinct data structures", Proceedings 30th
International Colloquium on Automata, Languages and Programming (ICALP), pp. 332344
5. ^ Joe Buhler, Elwyn Berlekamp (2004), "Puzzles Column", The Emissary (http://www.msri.org/web/msri/aboutmsri/news/emissary-newsletter) (Mathematical Sciences Research Institute), Spring 2004: 3
6. ^ Richard E. Blahut (2014), Cryptography and Secure Communication, Cambridge University Press, pp. 2930
http://en.wikipedia.org/wiki/100_prisoners_problem

6/7

9/26/2014

100 prisoners problem - Wikipedia, the free encyclopedia

7. ^ Christoph Pppe (2006), Mathematische Unterhaltungen, "Freiheit fr die Kombinatoriker


(http://www.spektrum.de/alias/mathematische-unterhaltungen/freiheit-fuer-die-kombinatoriker/848868)", Spektrum
der Wissenschaft (in german), 6/2006: 106108
8. ^ Peter Winkler (2007), Mathematical Mind-Benders, Taylor and Francis, p. 12
9. ^ Navin Goyal, Michael Saks (2005), "A parallel search game", Random Structures & Algorithms 27 (2): 227234
10. ^ David Avis, Anne Broadbent (2009), "The quantum locker puzzle", Third International Conference on Quantum,
Nano and Micro Technologies ICQNM '09, pp. 6366
11. ^ a b Adam S. Landsberg (2009), "The Return of Monty Hall (http://link.springer.com/article/10.1007/s00283-0089016-8)", Mathematical Intelligencer 31 (2)
12. ^ Eric Grundwald (2010), "Re: The Locker Puzzle (http://link.springer.com/article/10.1007/s00283-009-9107-1)",
Mathematical Intelligencer 32 (2)

Literature
Philippe Flajolet, Robert Sedgewick (2009), Analytic Combinatorics, Cambridge University Press,
ISBN 978-1-139-47716-1
Richard P. Stanley (2013), Algebraic Combinatorics: Walks, Trees, Tableaux, and More, Undergraduate
Texts in Mathematics, Springer, ISBN 978-1-461-46998-8
Peter Winkler (2007), Mathematical Mind-Benders, Taylor and Francis, ISBN 978-1-568-81336-3

External links
Rob Heaton: Mathematicians hate civil liberties - 100 prisoners and 100 boxes
(http://robertheaton.com/2014/01/13/mathematicians-hate-civil-liberties-100-prisoners-100-boxes/), 13
January 2014
Oliver Nash: Pity the prisoners (http://ocfnash.wordpress.com/2009/12/12/pity-the-prisoners/), 12
December 2009
Jamie Mulholland: Prisoners in Boxes (http://people.math.sfu.ca/~jtmulhol/math302/notes/25-Prisonersin-Boxes.pdf), Spring 2011 (PDF)
Retrieved from "http://en.wikipedia.org/w/index.php?title=100_prisoners_problem&oldid=619885937"
Categories: Recreational mathematics Probability theory paradoxes Permutations
This page was last modified on 4 August 2014 at 23:05.
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may
apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia is a registered
trademark of the Wikimedia Foundation, Inc., a non-profit organization.

http://en.wikipedia.org/wiki/100_prisoners_problem

7/7

Você também pode gostar