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? Commented Sep 22, 2014 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
Commented Sep 23, 2014 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. Commented Sep 23, 2014 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
Commented Sep 23, 2014 at 7:50
• @GentlePurpleRain it's perfectly valid to do an inductive proof to work backwards from some point. Had the prisoner been correct, on Wednesday night there would have only been one option for execution because he already proved it couldn't be Friday. Commented Dec 3, 2023 at 5:50

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. Commented Sep 22, 2014 at 14:39
• Can these questions not be answered by using the fallacy in the paradox?
– Neil
Commented Sep 22, 2014 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. Commented Sep 22, 2014 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." Commented Sep 22, 2014 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. Commented Sep 22, 2014 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. Commented Sep 6, 2020 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. Commented Sep 6, 2020 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. Commented Sep 6, 2020 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 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.

This paradox is architected very cleverly, and the whole root of the problem is misinterpretation by the prisoner of what the judge said.

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.

The prisoner misinterprets the term "SURPRISE" in the way that allows him to develop a logical reasoning that leads to the paradox.

It is obvious from the judge's statement that by "SURPRISE" he meant "be informed on the same day". Not the previous day, not a week before, but right before the execution, the same day. Very common and straightforward usage of the term "SURPRISE", isn't it?

"SURPRISE" = "WARNING ON THE SAME DAY" - that's the judge's definition of surprise, and nothing else. So it has nothing to do with what the actual feelings of the prisoner are - whether he feels surprised - the latter depends on prisoner's expectations.

When there is a "pop quiz" or "surprise quiz" in the university, it is called "surprise quiz" because you are warned right before the quiz. And it doesn't matter if you weren't actually surprised (you kinda expected the quiz happening any day soon) - it is a "SURPRISE" by definition: "WARNING ON THE SAME DAY". Absolutely the same thing here.

The prisoner, however, used his own definition of "SURPRISE" - "UNEXPECTED TO HAPPEN", and that's where his mistake is. By using incorrect definition of the term "SURPRISE" (not the one the judge meant), he was able to develop his logical reasoning, which has lead to wrong expectations, and hence, to a real SURPRISE, in his own definition ("UNEXPECTED TO HAPPEN")!

It is clear from the judge's definition of "SURPRISE" that the prisoner cannot create any logical reasoning whatsoever, because even Friday is a legal day. The prisoner has absolutely zero knowledge which would allow him to speculate about the day of execution - this is being decided by the judge, based on reasons the prisoner doesn't have a clue about.

It follows from the above that in this situation "TO KNOW" = "TO BE INFORMED". The prisoner can get knowledge about the day of execution only when he is informed about it. (We can notice that the judge's definition of "TO KNOW" becomes: "TO BE INFORMED", but that follows from the definition of "SURPRISE", so we don't have to require such definition separately.)

Thus, we can refine judge's words with:

He will not BE INFORMED the day of the hanging until the executioner knocks on his cell door at noon that day.

The judge is the one who decides, so we have to adhere to his definition of the term "SURPRISE". The prisoner didn't adhere to it, misinterpreted it, hence came to wrong conclusions and got surprised about the execution. But the judge was absolutely correct.

• I mean, you might as well try to “resolve” the paradox by just saying that the judge was lying. Suppose that we accept the interpretation that the prisoner sealed on, and that the prisoner and the judge agree on it; doesn’t the paradox still exist then? Commented Jan 12 at 20:25
• @Sneftel - That's the whole thing - I am explaining the paradox without the judge lying! And to your question - if both prisoner and judge agree on the interpretation that the prisoner sealed on, then the judge would take his words back, because with these definitions of terms what the judge has promised leads to logical contradiction, leads exactly to justification of prisoner's logic. So the judge would withdraw his formulation. Commented Jan 12 at 22:15
• I think you might not fully understand the paradox. It does not hinge on the definitions of words. The judge says, essentially, “there will be no day on which you can prove that you will be executed that day”, and what do you know, he’s right about that. No need to denigrate the puzzle with loopholes. Commented Jan 12 at 22:19
• @Sneftel - well, I disagree with you, I think there is a difference between "Be informed" and "Create knowledge by logic", and that's the root cause of this paradox. Commented Jan 12 at 22:33
• @Sneftel - actually, just the different interpretation of the term "Surprise" is enough. If we agree that by "SURPRISE" the judge meant "be informed on the same day" - the rest just follows. I will refine my answer later today with that amendment, hopefully then you will like my answer better. Commented Jan 12 at 23:38

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.

This paradox exploits the ambiguity of the term "KNOWLEDGE".

• a. You KNOW something when you are INFORMED about it.

• b. You know something when you LOGICALLY CONCLUDE about it.

Rephrasing:

• a. KNOWLEDGE is given to you.

• b. KNOWLEDGE is being created by you with logical reasoning.

Life is not a logical circuit. You can use perfect logic to calculate when the money SHOULD be in the bank, and think that you know all the factors (think that your model is complete), but after all the money may still not be in the bank at that time. Universe can collapse at the last moment, right? Something extraordinary can still happen that obliterates your logical calculations.

Logical calculations in real life never cover the full decision model, and therefore, can never 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.

Therefore, I agree with Martin Gardner's words: "Logic doesn't have the power of predictability here."

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)".

It's the judge who rules and decides when to hang the prisoner (based on judge's mood, maybe, which is not predictable even for the judge himself). So we have to go with judge's definitions, but the prisoner made a mistake to use his own definition of "KNOW" - and thus created a wrong KNOWLEDGE in his mind.

He had to use the definition a. for KNOWLEDGE but he used definition b.

So the whole "paradoxality" is explained by prisoner's miscalculation based on wrong definition of KNOWLEDGE - he created wrong expectations in his mind and therefore any day would be a surprise for him.

The formulation of the story didn't say that the judge was a perfect logician and his words would be absolutely logically correct in all cases. Judge didn't say it! So the prisoner had to take judge's words in a regular life way - in a common sense way, not in a perfect logic way. It is common sense to say to your kid "if you don't behave you will be punished". But a kid cannot make any logical conclusions from it - he can only sense the strategy. So really smart prisoner would understand that Yes, technically the judge made a mistake - Friday cannot be a surprise; but it was not judge's purpose - to be logically impeccable - his purpose was just to say that the execution will be announced on the same day, in a surprise manner.

Therefore, the prisoner didn't have a right to draw any further conclusions from his understanding that Friday cannot be a surprise. Judge, of course, is logically wrong, but he never meant to be logically right!