PuzzleReels
Sections

The Two Monks

The maths · Episode 12 · 2:47 · gives the answer

The puzzle

A monk walks up a mountain path from dawn to dusk, at any pace he likes, resting and even turning back, and sleeps at the top. The next day he walks down the same path from dawn to dusk, again at any pace he likes.

Was there a time of day at which he was at exactly the same spot on both days?

The maths, properly

Measure the day from 0 at dawn to 1 at dusk, and the path from 0 at the foot to 1 at the top, as distance along the path, so that the same spot is the same number. Write u(t) for where he is at time t on the way up and d(t) for where he is on the way down. That is all there is to know about him:

u(0)=0,u(1)=1,d(0)=1,d(1)=0

and both are continuous: to get from one place on the path to another he passes through every place in between. Nothing is said about speed, and nothing needs to be.

Proof one: draw the two walks

This is the film's bridge. Plot both walks against the time of day and look at the gap between them,

f(t)=u(t)−d(t)

It is continuous, because both walks are. At dawn f(0)=0−1=−1, and at dusk f(1)=1−0=1. A continuous function that starts below zero and ends above it has to be zero somewhere in between: that is the intermediate value theorem. At that moment u(t)=d(t).

Look at what the proof used: the four numbers at the ends and the fact that he walks rather than jumps. Resting, dawdling and turning back never come into it.

Proof two: two monks, one day

This is the film's answer. Both walks fill the same hours, so run them on the same day. Two monks set off at dawn, one from the foot and one from the top. At dawn the climber is below the other; at dusk he is above. A path is a line, and there is no way round anyone on a line, so to change order the two must at some moment be in the same place. That moment is one spot at one time of day, and the two monks are the same man on his two days.

It is worth being honest about what is doing the work. "They cannot change order without meeting" is the intermediate value theorem again, applied to the gap between them. The second monk does not bring a new theorem. He brings a picture in which the conclusion cannot be doubted, which is what a proof is for, and he makes clear the one thing the graph hides: the path must be a line (see below, on a field).

Proof three: halve the day

The film does not show this one. Look at noon. If he was in the same place at noon on both days, that is the answer. If not, then in one half of the day the climber starts below the descender and ends above him: in the afternoon if at noon he was still below, in the morning if he was already above. Keep that half, and halve it again.

The halves nest, each half as long as the one before, so they close in on a single time t∗. At the start of every one of them the gap is negative and at the end it is positive. Both ends close in on t∗, so by continuity f(t∗) is a limit of negative numbers and of positive numbers at once: it is at most zero and at least zero. So f(t∗)=0.

This is the proof of the intermediate value theorem itself, and the one step that needs care is the closing in. Nested intervals that shrink to nothing always share a point because the real line has no gaps. The rational numbers do have gaps, and over them the theorem is false: x2−2 is negative at 0 and positive at 2 and never zero at a fraction.

It is also an algorithm, and it answers route one's complaint. The film says that solving u(t)=d(t) works for one pair of walks at a time. Halving works for every pair at once: not a formula, but a procedure that finds a meeting to any precision you ask for, one binary digit per step.

A worked case: the film's walks

The film's climb starts quickly, changes its mind 0.330 of the way up and drops back to 0.260, sits on a rock, and then plods to the top. The descent dawdles, stops for a long look at the view, and then hurries home. They meet 0.718 of the way through the day, 0.576 of the way up the path: not at midday, and not halfway.

dawndusk 0.718 foottop 0.576
The film's walks
dawndusk 0.115 foottop 0.885
Sprint up, crawl down

━ day one, climbing   ━ day two, descending   ◯ the same place at the same time

Route one's guess, midday and halfway up, is killed by the right-hand pair. Sprint up and then wander, crawl down at a steady pace, and the meeting is at 0.115 of the day, 0.885 of the way up: early, and near the top.

Halving the film's day

Proof three, run on the film's walks. At each step, look at the middle of the bracket: if the climber is still lower than the descender there, the meeting is later, so keep the second half.

Halving the film's day
BetweenLook atClimberMeeting
0.000 – 1.0000.500lowerlater
0.500 – 1.0000.750higherearlier
0.500 – 0.7500.625lowerlater
0.625 – 0.7500.688lowerlater
0.688 – 0.7500.719higherearlier
0.688 – 0.7190.703lowerlater
0.703 – 0.7190.711lowerlater
0.711 – 0.7190.715lowerlater
0.715 – 0.7190.717lowerlater
0.717 – 0.7190.718lowerlater

After 10 halvings the meeting is pinned between 0.718 and 0.719 of the day, a bracket 0.0010 wide, and it has the film's 0.718 inside it.

