# Three Prisoners problem

Last updated

The Three Prisoners problem appeared in Martin Gardner's "Mathematical Games" column in Scientific American in 1959.   It is mathematically equivalent to the Monty Hall problem with car and goat replaced respectively with freedom and execution.

## Problem

Three prisoners, A, B, and C, are in separate cells and sentenced to death. The governor has selected one of them at random to be pardoned. The warden knows which one is pardoned, but is not allowed to tell. Prisoner A begs the warden to let him know the identity of one of the two who are going to be executed. "If B is to be pardoned, give me C's name. If C is to be pardoned, give me B's name. And if I'm to be pardoned, secretly flip a coin to decide whether to name B or C."

The warden tells A that B is to be executed. Prisoner A is pleased because he believes that his probability of surviving has gone up from 1/3 to 1/2, as it is now between him and C. Prisoner A secretly tells C the news, who reasons that A's chance of being pardoned is unchanged at 1/3, but he is pleased because his own chance has gone up to 2/3. Which prisoner is correct?

## Solution

The answer is that prisoner A did not gain any information about his own fate, since he already knew that the warden would give him the name of someone else. Prisoner A, prior to hearing from the warden, estimates his chances of being pardoned as 1/3, the same as both B and C. As the warden says B will be executed, it is either because C will be pardoned (1/3 chance), or A will be pardoned (1/3 chance) and the coin to decide whether to name B or C the warden flipped came up B (1/2 chance; for an overall 1/2 × 1/3 = 1/6 chance B was named because A will be pardoned). Hence, after hearing that B will be executed, the estimate of A's chance of being pardoned is half that of C. This means his chances of being pardoned, now knowing B is not, again are 1/3, but C has a 2/3 chance of being pardoned.

### Table

The explanation above may be summarised in the following table. As the warden is asked by A, he can only answer B or C to be executed (or "not pardoned").

Being pardonedWarden: "not B"Warden: "not C"Sum
A1/61/61/3
B01/31/3
C1/301/3

As the warden has answered that B will not be pardoned, the solution comes from the second column "not B". It appears that the odds for A vs. C to be pardoned are 1:2.

### Mathematical formulation

Call $A$ , $B$ and $C$ the events that the corresponding prisoner will be pardoned, and $b$ the event that the warden tells A that prisoner B is to be executed, then, using Bayes' theorem, the posterior probability of A being pardoned, is: 

{\begin{aligned}P(A|b)&={\frac {P(b|A)P(A)}{P(b|A)P(A)+P(b|B)P(B)+P(b|C)P(C)}}\\&={\frac {{\tfrac {1}{2}}\times {\tfrac {1}{3}}}{{\tfrac {1}{2}}\times {\tfrac {1}{3}}+0\times {\tfrac {1}{3}}+1\times {\tfrac {1}{3}}}}={\frac {1}{3}}.\end{aligned}} The probability of C being pardoned, on the other hand, is:

{\begin{aligned}P(C|b)&={\frac {P(b|C)P(C)}{P(b|A)P(A)+P(b|B)P(B)+P(b|C)P(C)}}\\&={\frac {1\times {\tfrac {1}{3}}}{{\tfrac {1}{2}}\times {\tfrac {1}{3}}+0\times {\tfrac {1}{3}}+1\times {\tfrac {1}{3}}}}={\frac {2}{3}}.\end{aligned}} The crucial difference making A and C unequal is that $P(b|A)={\tfrac {1}{2}}$ but $P(b|C)=1$ . If A will be pardoned, the warden can tell A that either B or C is to be executed, and hence $P(b|A)={\tfrac {1}{2}}$ ; whereas if C will be pardoned, the warden can only tell A that B is executed, so $P(b|C)=1$ .

## An intuitive explanation

Prisoner A only has a 1/3 chance of pardon. Knowing whether B or C will be executed does not change his chance. After he hears B will be executed, Prisoner A realizes that if he will not get the pardon himself it must only be going to C. That means there is a 2/3 chance for C to get a pardon. This is comparable to the Monty Hall problem.

### Enumeration of possible cases

The following scenarios may arise:

