The unexpected hanging paradox is as follows:

A judge tells a condemned prisoner that he will be hanged at noon on one weekday in the following week but that the execution will be a surprise to the prisoner. He will not know the day of the hanging until the executioner knocks on his cell door at noon that day.

Having reflected on his sentence, the prisoner draws the conclusion that he will escape from the hanging. His reasoning is in several parts. He begins by concluding that the "surprise hanging" can't be on Friday, as if he hasn't been hanged by Thursday, there is only one day left - and so it won't be a surprise if he's hanged on Friday. Since the judge's sentence stipulated that the hanging would be a surprise to him, he concludes it cannot occur on Friday.

He then reasons that the surprise hanging cannot be on Thursday either, because Friday has already been eliminated and if he hasn't been hanged by Wednesday night, the hanging must occur on Thursday, making a Thursday hanging not a surprise either. By similar reasoning he concludes that the hanging can also not occur on Wednesday, Tuesday or Monday. Joyfully he retires to his cell confident that the hanging will not occur at all.

The next week, the executioner knocks on the prisoner's door at noon on Wednesday — which, despite all the above, was an utter surprise to him. Everything the judge said came true.

1. How is it that despite the prisoner's sound logic, the judge is correct just the same?
2. Assuming the prisoner is a logician, is it even possible for the judge to be wrong?

The biggest problem with the prisoner's proof is that his model is incomplete. One piece of that is that it merges two key variables - days on which the execution can happen, and days on which the prisoner believes it possible to happen. It's easy to see why these two were merged - because of the requirement of surprise, they are strongly correlated. However, by believing it impossible for the execution to happen on a particular day, he in fact makes it possible for it to happen on that day.

Understanding this shows where his proof falls apart. He believes that there is no alternative to his being executed by Friday at the latest, which means that he cannot be executed on Friday. However he ends up concluding that he will not be executed at all, which means that there is now an alternative to his being executed by the last day. Thus the basis of his proof is invalidated. Of course he doesn't realize this, so he confidently believes the set of days on which he could be executed to be empty, which allows the set of days on which he can be surprised by being executed to be all weekdays of the following week.

Unfortunately for the prisoner, if he were a perfect logician he would realize that there is no stable solution for which he knows any information about which days he might be executed on. Again, this is because the possibility of being executed on a given day is tied to his knowledge of it. If he comes to the conclusion that he will be executed on a particular day, it wouldn't be a surprise, meaning that he won't be executed on that day, but by knowing he won't be executed on that particular day it means he can be executed on that day. Thus any knowledge about being executed on a particular day is inherently unstable, meaning that he doesn't actually have any knowledge about what will happen.

Fortunately for us, our knowledge of the prisoner's execution date does not affect the possibility of his being executed on that date. This allows us to use a complete model to represent what is happening. We know based on the prisoner's proof that he believes he will not be executed. So as I stated before, because the set of days on which he believed he could be executed was empty, he would have been surprised on any of the days.

• You sound like the prisoner could think differently and this would break the paradox (judge would like). Do you? – klm123 Sep 22 '14 at 21:15
• Good point. Not expecting it to happen on Friday by deduction of logic is making Friday a perfectly valid day to be executed and be surprised. If he had taken this into consideration, he would have realized that any day is a valid day to be executed. – Neil Sep 23 '14 at 7:41
• @Neil, it is important to note, that this would not help him and the judge would be still correct in all his sentences. – klm123 Sep 23 '14 at 7:45
• @klm123 I suppose it is besides the point if it helps him or not. Realizing that the execution could happen whenever still makes it a surprise, even if he's familiar with the unexpected hanging paradox. Judge can be telling the truth and always be right, if we're assuming the prisoner is a logician (obviously if not, prisoner could falsly assume it is going to happen on Wednesday, and it may in fact be Wednesday). – Neil Sep 23 '14 at 7:50
• @Neil, if prisoner is logician he can't conclude that execution can happen whenever, he can't conclude anything, because all logical conclusions are contradictory. This is the point. For example, what if execution would be planned on Friday, can he assume that it can happen whenever at Thursday evening? Once you answered this question you can ask what he would assume on Wensday... and understand that you go in circles from one conclusion to another. You can chose different points to stop (wiki explanation, or this answer) but you still will be on this circle. I hope you understand what I mean. – klm123 Sep 23 '14 at 10:07

The simple (and I believe the only) answer to both your questions is "This is a paradox, so logic does not have predictability power here".