Try to break it

The film ends by throwing three more pairs of walks at the claim, with rests and turn-backs in them. They meet at 0.767, 0.587, 0.441 of the day, at heights 0.846, 0.085, 0.579. The spot moves and the time moves; the meeting does not.

dawndusk 0.767 foottop 0.846
First try
dawndusk 0.587 top 0.085
Second try
dawndusk 0.441 foottop 0.579
Third try

Drag the walks

Drag any knot of either walk, or focus one and use the arrow keys, and try to make them miss. The slider puts both days on one day and shows the two walkers on the path at that moment.

The film's five pairs of walks, and where each meets
PairMeets, through the dayHow far up
The film's two walks0.7180.576
Sprint up, crawl down0.1150.885
Break it, first try0.7670.846
Break it, second try0.5870.085
Break it, third try0.4410.579

How many times can they meet?

At least once, by any of the proofs. Several times is easy: let the descender stop on a rock while the climber passes him, turn back, and pass again. In 4000 random pairs of walks that rest and turn back, 517 (12.9%) met more than once, one of them 7 times. A whole stretch of the day happens when both rest at the same spot at overlapping times: then every moment of the overlap is a meeting. The set of meeting times is always closed, so there is always a first meeting and a last one.

The passes are odd. Count only the meetings where they actually pass each other, where the climber goes from below to above or back again, and not the ones where they touch and part on the same side. He starts below and finishes above, so he passes upwards one more time than he passes downwards, and the total is odd:

4,000 random pairs of walks
Times they pass each otherPairs
13483
3468
547
72

Exactly once when one walk never turns back and the other never turns back or stops. Then u never decreases and d always decreases, so the gap f=u−d is strictly increasing, and a strictly increasing function is zero at most once. Allow both to stop and the meeting can be a stretch; allow either to turn back and it can be several.

What changes if the puzzle is changed

Different hours. The film insists that both days run from dawn to dusk. That is a safe way to tell it, but it is more than the proof needs. He lives at the foot and sleeps at the top, so compare the two whole days from midnight to midnight: at the first midnight he is at the foot on day one and at the top on day two, and at the last midnight it is the other way round. Leave late, arrive early, wait at either end: the proof goes through unchanged. The script checks 2000 pairs with random departure and arrival times, and every one meets. What matters is that at every moment of both days he is somewhere on the path.

Two climbs. If he climbs on both days, he is at the foot at dawn and at the top at dusk both times, so the walks meet at the ends and need not meet anywhere else: a fast climb is ahead of a slow one all day. The trick needs opposite ends.

A different path down. Then "the same spot" may not exist. The same path is what turns where he is into a single number.

A field instead of a path. On a square field, two walkers who set off from opposite corners at dawn and swap corners by dusk need not ever stand in the same place: one goes along the bottom edge and up the right, the other along the top and down the left, at the same pace, and they are always on opposite sides. In two dimensions you can go round. That is the step in proof two that the path being a line pays for.

Jumps. If he could vanish in one place and reappear in another, continuity is gone and so is the conclusion. The halfway house is a staircase: a step at a time, on the tick of a clock. Then they either stand on the same step on some tick, or swap across one stair between two ticks, which in continuous time is meeting halfway up it. The gap between them changes by at most two a tick, so to get from negative to positive without being zero it must jump from −1 to +1, and that is the swap. Allow strides of two and they can miss: on a staircase of two, one goes 0→2 while the other goes 2→0.

Every pair of staircase walks
StepsTicksPairsSame stepSwap only
11101
23972
341688
361,4441,010434
46361249112
473,9692,8331,136
57676396280

Taking it further: the universal chord

Forget day two. On the way up, was there a stretch of exactly half the day in which he climbed exactly half the path?

There always is. Let g(x)=u(x+12)−u(x)−12 for x between 0 and 12: the climb in the half-day starting at x, minus a half. Then

g(0)+g(12)=u(1)−u(0)−1=0

so g(0) and g(12) are zero or of opposite signs, and the intermediate value theorem gives a zero between them. On the film's climb it is the half-day from 0.409 to 0.909. The same works for any 1n: the n values g(0),g(1n),…,g(n−1n) add up to u(1)−u(0)−1=0, so one is at most zero and one at least zero, and there is a zero between them.

And for nothing else. With a=25, take Paul Lévy's walk

u(x)=x+c(sin2πxa−xsin2πa)