1. A is pardoned and the warden mentions B to be executed: 1/3 × 1/2 = 1/6 of the cases
2. A is pardoned and the warden mentions C to be executed: 1/3 × 1/2 = 1/6 of the cases
3. B is pardoned and the warden mentions C to be executed: 1/3 of the cases
4. C is pardoned and the warden mentions B to be executed: 1/3 of the cases

With the stipulation that the warden will choose randomly, in the 1/3 of the time that A is to be pardoned, there is a 1/2 chance he will say B and 1/2 chance he will say C. This means that taken overall, 1/6 of the time (1/3 [that A is pardoned] × 1/2 [that warden says B]), the warden will say B because A will be pardoned, and 1/6 of the time (1/3 [that A is pardoned] × 1/2 [that warden says C]) he will say C because A is being pardoned. This adds up to the total of 1/3 of the time (1/6 + 1/6) A is being pardoned, which is accurate.

It is now clear that if the warden answers B to A (1/2 of all cases), then 1/3 of the time C is pardoned and A will still be executed (case 4), and only 1/6 of the time A is pardoned (case 1). Hence C's chances are (1/3)/(1/2) = 2/3 and A's are (1/6)/(1/2) = 1/3.

The key to this problem is that the warden may not reveal the name of a prisoner who will be pardoned. If we eliminate this requirement, it can demonstrate the original problem in another way. The only change in this example is that prisoner A asks the warden to reveal the fate of one of the other prisoners (not specifying one that will be executed). In this case, the warden flips a coin and chooses one of B and C to reveal the fate of. The cases are as follows:

1. A pardoned, warden says: B executed (1/6)
2. A pardoned, warden says: C executed (1/6)
3. B pardoned, warden says: B pardoned (1/6)
4. B pardoned, warden says: C executed (1/6)
5. C pardoned, warden says: B executed (1/6)
6. C pardoned, warden says: C pardoned (1/6)

Each scenario has a 1/6 probability. The original Three Prisoners problem can be seen in this light: The warden in that problem still has these six cases, each with a 1/6 probability of occurring. However, the warden in the original case cannot reveal the fate of a pardoned prisoner. Therefore, in case 3 for example, since saying "B is pardoned" is not an option, the warden says "C is executed" instead (making it the same as case 4). That leaves cases 4 and 5 each with a 1/3 probability of occurring and leaves us with the same probability as before.

The tendency of people to provide the answer 1/2 is likely due to a tendency to ignore context that may seem unimpactful. For example, how the question is posed to the warden can affect the answer. This can be shown by considering a modified case, where $P(A)={\frac {1}{4}},P(B)={\frac {1}{4}},P(C)={\frac {1}{2}}$ and everything else about the problem remains the same.  Using Bayes' Theorem once again:

{\begin{aligned}P(A|b)&={\frac {{\tfrac {1}{2}}\times {\tfrac {1}{4}}}{{\tfrac {1}{2}}\times {\tfrac {1}{4}}+0\times {\tfrac {1}{4}}+1\times {\tfrac {1}{2}}}}={\frac {1}{5}}.\end{aligned}} However, if A simply asks if B will be executed, and the warden responds with "yes", the probability that A is pardoned becomes:

{\begin{aligned}P(A|b)&={\frac {1\times {\tfrac {1}{4}}}{1\times {\tfrac {1}{4}}+0\times {\tfrac {1}{4}}+1\times {\tfrac {1}{2}}}}={\frac {1}{3}}.\end{aligned}} A similar assumption is that A plans beforehand to ask the warden for this information. A similar case to the above arises if A does not plan to ask the warden anything and the warden simply informs him that he will be executing B. 

Another likely overlooked assumption is that the warden has a probabilistic choice. Let us define $p$ as the conditional probability that the warden will name B given that C will be executed. The conditional probability $P(A|b)$ can be then expressed as: 

{\begin{aligned}P(A|b)&={\frac {p}{p+1}}\end{aligned}} If we assume that $p=1$ , that is, that we do not take into account that the warden is making a probabilistic choice, then $P(A|b)={\frac {1}{2}}$ . However, the reality of the problem is that the warden is flipping a coin ($p={\frac {1}{2}}$ ), so $P(A|b)={\frac {1}{3}}$ . 