Martin Gardner described this paradox in detail. Unfortunately, I can't find the English version online, but if you know Russian, you can find it here (The English Google translation is here). The English version should be in his book The unexpected hanging and other mathematical diversions.

P.S. The paradox is most extreme and easier to feel in the 1-day version (A judge tells a condemned prisoner that he will be hanged at noon tomorrow but that the execution will be a surprise to the prisoner).
The formulation stays the same: "He begins by concluding that the "surprise hanging" can't be tomorrow - it won't be a surprise. Since the judge's sentence stipulated that the hanging would be a surprise to him, he concludes it cannot occur tomorrow. Joyfully, he retires to his cell confident that the hanging will not occur at all. The next day, the executioner knocks on the prisoner's door — which, despite all the above, was an utter surprise to him. Everything the judge said came true."

• @EnvisionAndDevelop, this paradox usually leads to super-huge discussions, so I just tell you that according to official version there is. – klm123 Sep 22 '14 at 14:39
• Can these questions not be answered by using the fallacy in the paradox? – Neil Sep 22 '14 at 14:40
• @Neil, you mean to say "judge can lie"? Then there won't be a paradox, this would be different situation. "Judge always tells truth" is a part of the paradox formulation as everything else. – klm123 Sep 22 '14 at 14:47
• @EnvisionAndDevelop, all the same: "He begins by concluding that the "surprise hanging" can't be on tommorow - it won't be a surprise. Since the judge's sentence stipulated that the hanging would be a surprise to him, he concludes it cannot occur tommorow. Joyfully, he retires to his cell confident that the hanging will not occur at all. Tommorow, the executioner knocks on the prisoner's door — which, despite all the above, was an utter surprise to him. Everything the judge said came true." – klm123 Sep 22 '14 at 15:49
• It goes like this: The prisoner resons that the juge must have lied either by saying he will be hanged or by saying it will be a surprise. So he hasn't a clue which way it will be. Therefore, when he is hanged, it is a surprise. The paradox is that in the end, the juge was right on both counts. – Florian F Sep 22 '14 at 16:20

1. Assuming the prisoner is a logician, is it even possible for the judge to be wrong?

All that is needed for the judge to be wrong is for the prisoner to not be surprised.

Having reasoned that discounting the days from Friday backwards leads to a contradiction with the judge's statement that the prisoner will be hanged (and consequently, him being surprised regardless of which day is picked), the prisoner can move to considering the surprise element more carefully.

Since he has no knowledge of the day picked for his execution, he assigns each remaining weekday an equal probability. So immediately prior to Monday, each day has a 20% probability of being picked; on Monday after noon, each day now has a 25% probability of being picked.

