I just remembered about a problem/paradox I read years ago in the fun section of the newspaper, which has had me wondering often times. The problem is as follows:

A maths teacher says to the class that during the year he'll give a surprise exam, so the students need be prepared the entire year. One student starts thinking though:

  1. The teacher can't wait until the last day of school, because then the exam won't be unexpected. So it can't be the last day.
  2. Since we've removed the last day from the list of possible days, the same logic applies to the day before the last day.
  3. By applying 1) and 2) we remove all the days from the list of possible days.
  4. So, it turns out that the teacher can't give a surprise exam at all.

Following this logic, our student doesn't prepare for this test and is promptly flunked when the teacher does give it somewhere during the middle of the year (but that's my own creative addition to the problem).

This problem reminds me about the prisoner's dilemma for finite number of turns - you have to betray at the last turn because tit-for-tat retaliation is no longer relevant (no next turn), but then that means that you have to betray at the turn before that, and so on, until you reach the conclusion that you can't cooperate at all.

So is the student's reasoning correct or not? Mathematically it looks like it should be, but that would imply that surprise exams are not possible (and they are).

  • 24,108
  • 6
  • 38
  • 74
  • 1,329
  • 2
  • 12
  • 15
  • 30
    A.k.a. unexpected hanging paradox: http://en.wikipedia.org/wiki/Unexpected_hanging_paradox \\ A simple solution would be that semester will be infinitely long. I like this solution, because I always have problems to cover in the lectures all topics I am supposed to/I want to. – Martin Sleziak Jan 08 '12 at 09:38
  • 20
    The teacher lies. –  Jan 08 '12 at 09:50
  • 1
    The only problem here seems to be the word 'surprise'. If the teacher only said that during the semester he'll give an exam, this paradox wouldn't arise, would it? So how surpising is an announced 'surprise exam'? – Sam Jan 08 '12 at 13:05
  • 1
    Indeed the teacher lies, if he means that he will give an exam and that he is certain the exam will come as a surprise. If instead he means that he will give an exam that **may or may not** come as a surprise, then the problem is resolved. – Joe Jan 08 '12 at 15:00
  • But in fact the teacher doesn't need to be lying, if he has 100 school days and intends to give the exam at say, the 37 day, it will be a surprise, no student would have known that the exam would be at that day. His promise that it'll be a surprise only means he can't use the last few days. – sashoalm Jan 08 '12 at 15:04
  • I disagree with you, @satuon. Even if the teacher intends to give the exam on the 37th day, he is still lying if he **promises** that the exam will be a surprise. He simply cannot make that promise to his students, and that is exactly what is proven by this "paradox". He can only promise that there will be an exam, and that it may or may not be a surprise. – Joe Jan 08 '12 at 15:34
  • 3
    The teacher does not lie. It is just impossible for the students to think what the teacher is saying to be true. The problem is that the students believing the teacher generates a self-referential paradox. So they can't believe the teacher and the teacher is free to surprise them. – Michael Greinecker Jan 08 '12 at 16:15
  • You could equally say that having the surprise test too early would defeat the purpose (motivating revision) - the students know it's over and done with from there on. Therefore, the teacher has good reason to delay the test as much as possible. So the students might reasonably assume the test *will* happen in the last few weeks or even days, no matter how unsurprising. –  Jan 08 '12 at 16:58
  • 8
    As Martin Sleziak's comment above shows, this question has received significant attention. Let me say though that I believe that this problem belongs to the subject of **philosophy**, not mathematics. A clue that a problem is philosophical is that many qualified people have written about it coming to different conclusions, and it is not clear that these various takes on the problem can be reconciled into a single solution that we can all agree on.... – Pete L. Clark Jan 08 '12 at 20:41
  • 5
    By this I do not mean that the problem cannot be analyzed mathematically -- Michael Greinecker's answer does just this. However, his final sentence explains quite well the issue here: one can propose a specific mathematical model for the problem and analyze that model...but this can be done in many different ways. I recommend that the question be migrated to (or at least reposted on) philosophy.stackexchange.com. – Pete L. Clark Jan 08 '12 at 20:43
  • if nothing else, this (i.e., all versions of the "surprise hanging" paradox) can be considered an object lesson in the fact that just because something rolls off the tongue nicely doesn't mean that it actually makes sense. The classic short example of this is, "He jumped on his horse and rode off in all directions." – Hexagon Tiling Jan 08 '12 at 21:23
  • 2
    An exam on the last day would probably be a surprise to the students on the day the claim was made that the surprise exam would not be much of a 'surprise' after all... which would mean that it would be surprising. – Mateen Ulhaq Jan 10 '12 at 07:55