Judea Pearl (1988) used a variant of this example to demonstrate that belief updates must depend not merely on the facts observed but also on the experiment (i.e., query) that led to those facts. 

## Related Research Articles In probability theory and statistics, the binomial distribution with parameters n and p is the discrete probability distribution of the number of successes in a sequence of n independent experiments, each asking a yes–no question, and each with its own Boolean-valued outcome: success or failure. A single success/failure experiment is also called a Bernoulli trial or Bernoulli experiment, and a sequence of outcomes is called a Bernoulli process; for a single trial, i.e., n = 1, the binomial distribution is a Bernoulli distribution. The binomial distribution is the basis for the popular binomial test of statistical significance. In probability theory, the expected value is a generalization of the weighted average. Informally, the expected value is the arithmetic mean of a large number of independently selected outcomes of a random variable. Probability is the branch of mathematics concerning numerical descriptions of how likely an event is to occur, or how likely it is that a proposition is true. The probability of an event is a number between 0 and 1, where, roughly speaking, 0 indicates impossibility of the event and 1 indicates certainty. The higher the probability of an event, the more likely it is that the event will occur. A simple example is the tossing of a fair (unbiased) coin. Since the coin is fair, the two outcomes are both equally probable; the probability of "heads" equals the probability of "tails"; and since no other outcomes are possible, the probability of either "heads" or "tails" is 1/2.

In probability theory and statistics, Bayes' theorem, named after Thomas Bayes, describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For example, if the risk of developing health problems is known to increase with age, Bayes' theorem allows the risk to an individual of a known age to be assessed more accurately than simply assuming that the individual is typical of the population as a whole. In probability theory, the birthday problem asks for the probability that, in a set of n randomly chosen people, at least two will share a birthday. The birthday paradox is that, counterintuitively, the probability of a shared birthday exceeds 50% in a group of only 23 people. In probability theory and statistics, the hypergeometric distribution is a discrete probability distribution that describes the probability of successes in draws, without replacement, from a finite population of size that contains exactly objects with that feature, wherein each draw is either a success or a failure. In contrast, the binomial distribution describes the probability of successes in draws with replacement. In probability theory and statistics, the beta distribution is a family of continuous probability distributions defined on the interval [0, 1] in terms of two positive parameters, denoted by alpha (α) and beta (β), that appear as exponents of the random variable and control the shape of the distribution.

A randomized algorithm is an algorithm that employs a degree of randomness as part of its logic or procedure. The algorithm typically uses uniformly random bits as an auxiliary input to guide its behavior, in the hope of achieving good performance in the "average case" over all possible choices of random determined by the random bits; thus either the running time, or the output are random variables.

In information theory, the information content, self-information, surprisal, or Shannon information is a basic quantity derived from the probability of a particular event occurring from a random variable. It can be thought of as an alternative way of expressing probability, much like odds or log-odds, but which has particular mathematical advantages in the setting of information theory. In complexity theory, PP is the class of decision problems solvable by a probabilistic Turing machine in polynomial time, with an error probability of less than 1/2 for all instances. The abbreviation PP refers to probabilistic polynomial time. The complexity class was defined by Gill in 1977.

The Solovay–Strassen primality test, developed by Robert M. Solovay and Volker Strassen in 1977, is a probabilistic test to determine if a number is composite or probably prime. The idea behind the test was discovered by M. M. Artjuhov in 1967 (see Theorem E in the paper). This test has been largely superseded by the Baillie–PSW primality test and the Miller–Rabin primality test, but has great historical importance in showing the practical feasibility of the RSA cryptosystem. The Solovay–Strassen test is essentially an Euler–Jacobi pseudoprime test. In probability theory, a distribution is said to be stable if a linear combination of two independent random variables with this distribution has the same distribution, up to location and scale parameters. A random variable is said to be stable if its distribution is stable. The stable distribution family is also sometimes referred to as the Lévy alpha-stable distribution, after Paul Lévy, the first mathematician to have studied it. A fraction represents a part of a whole or, more generally, any number of equal parts. When spoken in everyday English, a fraction describes how many parts of a certain size there are, for example, one-half, eight-fifths, three-quarters. A common, vulgar, or simple fraction consists of a numerator, displayed above a line, and a non-zero denominator, displayed below that line. Numerators and denominators are also used in fractions that are not common, including compound fractions, complex fractions, and mixed numerals.