When the executioner comes to retrieve the prisoner on Wednesday, the prisoner has assigned a 1/3 probability to that day. Since this is the same probability assigned (at the time of the executioner's arrival) to every other remaining day, it would be illogical to be surprised. So being a perfect logician, he's not surprised that the executioner came for him on Wednesday.

Being not surprised, however, proves the judge wrong. QED

One of the main problems presented here is that his theory works one way, but not the other. The way he works it out makes sense, but let's say you did it from Monday onward. You would conclude that it could happen on Monday because there is no evidence to suggest otherwise. The same goes for the entire week.

You also have to consider that his logic on not being executed on Friday is sound, but adding on to that doesn't help. There is a one fifth chance of him being executed for each separate day of the week. Removing Friday makes this so that there is a one fourth chance of him being executed on Monday, Tuesday, Wednesday, or Thursday. Continue removing, and you end up with a 100% chance of his execution on Monday. If he uses mathematics, he could figure this out, and therefore expect it all the same. If he narrowed it down to a 50% chance on Monday or Tuesday, he wouldn't be able to correctly predict either day. The reason the judge is right is that no matter what scenario he uses, there is an equal chance of being executed on each day, and therefore it is random.

You must also look at the fact that by eliminating every day of the week, he can't expect any of them, and therefore the judge is correct no matter what day he chooses.

I believe that the judge was smart and the question incorporates human interpretation or assumption.

The judge states that the man will be executed in some day between Monday to Friday (inclusive of Monday and Friday). But he would not reveal the day to surprise the prisoner.

Now the prisoner eliminates the days and figures out that there is no day that he could be surprised. This the judge probably anticipated and rooted for.

WHAT GOES TERRIBLY WRONG is that the statement is misinterpreted by the prisoner. He assumes that just because he cannot be surprised he would not be executed, something the judge probably wanted him to feel. So no matter what day he chooses to execute the prisoner he would still be surprised.

Hence the judge outfoxed the prisoner by letting him make his assumptions. This problem clearly meant to exploit both human nature and logical reasoning and hence it is pretty famous.

Logic:

The judge said that the prisoner would be executed. He also said he would be surprised.

Join both these statements with an AND operator then only when both statements are true the prisoner will be hung.

The prisoner joined both the statements with an 'and' hence was surprised when he was called to be executed.

The translated problem is "there's certainty only if there's uncertainty", so it has no solution. Not only there's a contradiction in that, but also a mockery on logic, because uncertainty itself cannot be used for reasoning for certainty. When solving a problem, uncertainty is something we start from and then we get to certainty. But we cannot use uncertainty itself as a requirement (except for when it's the uncertainty of an external person not aware of 100% of the details - that's not the case here).

So, back to our detainee, assuming she/he has sufficiently strong reasoning (otherwise, no sense to discuss a "drunk" man's logic) - before the end conclusion of no hanging -, "there's surprise" can be translated into "there's uncertainty". He should tell the judge: "Sir, your affirmations can't all be true, because it would mean that each morning, starting with Friday, <there's certainty that day I die if there's uncertainty of it> - as saying <a rose is red if it's yellow>".

So it is an invalid formulation, nicely hidden. A variation on Moore's paradox, contradicting on itself.

• "assuming she/he has sufficiently strong reasoning" - this isn't a good assumption. I think the clever part of the story is that most people have heard enough puzzles about perfect logicians to immediately assume this prisoner must also be one, but as I pointed out in my answer we can see the prisoner is definitely not one. The story wouldn't be nearly as clever if the prisoner's reasoning was "this rock spoke to me and told me I wouldn't be executed", but instead gives a proof that is only subtly wrong. – Rob Watts Sep 6 '20 at 4:10
• You're right, I had left out the part "Joyfully he retires to his cell confident that the hanging will not occur at all". I was having in mind a version in which he realizes the contradiction. – radu_cloud Sep 6 '20 at 5:51
• However, if we start by saying the prisoner can make reasoning mistakes, the whole thing seems to turn towards a mind trick rather than a logic problem. Because the prisoner's reasoning is part of our reasoning (to determine his surprise) and more than this, the prisoner has the same data that we have - we can imagine any of us can be in his shoes. So if he has a shaky logic, we have a shaky logic, and we don't know where it shakes. Anyway, it's a good mind trick. – radu_cloud Sep 6 '20 at 12:44

There are numerous things which are unclear.

In my experience of discussions of the "unexpected hanging" paradox, there is a prevalent assumption that either the judge or the condemned man is wrong, but not both; the problem is presented as if the question is "which is wrong?". I think both are wrong.

In particular, I think the judge is wrong to claim that the condemned man will be surprised by the executioner knocking on his cell door at noon on the day of the execution. How does he know? Given the paradoxical evidence, what makes the judge so confident of how exactly the condemned man will resolve the paradox, if at all?

What constitutes evidence that the judge was wrong? By the wording of the question, if the executioner turns up but this does not surprise the condemned man, then that is evidence. So, suppose that on each weekday, just before noon, the condemned man says "Good morning, Mr. Executioner. I've been expecting you."? On each day when the executioner is not there, does that make the condemned man wrong? But on the day of the hanging, does that make the judge wrong?

In statements of the paradox that I have read, where someone narrates the story of what happens after the judge's decree, the narrator says that, one day, the executioner turns up, to the condemned man's surprise. The narrator then implies that the judge's decree is seen to be correct. This implication is invalid. That decree is tantamount to the general claim that, in every possible scenario, the executioner's arrival would surprise the condemned man. Even if the executioner's arrival turns out to surprise the condemned man in the real scenario, that is just one particular instance, & it does not prove the judge's general claim.

When the judge speaks to the condemned man, is the date of the execution set, & does the judge tell him this? If not, then the condemned man is wrong to argue "Suppose my execution is set for Friday. Then..." and similarly for the other days.

The paradox can be recast as the following game (it's easier to play & doesn't entail any inconvenient corpse-disposal). One player (the judge) takes 5 cards, one of which represents the hanging (for added realism, use a tarot pack & make one of them Le Pendu). As the previous paragraph suggests, there are actually two variants. In one, this player shuffles them; in the other, the player secretly looks at them. In each case he deals them face down in a row. Then, for each card in turn, he asks the other player (the condemned man) whether he wants to choose it. Then the judge turns that card face up.

• If it's the "hanging" card, then if the condemned man chose it, he wins (for proving that the judge was wrong to say that the hanging would surprise him) but if not, the judge wins.
• Otherwise, if the condemned man chose it, he loses for having made a wrong choice, but if not, the judge proceeds to the next card, if any.

What's the probability of the condemned man winning?

I make it 1/5 in both variants. Judge and condemned man were both a bit wrong, but the judge was less wrong than the condemned man.

The key to this paradox is an ambiguous meaning of the terms "KNOW" and "SURPRISE".

Judge and prisoner give this these terms completely different meaning, and it's the judge who actually decides when to execute the prisoner, so his terms win. The fact that prisoner came to wrong conclusions, comes from his initial misunderstanding of what judge meant by "SURPRISE", and "will not KNOW"; and the judge didn't bother to clarify himself.

Life is not a logical circuit. You can use all logic in the world to calculate when the money SHOULD be in the bank, but after all your correct calculations it still may not be there. Something can still happen that obliterates your logical calculations. In other words, logical calculations in real life never cover the full decision model, and therefore, never can predict with 100% probability what would happen. You can only KNOW that the money is in the bank, when you are INFORMED about that fact.

The judge said: "He will not know the day of the hanging until the executioner knocks on his cell door at noon that day". The judge meant: "He will not be INFORMED, and therefore, will not KNOW the day of the hanging until the executioner knocks on his cell door at noon that day." The prisoner understood it his way - "He will not be able to KNOW (to create the knowledge) by logical reasoning".

Now let's define the word "SURPRISE". If the prisoner is told by judge that he will be executed next Tuesday, then the execution will not come as a surprise. But - if the prisoner is INFORMED the same day when execution happens, that is a surprise. Period. That's a judge's definition of "SURPRISE". You can be smart, make correct logical conclusions and thus create a knowledge about what's gonna happen in the future, and therefore think that it's not going to be a surprise for you - nobody cares. It's your speculations, nothing else. You can never be absolutely sure with your logic. You can KNOW for sure only when the judge informs you.

So, of course, the execution can happen on Friday, and it will be a surprise, in judge's view, because the prisoner is informed about the execution on Friday noon. Will it really be a surprise for the prisoner, in a "normal" meaning of the term "SURPRISE" - depends on prisoner's perception, imagination, mood, and other rubbish, and it doesn't really matter.

What matters is - do we agree with judge's definition of "SURPRISE"? If not then we must admit that there is a logical contradiction in his words, so his condition cannot be realized. But, given the context, I would agree with the judge.

The paradox is false because there can be no surprise. The moment the judge announces that the execution could be any day of the coming week at noon, he has already removed any chance of surprise. Each day, the prisoner will anticipate his demise more strongly as noon approaches and focus his entire attention on the prison door, listening for the fateful knock. If the executioner doesn't knock, he will be relieved. If the executioner does knock, he will be disappointed and fearful. But he won't be surprised because he was already attentive to it happening.

The paradox also sets up a false frame of human behaviour. The prisoner may play guessing games in the current week. But in the week of the execution, he will be too busy watching the prison door to see what actually happens. And that watching removes all possibility of surprise.

My explanation is that the prison did not consider the whole possible state space. The whole hanging day space is the deterministic days, which have five choices, plus undetermined days, which has 2^5-5-1 = 19 choices. An example of undetermined days is the combination of Tuesday, Wednesday and Friday, which means that the prison will be hanged in one of the three days. What the judge told was one of the 19 choices, not the 5 choices the prison assumed.

So here comes a new concept: undetermined states are also states. This is much like the quantum qubits. A qubit has state 0, state 1, and also the third state <0|1> when the qubit is not probed.

Here is another metaphor: the world of numbers is not made solely by real numbers, but also by complex numbers. It’s the same that we do not assert the whole space of states is made solely by deterministic states.

The prisoner's logic is flawed. He did his analysis based on only 5 possibilities (Monday to Friday). And then he concluded that the result is a 6th possibility (No hanging). This contradicts his initial assumptions.

If the prisoner were to repeat his analysis with 6 possibilities, then he will get a different answer.

• Hello, welcome to Puzzling Stack Exchange! Can you please add some explanation of why you think this? That would vastly improve this answer. Answers without explanations may be deleted. Please also note that the custom here is to spoiler answers using spoiler markdown; place >! in front of a paragraph to hide it and require a rollover to be able to see it. :) – Mithical Oct 21 '17 at 18:22