10 Answers10


There is a model of knowledge, essentially due to Robert Aumann, in which knowledge is represented by a partition $\Pi$ of a set of states of the world $\Omega$. If the true state of the world is $\omega$, the agent with partition $\Pi$ only knows that some state in the cell $\pi(\omega)$ (the value of the projection at $\omega$) obtained. An event is simply a subset of $\Omega$. We say that an agent knows that the event $E$ obtains at $\omega$ if $\pi(\omega)\subseteq E$. Now let the state space be $\Omega=\{1,2,\ldots,T\}$, where we interpret $t$ as "there is an exam at $t$". Now there is no partition $\Pi$ such that the following holds:

  1. The student doesn't know exactly at which date the exam is at any state.
  2. If there was no exam at $\{1,\ldots,t-1\}$, then the student knows this at $t$.

Proof: Let $t$ be an element in $\Omega$ such that $\pi(t)$ is not a singleton. Such an element must exist by 1. Let $t'$ be the largest element in $\pi(t)$. By assumption $t'>t$ and so by 2., $\{1,\ldots,t'-1\}$ is a union of cells in $\Pi$ that contains $t$. Since $\Pi$ is a partition, $\pi(t)\subseteq\{1,\ldots,t'-1\}$, contradicting $t'\in\pi(t)$.

So at least using the model of knowledge used above, the surprise exam paradox cannot be formulated coherently.

Michael Greinecker
  • 29,902
  • 5
  • 71
  • 127
  • 1
    I don't quite understand why the knowledge gets represented as a partition of the states of the world. Isn't it possible that in one situation we know the world is in state A or B and in another we know it is in A or C? – Casebash Aug 31 '14 at 04:45
  • Yes, but that is compatible with the model. – Michael Greinecker Aug 31 '14 at 08:39
  • I saw this question and answer after a long time it's been posted. I got the question, however, I didn't understand a word, say my math knowledge wasn't enough. What should I do/learn/read/study to understand this? – Motun Jan 09 '16 at 17:25
  • It is not specified how $\Pi$ relates to $\pi$. Do projection $\pi$ and partition $\Pi$ define each other? – Hans Jul 09 '21 at 15:54
  • @Hans Yes, this is a general property of partitions. – Michael Greinecker Jul 09 '21 at 18:25

A very nice discussion of the unexpected hanging paradox can be found in chapter 43 of Martin Gardner's The Colossal Book of Mathematics (New York: W. W. Norton & Company, 2001). Numerous references are included.

Gardner, citing O'Beirne, states that "the key to resolving the paradox lies in recognizing that a statement about a future event can be known to be a true prediction by one person but not known to be true by another until after the event."

The teacher giving the surprise exam "knows that his prediction is sound. But the prediction cannot be used to support a chain of arguments that results eventually in discrediting the prediction itself. It is this roundabout self-reference that [...] tosses the monkey wrench into all attempts to prove the prediction unsound."

See also "The surprise examination or unexpected hanging paradox." Timothy Y. Chow. Amer. Math. Monthly 105 (1998) 41-51, a pdf version of which is here.

Joel Reyes Noche
  • 6,307
  • 3
  • 36
  • 61
  • "a statement about a future event can be known to be a true prediction by one person but not known to be true by another until after the event." That's only true if two people have different knowledge, which isn't the case for this problem. As the pdf you linked points out, in any reasonable logical formulation of the problem, the statement is simply self-contradictory. – Jeremy Salwen Jan 09 '12 at 09:24
  • 1
    @Jeremy, you say that for this problem two people don't have different knowledge. But doesn't the teacher know in advance (say, before even making his announcement) when the surprise exam would be given, something the student doesn't know at the start? – Joel Reyes Noche Jan 10 '12 at 07:34
  • Ah, I misinterpreted the "two people". I thought it was referring to 1. You, the problem solver, and 2. The student. – Jeremy Salwen Jan 10 '12 at 07:58

All depends on the definition of "surprise exam."

