The first mention: a two-page note
D. J. O'Connor printed the paradox in the journal Mind in a note called "Pragmatic Paradoxes", on pages 358–359. Dozens of papers have followed.
On Friday the teacher says: "There will be a test next week, on one of the five days, and that morning you won't be able to know it's today." The student reasons: not Friday, because on Thursday evening I would already know; so not Thursday either; and so on back to Monday. So there can be no such test. Is he right? Give your answer, then play as the teacher or as the student.
She can. The student believed his proof so firmly that he expected nothing, and the test on Wednesday took him by surprise. His chain holds only at the first link: Friday really is ruled out. After that he keeps leaning on a promise that he himself declares impossible. And if the teacher draws lots over Monday to Thursday, even a student who knows her method and may say "today!" one morning guesses right only one week in four.
This paradox has been around since the 1940s. It is most often told about a prisoner whom the judge promises to hang on "an unexpected day", but the substance is the same, so we will take the gentler school version.
On Friday the teacher tells the class: "Next week, Monday to Friday, there will be one test. And it will be a surprise: on the morning of that day you won't be able to know that it's today."
The student reasons: if there has been no test up to and including Thursday, then on Thursday evening I will know it's on Friday. Then it won't be a surprise. So Friday is out.
Now the last possible day is Thursday. If there has been no test by Wednesday, then on Wednesday evening I will know it's on Thursday. So Thursday is out too. The same goes for Wednesday, Tuesday and Monday.
No day will do, so there can be no surprise test. The student goes off for the weekend untroubled. Who is right: the teacher who made the promise, or the student who "proved" it can't be kept?
"Every step is flawless"
The first step looks iron-clad, and each next one repeats the one before. Try to find where exactly the chain could break, or convince yourself that it doesn't.
The chain really is convincing, which is why the paradox has been argued over for more than 75 years. But already the second step relies on believing a promise that the whole chain "refutes". A student who concludes "there will be no test" becomes the easiest target.
That is, can she set the test so that on the morning of that day the student really doesn't know it's today? Pick an answer before reading on.
Your answer counts as soon as you click. You can change your mind, but the first choice goes into the stats.
The answer, and where the student's chain holds and where it doesn't, will appear here.
Hard to decide? Open the hints one at a time: the easy one first, then stronger ones.
Start with the student's first step: why is Friday really ruled out? What exactly does he know on Thursday evening if there has been no test yet?
Now the second step. On Wednesday evening the student says: "Thursday and Friday are left, Friday is out, so it's Thursday." Which promise is he relying on here, and does he still believe it at the end of his argument?
Imagine the student fully believes his own conclusion. What will he expect on Monday, Tuesday or Wednesday morning?
The next rounds show who is right: a game as the teacher and as the student, thousands of simulated weeks and the explanation. Answer in round 1 first, or go on?
You chose to always show all rounds.
Let's turn the announcement into a game. One morning of the week the student may say "the test is today!". If he is right, the test is no surprise. If he is wrong, he can't guess again. And if there has been no test by Friday, on Friday morning he knows anyway. A surprise is a test on a morning when the student didn't say "today", and not on Friday. Play as the teacher against a student program, then the other way round.
Set the teacher's habit: how often she puts the test on each day. The computer lives through 10,000 weeks with two students. The smart student has learned this habit and every week says "today!" on the likeliest day from Monday to Thursday. The convinced student believed his own proof and doesn't expect a test at all.
The height of a bar is the share of weeks with the test on that day; the filled part is the weeks when the student was surprised. Left bars are the smart student, right bars the convinced one. Every day but Friday surprises the convinced student. The smart student is not surprised on Friday or on the day he bets on, so the teacher does best to spread the test evenly over Monday to Thursday: then whichever day he picks, he is right in only a quarter of the weeks.
Once you answer, the simulation code appears here so you can run it yourself.
The same simulation, short and with no libraries. Run the JavaScript in your browser console (F12) or in Node; the Python needs only the standard library.
// The surprise test: 100,000 weeks. The student may say "today!" one morning
const N = 100000, DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'];
const pick = w => { let r = Math.random() * w.reduce((s, x) => s + x, 0); return w.findIndex(x => (r -= x) < 0); };
function weeks(teacher, call) { // call(): the day the student calls, or -1
let surprise = 0;
const byDay = DAYS.map(() => [0, 0]); // [tests, surprises] per day
for (let i = 0; i < N; i++) {
const t = pick(teacher), c = call();
const s = t !== c && t !== 4; // a surprise: not called and not Friday
byDay[t][0]++; if (s) { byDay[t][1]++; surprise++; }
}
return { rate: surprise / N, byDay };
}
const even4 = [1, 1, 1, 1, 0], even5 = [1, 1, 1, 1, 1];
const r1 = weeks(even4, () => Math.floor(Math.random() * 4));
console.log('Teacher: lot over Mon–Thu; student: lot over Mon–Thu', (100 * r1.rate).toFixed(1) + '%', 'exact 75%');
const r2 = weeks(even4, () => 0);
console.log('Same, the student always calls Monday', (100 * r2.rate).toFixed(1) + '%', 'exact 75%');
const r3 = weeks(even5, () => 0);
console.log('Teacher: lot over Mon–Fri; student calls Monday', (100 * r3.rate).toFixed(1) + '%', 'exact 60%');
const r4 = weeks(even5, () => -1);
console.log('Lot over Mon–Fri, the student believes there is no test', (100 * r4.rate).toFixed(1) + '%', 'exact 80%');
console.log('Share of surprises per day (last line):',
r4.byDay.map(([n, s], d) => DAYS[d] + ' ' + (n ? (100 * s / n).toFixed(0) : 0) + '%').join(' '));
# The surprise test: 100,000 weeks. The student may say "today!" one morning
import random
N = 100_000
DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri"]
def weeks(teacher, call): # call(): the day the student calls, or -1
surprise = 0
by_day = [[0, 0] for _ in DAYS] # [tests, surprises] per day
for _ in range(N):
t = random.choices(range(5), weights=teacher)[0]
c = call()
s = t != c and t != 4 # a surprise: not called and not Friday
by_day[t][0] += 1
if s:
by_day[t][1] += 1
surprise += 1
return surprise / N, by_day
even4, even5 = [1, 1, 1, 1, 0], [1, 1, 1, 1, 1]
r1, _ = weeks(even4, lambda: random.randrange(4))
print("Teacher: lot over Mon–Thu; student: lot over Mon–Thu", f"{r1:.1%}", "exact 75%")
r2, _ = weeks(even4, lambda: 0)
print("Same, the student always calls Monday", f"{r2:.1%}", "exact 75%")
r3, _ = weeks(even5, lambda: 0)
print("Teacher: lot over Mon–Fri; student calls Monday", f"{r3:.1%}", "exact 60%")
r4, by_day = weeks(even5, lambda: -1)
print("Lot over Mon–Fri, the student believes there is no test", f"{r4:.1%}", "exact 80%")
print("Share of surprises per day (last line):",
" ".join(f"{DAYS[d]} {100 * s / n if n else 0:.0f}%" for d, (n, s) in enumerate(by_day)))
About a hundred papers have been written on this paradox, and philosophers still argue over the best way to state the resolution. But the main point can be seen without any formulas: the student's first step is right, and the second already isn't.
“In plain words” is hidden on all puzzles.
The student can't both believe the promise, to cross out days, and disbelieve it, to draw his conclusion. That is the short version. Why philosophers needed so many papers is in the "Deeper" layer.
On Thursday evening the student knows the test is on Friday, because there are simply no other days left in the week. No belief is needed.
On Wednesday evening two days are left. Only the teacher's promise says Friday "won't do". So the student doesn't know "it's Thursday"; he derives it from trusting the teacher. If she does set the test on Thursday, a student who trusted her guesses it. A student who lost that trust by his own chain does not.
The student finished his proof with "there will be no surprise test" and went off for the weekend at ease. That is the worst thing he could have done. Whoever expects nothing is surprised by anything.
The teacher doesn't even have to be clever: any day except Friday will do. And if the student is smarter and bets on some day every week, rounds 2 and 3 show that drawing lots over Monday to Thursday still leaves him only one chance in four.
“Rigorous” is hidden on all puzzles.
| Test ↓ · student says "today" → | Mon | Tue | Wed | Thu | Fri |
|---|
"S" marks a surprise, "·" means the student knew. In each column from Monday to Thursday there is exactly one "·" among the first four rows: whatever day the student bets on, he catches only a test on that very day. The Friday row is all dots: there the student always knows.
The teacher. Puts the test on Monday, Tuesday, Wednesday or Thursday, each with probability 1/4, and never on Friday. Whatever day the student bets on, he is right with probability 1/4, so the test is a surprise with probability 3/4. The teacher can't do better.
The student. Draws his own lot over Monday to Thursday. Then whatever day the teacher picks, the student knows it with probability at least 1/4, and Friday he always knows. So the teacher can't force a surprise more often than 3 in 4 either.
The two guarantees meet, so 3/4 is the value of the game. The student's "never" is not the value of the game but its worst case for the teacher, which she simply needn't choose. The only day she rules out is Friday.
Say the week has n days and the student may say "today!" on k mornings. The teacher never takes the last day. If she draws lots over the first n − 1 days and the student bets on k different ones of them, he is right with probability k/(n − 1). The value of the game:
For five days and one guess:
Why doesn't it help the student that he sees each day whether there has been a test? The only news during the week is "not yet", and it tells him nothing in advance: the plan "I'll say it on Wednesday if nothing has happened by then" is simply a bet on Wednesday. So any strategy of the student boils down to choosing k days. We checked this formula by exact enumeration for n from 2 to 8 and by a simulation of 100,000 weeks.
“Deeper” is hidden on all puzzles.
The paradox was first printed by the British philosopher D. J. O'Connor in 1948 in the journal Mind, in a note called "Pragmatic Paradoxes". The mathematician Timothy Chow names Lennart Ekbom's "surprise drill" as the earliest known version. In 1951 Michael Scriven described the paradox in its modern form, also in Mind, and in 1953 Willard Quine replied with "On a so-called paradox".
Martin Gardner made the version with a prisoner whom the judge promises to hang on an unexpected day widely known: a Scientific American column in March 1963, then in 1969 the book "The Unexpected Hanging and Other Mathematical Diversions". In 1998, writing in the American Mathematical Monthly, Chow counted nearly a hundred publications on the paradox.
Quine went further than our account. In his view the student can't know even on Thursday evening that the test is on Friday. Honestly he has two possibilities left: either the test is tomorrow, or the teacher was mistaken or lied. While the second stays open, the student only believes, he doesn't know.
In our game we counted Friday as "the student knows" to keep the rules simple. Quine, though, says the teacher's promise could come true even on Friday. Chow sums it up: the dispute is not about the arithmetic of days but about what "knowing" the future means, and there is still no agreement on the best way to put it.
An ordinary promise says something about the world: "the test is on Wednesday". This one says what the student will know after hearing this very promise. So whether it is true depends on whether the student believes it, and the belief depends on whether it is true. "This sentence is false" is built the same way.
In 1960 the logicians David Kaplan and Richard Montague, in "A paradox regained", reduced the unexpected hanging to the pure logic of knowledge and got the "knower paradox", a relative of Gödel's theorem. Raymond Smullyan, in "Forever Undecided" (1987), leads the reader from puzzles to Gödel's theorem and discusses the surprise exam along the way. In the spirit of his knights and knaves: a knight says "you will never be able to prove that I am a knight". If he really is a knight, you hold a true statement that you can't prove.
Our game from round 2 is the paradox translated into the language of game theory. Chow noticed that the student's reasoning resembles backward induction in the repeated prisoner's dilemma, and in 1998 the philosopher Elliott Sober published a paper in Synthese with the telling title "To give a surprise exam, use game theory".
The language of games resolves the paradox like this: the question "can the test be a surprise for certain?" has the answer "no", since against any fixed day there is a student who bets on it. But the question "how often?" has the answer "3 in 4", and for that the teacher needs only to draw lots.
Change the number of days and the number of the student's guesses and see how often the teacher still surprises him. Then from the numbers to the idea of backward induction, which breaks down well beyond school, and to how real inspections stay unpredictable.
However long the week, the teacher gives up the last day without a fight: there the student knows. The other n − 1 days are split between the teacher's lot and the student's k bets, so the surprise comes with probability (n − 1 − k)/(n − 1).
With two days and one guess the student really is unbeatable: on the first day he says "today", and the second he knows anyway. Here the student's chain has only one link, and it is sound. Over a month of 20 school days one guess is right only 1 time in 19.
The student reasoned from the end: first the last day, then the one before, and so on back to the start. This is backward induction, game theory's main tool for games that have an end. Sometimes it works flawlessly: that is how the pirates and the gold is solved, and how the people of the blue-eyed island reason night by night. There every step rests only on what everyone really knows.
But when each step requires believing that the other player will reason the same way all the way to the end, the chain turns as fragile as our student's.
The centipede game (Robert Rosenthal, 1981). Two players take turns deciding whether to grab the bigger share of a pile of money or pass, and the pile grows. Backward induction says the first player should grab at once. In Richard McKelvey and Thomas Palfrey's 1992 experiment hardly anyone did, so games went on longer and the pile grew.
The chain-store paradox (Reinhard Selten, 1978). A chain has stores in 20 towns, and in each town a rival decides whether to enter. Backward induction says the chain should never start a price war, since in the last town it no longer scares anyone, and so neither in the one before… Selten himself wrote that, playing as the chain, he would not follow this conclusion and would deter the rivals.
The finite prisoner's dilemma. If the players know how many rounds there will be, backward induction says defect from the very first. Yet in Axelrod's tournament the winner was a program that opened by cooperating. A similar gap between theory and people shows up in the traveler's dilemma.
Every inspection that is meant to be a surprise plays our game. Its rule is simple: in a schedule where some days become impossible after some events, the student (driver, offender, smuggler) works them out just as our student worked out Friday. That is why real inspections draw lots afresh every time.
| Situation | A predictable schedule | How surprise is kept |
|---|---|---|
| Drug and alcohol tests for US truck drivers | If a driver who had been tested could not be picked again that year, after the test he would know he was in the clear. | Rule 49 CFR 382.305: tests are unannounced, dates are spread through the year, and each time every driver has an equal chance of being picked, even one just tested. |
| Los Angeles airport (LAX) police | Checkpoints on the access roads and dog-patrol routes that repeat are easy to learn and avoid. | Since 2007 the ARMOR program, built at the University of Southern California, computes the schedule as a game and draws lots for where and when to stand. |
| Pop quizzes at school | "One quiz a week, never two days running": after a quiz, students know there won't be one tomorrow. | Our game: draw lots among all days except those students can work out for certain. The longer the stretch, the less one lucky guess is worth. |
Other puzzles where the logic of an announcement about knowledge gives a surprising result: the blue-eyed islanders and the prisoners in hats. And on how a player can be predictable however hard they try: Newcomb's paradox.
D. J. O'Connor printed the paradox in the journal Mind in a note called "Pragmatic Paradoxes", on pages 358–359. Dozens of papers have followed.
Martin Gardner told the story of the unexpected hanging in his March 1963 column, and in 1969 named a whole collection after it: "The Unexpected Hanging and Other Mathematical Diversions".
In 1998 Timothy Chow counted nearly a hundred publications on the paradox and noted there was still no agreement on the best resolution. For a puzzle about five days.
The teacher can openly tell the class: "I draw lots over Monday to Thursday". The students will know her method completely, and still in 3 weeks out of 4 the test will be a surprise.
If the test is a "surprise" on one of two days and the student may say "today" once, he is unbeatable: he says "today" on the first day and knows the second anyway. The paradox starts at three days.
Since 2007 the police at Los Angeles airport have placed checkpoints and dog patrols on a schedule computed by the ARMOR program, so that they can't be predicted.
Share your own explanation, an objection or a variant of the puzzle. You need a GitHub account to comment.
Is “School maths” the right level for this puzzle?
Thank you! This helps set the levels right.
I keep adding new puzzles, new ways to explain them and write-ups of the discussions they start. Leave your email and I'll write when something new is out. No spam, one-click unsubscribe.
The sign-up form will appear here soon.