The Boy or Girl paradox surrounds a set of questions in probability theory, which are also known as The Two Child Problem, Mr. Smith's Children and the Mrs. Smith Problem. The initial formulation of the question dates back to at least 1959, when Martin Gardner featured it in his October 1959 "Mathematical Games column" in Scientific American. He titled it The Two Children Problem, and phrased the paradox as follows:

Lottery mathematics is used to calculate probabilities of winning or losing a lottery game. It is based primarily on combinatorics, particularly the twelvefold way and combinations without replacement.

Freivalds' algorithm is a probabilistic randomized algorithm used to verify matrix multiplication. Given three n × n matrices , , and , a general problem is to verify whether . A naïve algorithm would compute the product explicitly and compare term by term whether this product equals . However, the best known matrix multiplication algorithm runs in time. Freivalds' algorithm utilizes randomization in order to reduce this time bound to with high probability. In time the algorithm can verify a matrix product with probability of failure less than . The Monty Hall problem is a brain teaser, in the form of a probability puzzle, loosely based on the American television game show Let's Make a Deal and named after its original host, Monty Hall. The problem was originally posed in a letter by Steve Selvin to the American Statistician in 1975. It became famous as a question from reader Craig F. Whitaker's letter quoted in Marilyn vos Savant's "Ask Marilyn" column in Parade magazine in 1990:

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?

Beliefs depend on the available information. This idea is formalized in probability theory by conditioning. Conditional probabilities, conditional expectations, and conditional probability distributions are treated on three levels: discrete probabilities, probability density functions, and measure theory. Conditioning leads to a non-random result if the condition is completely specified; otherwise, if the condition is left random, the result of conditioning is also random. In probability theory, conditional probability is a measure of the probability of an event occurring, given that another event has already occurred. This particular method relies on event B occurring with some sort of relationship with another event A. In this event, the event B can be analyzed by a conditional probability with respect to A. If the event of interest is A and the event B is known or assumed to have occurred, "the conditional probability of A given B", or "the probability of A under the condition B", is usually written as P(A|B) or occasionally PB(A). This can also be understood as the fraction of probability B that intersects with A: .

In probabilistic logic, the Fréchet inequalities, also known as the Boole–Fréchet inequalities, are rules implicit in the work of George Boole and explicitly derived by Maurice Fréchet that govern the combination of probabilities about logical propositions or events logically linked together in conjunctions or disjunctions as in Boolean expressions or fault or event trees common in risk assessments, engineering design and artificial intelligence. These inequalities can be considered rules about how to bound calculations involving probabilities without assuming independence or, indeed, without making any dependence assumptions whatsoever. The Fréchet inequalities are closely related to the Boole–Bonferroni–Fréchet inequalities, and to Fréchet bounds.

1. Gardner, Martin (October 1959). "Mathematical Games: Problems involving questions of probability and ambiguity". Scientific American. 201 (4): 174–182. doi:10.1038/scientificamerican1059-174.
2. Gardner, Martin (1959). "Mathematical Games: How three modern mathematicians disproved a celebrated conjecture of Leonhard Euler". Scientific American. 201 (5): 188. doi:10.1038/scientificamerican1159-181.
3. Shimojo, Shinsuke; Ichikawa, Shin'Ichi (August 1990). "Intuitive reasoning about probability: Theoretical and experimental analyses of the "problem of three prisoners"". Cognition. 36 (2): 205. doi:10.1016/0010-0277(89)90012-7.
4. Wechsler, Sergio; Esteves, L. G.; Simonis, A.; Peixoto, C. (February 2005). "Indifference, Neutrality and Informativeness: Generalizing the Three Prisoners Paradox". Synthese. 143 (3): 255–272. Retrieved 15 December 2021.
5. Billingsley 1995, Exercise 33.3, pp. 441 and 576.
6. Pearl, J. (1988). (First ed.). San Mateo, CA: Morgan Kaufmann.