Tuesday, March 18, 2014

3 Prisoners Problem

In one of my classes, we were given the following problem.

Three prisoners, A, B, C are in their cells. They are told that one of them will be executed the next day and the others will be pardoned. Only the governor knows who will be executed. Prisoner A asks the guard a favor. “Please ask the governor who will be executed, and then tell either prisoner B or C that they will be pardoned.” The guard does as was asked and then comes back and tells prisoner A that he has told prisoner B that he (B) will be pardoned. What are prisoner A’s chances of being executed, given this message? Is there more information than before his request to the guard?


At first glance, it probably seems that prisoner A would have a 50/50 chance of pardon. That seems obvious since Prisoner A knows that Prisoner B or C has one of the pardons and the other would go to him or the remaining prisoner. But let's take a look at the math.

In this case, there are four possible cases.

Case 1: Prisoner A is to be executed, Prisoner B was told by the guard he was to be pardoned.

Case 2: Prisoner A is to be executed, Prisoner C was told by the guard he was to be pardoned.

Case 3: Prisoner B is to be executed, Prisoner C was told by the guard he was to be pardoned.

Case 4: Prisoner C is to be executed, Prisoner B was told by the guard he was to be pardoned.

There are no other possible valid cases.

So given those 4 possibilities, we find the following probabilities:

p(Btold | A) = 1/2, p(Btold | B) = 0, and p(Btold | C) = 1.

And from the problem statement, we know that p(A) = p(B) =  p(C) = 1/3.

However, we are trying to calculate p(A | Btold). Let's use Bayes Theorem.

p(A | Btold) = ( p(Btold | A) * p(A) ) / ( p(Btold | A) * p(A) + p(Btold | B) * p(B) + p(Btold | C) * p(C) )

p(A | Btold) = ( 1/2 * 1/3 ) / ( 1/2 * 1/3 + 0 * 1/3 + 1 * 1/3) = (1/6) / ( 1/6 + 2/6) = 1/3

So we find that the probability of Prisoner A being executed given that Prisoner B was told he will be pardoned is 1/3, the same as before he know of Prisoner B being pardoned. However, for Prisoner C, since we know that the probability of p(B | Btold) must be 0, that is that Prisoner B cannot be executed if he is told he will be pardoned and p(Btold | B) * p(B) = 0, and the probability of p(A | Btold) + p(B | Btold) + p(C | Btold) = 1, that is that one of the 3 prisoners must be executed, we find that the probability of Prisoner C being pardoned is now 1 - 1/3 = 2/3.

Alternatively,

p(C | Btold) = ( p(Btold | C) * p(C) ) / ( p(Btold | A) * p(A) + p(Btold | B) * p(B) + p(Btold | C) * p(C) )

p(C | Btold) = ( 1 * 1/3 ) / ( 1/2 * 1/3 + 0 * 1/3 + 1 * 1/3) = (1/3) / ( 1/6 + 2/6) = 2/3


Additionally, I wrote a python program that allows execution of the 3 prisoner problem.
https://drive.google.com/file/d/0B9EB3hdj0VV9ZkdZTDR4UkpwbEU/edit?usp=sharing


The best strategy though might just be to stay out of jail.

Monday, March 17, 2014

Most of them grew

This morning at church, the topic of the parable of the sower came up. Something I had never thought about before is that in the story, most of the seeds began growing.

Matthew 13

That same day Jesus went out of the house and sat beside the sea. Such great crowds gathered around him that he got into a boat and sat there, while the whole crowd stood on the beach. And he told them many things in parables, saying: “Listen! A sower went out to sow. And as he sowed, some seeds fell on the path, and the birds came and ate them up. Other seeds fell on rocky ground, where they did not have much soil, and they sprang up quickly, since they had no depth of soil. But when the sun rose, they were scorched; and since they had no root, they withered away. Other seeds fell among thorns, and the thorns grew up and choked them. Other seeds fell on good soil and brought forth grain, some a hundredfold, some sixty, some thirty. Let anyone with ears listen!”

A few verses later, Jesus explains the parable to the disciples.

“Hear then the parable of the sower. When anyone hears the word of the kingdom and does not understand it, the evil one comes and snatches away what is sown in the heart; this is what was sown on the path. As for what was sown on rocky ground, this is the one who hears the word and immediately receives it with joy; yet such a person has no root, but endures only for a while, and when trouble or persecution arises on account of the word, that person immediately falls away. As for what was sown among thorns, this is the one who hears the word, but the cares of the world and the lure of wealth choke the word, and it yields nothing. But as for what was sown on good soil, this is the one who hears the word and understands it, who indeed bears fruit and yields, in one case a hundredfold, in another sixty, and in another thirty.”

Something that struck me was of the 4 seeds, 3 of them began to grow. Only the one on the path didn't begin to grow.

So that leaves 1 on the rocky soil, 1 in the thorns, and 1 on the good soil. Of those, they all heard the gospel and made some type of response. An interesting discussion could be had regarding the state of salvation for each of them, but that clearly isn't the point of the parable. What is the point is that we aren't called to just have an initial response to the gospel, but for our entire life to be a response to the gospel and to produce a harvest for God.


We are called for more than a sinner's prayer and walk down to the front at the end of a service.