If the teacher states that an exam will definitely be given such that on any morning of the term through the last day students could never know with certainty an exam was scheduled that day, the teacher has spoken falsely, since, if an exam hadn't been given by the penultimate day students would know with certainty the exam was on the last day.

If, though, the teacher states that an unannounced exam will definitely be given at some point in the term, it seems fair to call that a "surprise exam", since only the final day of the class could be predicted with certainty to have an exam if all the others hadn't. And even then, the certainty of the exam would only be known for 24 hrs (not much time to study an entire term's worth of material). All other days would have significant uncertainty. The teacher's strategy to keep students on their toes would work.

So, the paradox of your question comes when you say, "Mathematically it looks like it should be, but that would imply that surprise exams are not possible (and they are)." Surprise exams of the first type are not possible. Surprise exams of the second type are. When you clarify the definitions, there is no paradox.

  • 645
  • 4
  • 11
  • 4
    I think this is pretty much the correct (and very simple) resolution of the paradox. This doesn't rely on any fancy mathematics or philosophy at all in my opinion. – Zach Conn Jan 10 '12 at 03:15
  • 1
    IMHO, even if it happens on the last day, it is still a surprise, it is just not a surprise on the last day. On the penultimate day there is still a 50/50 chance that it might not be on the last day, but at the end of the last day, surprise, the test will be on the last day. (The fact that it is a test, and now the students know with certainty that if they do not prepare tonight they will fail is besides the point.) It is a lot like other unknowns in life (the weather, your age at death), the degree of uncertainty shrinks with time. – Paul Jackson May 08 '12 at 23:37
  • Indeed, well explained the core of the confusion. In many cases that's all there needs to be done. – prime4567 Oct 09 '20 at 16:51

If the student is sufficiently bright to prove that a "surprise" exam is impossible then it would certainly be a surprise to the student, whenever the exam was set.

  • 111
  • 2

There are many ways of formalizing the paradox, in many different fields, and the article (by T. Chow) cited by Joel Reyes Noche, does a good review work.

However, one thing which has always bothered me, is that in most formalizations, the surprise exam can take place in the last day, as legitimately as in any other day. To my mind, this doesn't convey the intuitive meaning of "surprise".

A new approach, given by Ran Raz here, doesn't suffer from this fallacy. He follows the "standard" logic formalization - in which "surprise" means "the exact day cannot be proved in advance (using the statement), from the fact it hasn't occured yet", but adds the clause "or it can be proved that it falls on different days" (since, obviously, if opposing facts can be proved, it is hard to say that the students "know" anything). Now, the interesting thing is, that the exam can't occur on the last day, but the induction argument fails from the unprovability of the consistency of the logical system (a.k.a. "Godel's Second Incompleteness Theorem").

I find this approach interesting and refreshing.

  • 855
  • 6
  • 9
  • 2
    "or it can be proved that it falls on different days", seems a bit of a cop-out... that's equivalent to saying "A, or A is self-contradictory". I mean, I could apply the same argument to the teacher saying "you know this statement is false", and conclude that it is true. – Jeremy Salwen Jan 09 '12 at 09:36

The fallacy already starts with the first assumption:

  1. The teacher can't wait until the last day of school, because then the exam won't be unexpected. So it can't be the last day.

The student cannot know if there will be a test even if the teacher told him so. So it's still a surprise if it happens on the very last day. And since the teacher said it will be a surprise the student wouldn't even consider it to happen on that day.

Okay, I try to explain it more formaly. Of course I work with the assumption that the teacher is always telling the truth, the whole truth and nothing but the truth. Otherwise you wouldn't even know if the exam occurs at all. So you wouldn't be able to expect it.

The student uses the three assertions

  1. The exam occurs this year.
  2. If the exam occurs this year and there is only one possible day left, I can conclude that the exam occurs on that day.
  3. I cannot conclude the day ahead of time.

to remove all the days iteratively from the list of possible days.

Assertions 1 and 3 are from the teacher. So we assume that they must be true.

The student disproved assertion 1. So his proof is flawed. One of his assertions must be wrong.

Assertion 1 and 3 are true. So clearly assertion 2 must be wrong.