with c=0.1. It starts at the foot and ends at the top, and c is small enough that it climbs all day without stopping. Since sin2 repeats every π, the bracket changes by exactly −asin2πa over any stretch of length a, so in every stretch of two-fifths of the day this monk climbs exactly 0.36 of the path, never 0.4. The same formula avoids any length that is not 1n, because sinπa is zero only when 1a is a whole number.

Does some stretch of a fraction of the day hold the same fraction of the climb?
FractionFor every walk?A walk that avoids it
1/2always—
1/3always—
2/5not alwaysevery 2/5 of the day climbs exactly 0.3600
0.45not alwaysevery 0.45 of the day climbs exactly 0.4314
2/3not alwaysevery 2/3 of the day climbs exactly 0.6000
0.3not alwaysevery 0.3 of the day climbs exactly 0.2823

This is the universal chord theorem: a continuous function with g(0)=g(1) has a horizontal chord of length 1n for every n, and Lévy showed in 1934 that those are the only lengths that are guaranteed.

Checking it

None of the above is left to the proofs. scripts/monks.mjs reads the film's own monks.json, finds every meeting of every pair of walks the film draws, and asserts that each meets exactly once, where the film puts its flag. The climb is checked to turn back and to rest, and the descent to stop. Then it checks the rest.

A walk is straight between its samples, so the gap between two walks is too, and every meeting is found exactly, not by searching. Each one is tested to be a meeting, the number of passes is compared with the sign changes of the gap at the samples, and halving the day is run on every pair and must land on a meeting.

What was checked
WalksPairsResult
Resting, dawdling and turning back4,000every pair meets; passes always odd
Both strictly climbing or descending400exactly one meeting each
One strictly, one with rests400exactly one meeting each
Leaving and arriving at different hours2,000every pair meets
The lab's walks, dragged in steps of 0.053,000every pair meets; passes always odd

The staircase is checked for every pair of walks, 6,476 pairs on the mountains in the table above, not for a sample. The universal chord is found exactly on 2,000 random climbs for every 1n up to 18, and Lévy's walks are checked to climb the same amount over every stretch, and to keep climbing, at 20,000 points each.

The lab runs the functions in site/lib/monks-core.mjs, the same text the script imports, and the script checks the pasted copy against the module on 3,000 pairs of the lab's own walks, half of them dragged to heights in steps of 0.05 so that ties, shared rests and touches turn up: 34 of them meet along a stretch and 489 more than once, and every one meets.

Where this shows up

  • Fixed points. Any continuous map h of the interval [0,1] into itself has a point with h(x)=x: apply the same argument to h(x)−x, which is at least zero at 0 and at most zero at 1. Brouwer's fixed point theorem is the same statement for a disc, a ball, and their higher-dimensional cousins, and needs much more than a line to prove.
  • Finding roots. Proof three is the bisection method, the root finder of last resort in numerical work: slow, one binary digit a step, and guaranteed whenever the function is continuous and the signs at the ends differ.
  • Cutting pancakes. Any two pancakes on a plate, of any shapes, can be cut exactly in half by one straight cut. Turn the knife through every direction; the intermediate value theorem finds, for each direction, the cut that halves the first pancake, and then a direction where it halves the second too.

Try it yourself

1. He climbs the mountain on two different days, from dawn to dusk each time. Must there be a time of day at which he was at the same spot on both climbs?

Only trivially. He is at the foot at dawn and at the top at dusk both times, so those are meetings, but there need be none in between: a fast climb stays ahead of a slow one all day. The script's example, one climb halfway up by a tenth of the day and the other by nine-tenths, meets only at dawn and at dusk.

2. On day three he climbs again. Must there be a time of day at which he was at the same spot on all three days?

No. Each pair of up and down meets, but at different times. Climb to 0.8 of the way up by 0.2 of the day on day one, walk down at a steady pace on day two, and climb to only 0.2 by 0.8 of the day on day three. Day one meets day two at 0.2 of the day, day three meets it at 0.8, and the two climbs are never together between dawn and dusk.

3. A runner covers 10 km in exactly 50 minutes, not at a steady pace. Must there be a 25-minute stretch in which she covers exactly 5 km? A 20-minute stretch with exactly 4 km?

Yes to the first: it is the universal chord with n=2. Not necessarily to the second: 20 minutes is two-fifths of the run, and a runner on Lévy's schedule covers exactly 3.6 km in every 20-minute stretch, while running forwards the whole time.

4. Prove that if he never turns back on the way up and never turns back or stops on the way down, there is exactly one meeting.

The gap f=u−d is then strictly increasing: if s<t then u(s)≤u(t) and d(s)>d(t), so f(s)<f(t). It is zero at least once by proof one, and a strictly increasing function cannot be zero twice.