A man is a quarter of the way through a railway tunnel when he hears a train coming up behind him. If he runs back, the train hits him just as he reaches the entrance; if he runs forward, it hits him just as he reaches the exit.
How fast is the train, compared to him?
Call the tunnel's length , with the near mouth and the far mouth . He stands from , so the film has . He runs at , the train runs at , and the train starts short of . Write for how many times faster the train is.
This is the film's first proof. Running back he covers while the train covers . Running forward he covers while the train covers . Both are dead heats, so the times agree:
Subtract the first from the second. The unknown , which nobody asked for, cancels:
With the left side is , so . Putting that back into the first equation gives , which is . The left side of the subtraction is the giveaway for the general case: it is zero at halfway and negative beyond, and is neither.
This is the film's second proof, and it needs no equations. Let him split in two, one copy running each way, at the same speed. The copy running back reaches at the same moment as the train. By then the other copy has run just as far, , so it is from , which in the film is the middle of the tunnel.
Now freeze that moment. The train is at with a whole tunnel, , to go. The forward copy has to go, half a tunnel in the film. They get to together, so in the same time the train covers and he covers :
The same freeze says why halfway is the limit. A man standing at the middle or beyond has a forward copy already out of the tunnel when the other copy reaches , and the train is only at . It cannot catch him.
Neither film proof draws time. Put distance along the line across and time up. Anything moving at a steady speed is a straight line, and the steeper the line, the slower it goes.
His two runs are two lines from his starting point: one ends at at time , the other at at time . A dead heat means the train is at that place at that time, so the train's line goes through both ends. Two points fix a line, so the two dead heats fix the train completely. It covers in the time between them,
and following its line back down to the start of the clock says where it was then, short of . The picture also shows halfway coming. As grows the two ends come level in time, so the train's line gets flatter and the train faster without limit. Past halfway the end at comes first, and the only line through both ends belongs to a train coming the other way, from beyond : the same puzzle seen in a mirror.
In the film's own units he runs a quarter of a tunnel a second and the train runs half, starting half a tunnel out. Both runs come out exact:
| Run | He runs | Time | Train runs | Time |
|---|---|---|---|---|
| back to A | 1/4 L | 1 s | 1/2 L | 1 s |
| forward to B | 3/4 L | 3 s | 3/2 L | 3 s |
Here are both runs drawn as above. The train's line starts half a tunnel to the left of and passes through the end of each of his:
The dashed line is the film's frozen frame from the second proof. At 1 second the back copy and the train reach together, and the forward copy is at 1/2, the middle. It has half a tunnel left and the train a whole one, and both take two more seconds.
The film fixes where he stands and asks about the train. Turn it round: keep the film's train, twice his speed, and ask where in the tunnel a man could stand, and how far out the train could be, for him to get away.
Running back he escapes if the train has further to go to than twice his own distance, . Running forward he escapes if , that is . Draw both lines:
The red triangle is where both runs fail. Read across at the film's distance, half a tunnel: there the triangle has narrowed to its tip, a single point a quarter of the way in. The film's man is standing on the only spot in the tunnel where he is caught both ways. Anywhere else, one of the two runs gets him out.
It also never matters, for him, which way he runs. His margin running back is , the train's time to less his, and his margin running forward is . Their difference is
which is zero exactly when , the dead-heat ratio. So a man standing at the dead-heat point has the same margin both ways, whatever the train's distance: both escapes by the same amount, or both caught. The film's last card, "either way, he only just makes it", is not a coincidence of the numbers.
Anywhere else one direction is strictly better, and the rule is simple. Short of the dead-heat point, run back; beyond it, run forward. With the film's train that point is a quarter of the way in, so a man three tenths of the way through, nearer the entrance than the exit, should still run for the exit.
The general formula gives a train for every standing point short of halfway, and the train has to be faster the closer he is to the middle:
| He stands at p | Train's speed ÷ his | Train starts this far out |
|---|---|---|
| 1/10 | 5/4 | 1/8 L |
| 1/6 | 3/2 | 1/4 L |
| 1/5 | 5/3 | 1/3 L |
| 1/4 | 2 | 1/2 L |
| 1/3 | 3 | L |
| 2/5 | 5 | 2 L |
| 9/20 | 10 | 9/2 L |
| 49/100 | 50 | 49/2 L |
| 1/2 | no train can | — |
| 3/5 | no train can | — |
Turn it round again: given a train times as fast as him, there is exactly one spot where both runs can be dead heats, and one distance for the train. Setting in the claim and solving,
| Speed ratio r | He must stand at p* | Train starts d* out |
|---|---|---|
| 3/2 | 1/6 | 1/4 L |
| 2 | 1/4 | 1/2 L |
| 3 | 1/3 | L |
| 4 | 3/8 | 3/2 L |
| 5 | 2/5 | 2 L |
| 10 | 9/20 | 9/2 L |
| 100 | 99/200 | 99/2 L |
However fast the train, the spot is short of halfway, and it creeps towards the middle as the train gets faster.
He stands past halfway. Then no train can produce two dead heats, as all three proofs show. At exactly halfway it would take an infinitely fast train. Beyond, the two dead heats describe a train coming from the other end.
The train is no faster than him. It never catches him running forward, wherever in the tunnel he stands and however close it is: it cannot gain on him. A slow train only matters to a man who runs back towards it.
The train comes from the far end. Swap and , and for . Everything above holds in the mirror.
He runs faster one way than the other. The copies stop working: they are not level when the back copy reaches , so the freeze proves nothing. The equations still do. With speed back and forward, subtracting still cancels , and
When the trick fails. Every proof here leans on the train keeping its speed. A train that speeds up as it comes still gives two dead heats, but the distance–time picture is no longer straight lines, and "how many times faster" no longer has a single answer.
Fix the train's speed, times his, and ask how far out it must be for a man to get away by running the right way, wherever he is standing. Running back needs the train more than out, and running forward needs more than , so the best he can do needs the smaller of the two. That is largest where the two are equal, which is the dead-heat point, and there it is .
So a train more than out cannot catch anyone who runs the right way. A train exactly out catches exactly one person, the one standing at . For a train twice his speed, is half a tunnel, which is where the film puts its train. The film chose the one distance at which the trap closes on a single point, and put the man on it.
None of this is left to the proofs. scripts/tunnel.mjs asserts every number on this page, in exact fractions, and the page is built from what it writes.
The film. It reads the film's speeds and distances from PUZZLE in brain-teaser/components/theme.ts, the constants every scene runs on, and checks both runs are dead heats, at 1 and 3 seconds, with the train exactly 2 times his speed and the forward copy at 1/2 at the freeze.
Every standing point. For every fraction with denominator up to 60, the 550 short of halfway each give exactly the train in the claim, and that train really does make both runs dead heats. The 551 at halfway or beyond give none, and those past halfway give the mirrored train instead.
Every speed. For 3,058 speed ratios, fractions with denominator up to 30, the dead-heat spot and distance come out as above and turn back into the same ratio.
The zones. The rules for escaping are checked against 400 random cases run by stepping time forward in small steps, with no formula at all. The film's doomed stretch is checked to be exactly the quarter mark. Equal margins at the dead-heat point are checked at 205 distances, and the rule for which way to run, and the claim that no train past traps anyone else, at 22,020 combinations of speed, spot and distance. The formula for different speeds each way is checked on 53 cases.
3 times as fast as him, starting 1 tunnel length short of the entrance. With two copies: when the back copy reaches , the other is two thirds of the way through, with a third of a tunnel to go while the train has a whole one.
9/20 of the way in, with the train 9/2 tunnel lengths short of the entrance. That is and with .
1 second either way. Running back he takes 1 second and the train 2, and running forward he takes 3 and the train 4. The margins are equal because he is standing at the dead-heat point, where they always are.
Forward. Running back he needs 1.2 seconds and the train reaches the entrance in 1, so it is there first. Running forward he needs 2.8 seconds and the train needs 3, so he is out with 0.2 of a second to spare. He is beyond the quarter mark, the dead-heat point for a train twice his speed, so forward is the better run.