This means that the student is not able to conclude the day even if there is only one possible day left.

  • 195
  • 7
  • 6
    Well if you assume in advance the teacher could be lying you're not really talking about the situation described in the question. Try working with the assumption that the teacher **must** be telling the truth, and then you'll run into the "paradox"... – Joe Jan 09 '12 at 04:45
  • @Joe: If the student trusts the teacher then he knows that the exam will not happen on the last day. Therefore it will be quite a surprise. "You will be surprised" is a self-fulfilling statement for everyone believing in it. If the teacher didn't mention that it's a surprise then the student would know on the morning of the last day that there's an exam. But now there are two indisputable but somehow contradictory statements: "There will be an exam today and it will surprise you." He will resolve this contradiction later that day. – Robert Jan 09 '12 at 08:51
  • @Robert: No, as a rational student, I would conclude that there would be an exam the following day. I would not be surprised when the exam occurred the next day. – Jeremy Salwen Jan 09 '12 at 09:04
  • @JeremySalwen: You conclude that (a) "there is an exam tomorrow". You assume that (b) "if I know when the exam happens then it will not surprise me". You conclude that (a+b) "the exam will not surprise me". But this contradicts with the indisputable statement of the teacher "the exam will surprise you". So (a+b) has to be wrong and you start doubting your rationality. – Robert Jan 09 '12 at 09:56
  • @Robert: More precisely, I also don't start doubting my rationality, by ex falso quodlibet. Additional, I also disprove my assumption that the teacher's statement is true. And I also believe that I both am and am not the king of Nepal. I don't know a stronger sense of being an incorrect statement than the fact that belief in it forces a contradiction. – Jeremy Salwen Jan 09 '12 at 10:41
  • @JeremySalwen: Of course you're not forced to believe the teacher. But then it doesn't matter what he says. You couldn't even conclude that the exam is on the last day since you don't know if there will be an exam at all. But if the teacher always tells the truth and you blindly believe everything he says then there isn't a real contradiction. It would be just a contradiction from your point of view until the exam occurs. – Robert Jan 09 '12 at 11:04
  • @Robert: I think you're missing the point. It's not about what I believe. I believe everything is both true and false. Therefore, his statement that I will be surprised by the exam is false in the objective sense, because I will deduce that it occurs on the day it does, ahead of time. This is the definition of what it means to "not be a surprise". All my other deductions are irrelevant towards the truth of his statement, which solely concerns itself with my ability to make this deduction. – Jeremy Salwen Jan 09 '12 at 11:11
  • @JeremySalwen: Yes, probably I am missing something. The teacher said that the exam will be a surprise. But you deduce the day of it ahead of time? This means that you know the teacher is lying. You cannot trust him. You don't even know if there will be an exam at all. How can you be not surprised by an exam of which you didn't even know if it happens at all? – Robert Jan 10 '12 at 08:09

I believe that a complete explanation should delineate the exact senses in which this is surprising and in which we know certain propositions. Once this is done, then there will be nothing left to explain. One particular difficulty is that because surprise is used in an incoherent manner, we'll need a contradictory definition of surprise ("D-surprise") in order to model and explain the contradiction.

Let’s assume that the teacher intends to produce a set of days that would “D-surprise the student” in that there isn’t a set of deductive steps that the student can follow on the morning of the exam that would eliminate all other days as possibilities. If no days are in the set, then the warden won’t be able to set the exam and we won’t have a paradox. Let’s first say that the student is “A-surprised” if they can’t deduce on the morning of the exam that the exam is happening given only that it is happening one day that week. Clearly the student will be “A-surprised” if it happens on any day other than Friday. We will say that the student is "B-surprised” if they can’t deduce that the exam is happening on the morning of the exam given the the exam will happen that week and that the teacher will pick a date where the student is A-surprised. Clearly the student is B-surprised if the exam happens before Thursday.

What are the deductive steps that the student can follow. There are only two D-steps:

  • Time rule: On a day D, all previous days can be eliminated as possibilities for the exam date
  • Surprise rule: If day D is the only possible exam date on day D, then it can be eliminated as a possibility

We can generate all days that would be validate exam dates by applying algorithm X as follows: First the teacher eliminates a day from the set if the student would be A-surprised. Then the teacher looks at the new set of days and sees if the student would be A-surprised on any day in the new set, repeating until no points are eliminated. It can be seen that this process will terminate and that the set produced will be precisely those that D-surprise the student.

But, as we know, this set will come up empty - there is no day that can’t be eliminated by the student’s logic. Define A-knowing, B-knowing and D-knowing as not being A-surprised, B-surprised and D-surprised.

Let's talk about knowledge first:

  • If the exam is held on a Friday the student will be A-knowing.
  • If the exam is held on a Thursday, then the student is B-knowing.
  • On any day the student is almost D-knowing in the sense that D would allow them to eliminate all the other future days and so we could conclude that it was today if this were not incoherent.

Now let's talk about surprise:

  • If the exam is held on Friday, then the student will not be surprised
  • If the exam is held on Thursday, then the student will be A-surprised
  • If the exam is held on a Wednesday, then the student will be A-surprised and B-surprised
  • On any day, they will be almost D-surprised in the sense that they are not D-knowing (we can't create a situation where they won't be surprised in whatever sense they already are by adding the D rules because this would make the situation incoherent)

Regarding, the real life example, if it happens on a Thursday and the student complains that they aren't surprised, the teacher can say that they A-surprised them and that they never specified the kind of surprise. If it happens on a Wednesday, then the teacher can say they B-surprised them, which seems closer to the true intent as the student can't conclude the exam is happening that day even if they 100% believe that the teacher is going to at least A-surprise them.

One final point. Suppose we tell a student that they will be A-surprised. Then they will 100% know that it is not Friday. If the test happens on a Thursday, then they will experience B-knowing. This will be the last possible day, so we can see that this is actually "pretty close" to A-knowing, even though it doesn't meet the definition.

  • 8,703
  • 7
  • 50
  • 79

Simple solution:
Suppose that you claim and give arguments and convince yourself that some day let's say $X$, it is impossible for the test to be unpredicted.
Then the teacher gets in the class on day $X$ and say's "today is the day to write the test" and this is something you did not expect(since you are sure for the opposite),so it is unpredicted.

Konstantinos Gaitanas
  • 8,745
  • 4
  • 26
  • 42

I think this is a hidden-information problem. The problem is that there is no algorithm for setting the date of the exam (which can include probabilistic choices), which the student can know, which doesn't lead to no surprise in some timelines.

For example, let's say the lecturer decides "there is a 50/50 chance the exam is on the 3rd or 4th day". If the student doesn't know this, they will be surprised when the exam arrives. However, if the student does know this, then there is a 50/50 chance they will not be surprised on the 4th day.


I agree that all depends on the definition of "surprise exam". If exam isn't a surprise, there is nothing saying that the exam won't be given. So the student should/could conclude (but this isn't necessarily the right thing to do) that the exam won't be a surprise instead.

I was thinking of this problem in terms of probabilities. For example the exam isn't a surprise if the student thinks it will be given at day N and the exam is actually given at day N.

For example the time frame is 1 day only: so the exam will be given today, the student knows about this and there is no surprise, 1 possible options, 0 for surprise P = 0/1 = 0.

The time frame is 2 days only, then:

Day 1: exam at d1 - the student thought d1 => no surprise
       exam at d1 - the student thought d2 => surprise
       no exam at d1 (move to Day 2)
Day 2: exam at d1 => no surprise, everything is in past
       exam at d2 => no surprise

P = 1/4

The time frame is N days, then:

Day 1:   exam at d1 - thought d1 => no surprise
         exam at d1 - thought d2 => surprise
         exam at d1 - thought dN => surprise
         no exam at d1 (move to Day 2)
Day 2:   exam at d1 => no surprise
         exam at d2 - thought d2 => no surprise
         exam at d2 - thought d3 => surprise
         exam at d2 - thought dN => surprise
         no exam at d2 (move to Day 3)
Day 3:   exam at d1 => no surprise
         exam at d2 => no surprise
         exam at d3 - thought d3 => no surprise
         exam at d3 - thought dN => surprise
         no exam at d3 (move to Day 4)
Day N-1: exam at d1 => no surprise
         exam at d2 => no surprise
         exam at d3 => no surprise
         exam at dN-2 => no surprise
         exam at dN-1 - thought dN-1 => no surprise
         exam at dN-1 - thought dN => surprise
         no exam at dN-1 (move to Day N)
Day N:   exam at d1 => no surprise
         exam at d2 => no surprise
         exam at d3 => no surprise
         exam at dN-1 => no surprise
         exam at dN - thought dN => no surprise

$P = \sum_{i=1}^{N-1} \frac{i}{N^{2}} = \frac{\frac{N\cdot (N-1)}{2}}{N^{2}} = \frac{N-1}{2\cdot N}$

  • 16,178
  • 4
  • 23
  • 43