Method stop · When and why do we use it?

The Pigeonhole Principle

In the Chinese book: 抽屉原理

More objects than boxes: some box gets two. The hard part is building the boxes.

📖 Chapter 2 of 《组合趣题》M16 The Pigeonhole Principle line

Before this stop, visit:Counting (Skill)

One idea, one picturePut 6 balls into 5 boxes, and try to keep every box from getting 2 balls. At which ball do you find you can't avoid it?

Loading figure…

In one sentence

If there are more objects than boxes, some box holds more than one.

The idea fits in one sentence. Its power is that you never need to know how the objects were placed.

Why you can't avoid it

Step 1 / 4
Loading figure…
  1. Suppose you can avoid it

    Suppose there is a way to place the balls so that every one of the boxes has at most ball. Let us count how many balls such a placement can hold at most.

Predict first

Put balls into boxes. However you do it, the fullest box holds at least how many balls?

balls
Choose an answer first; then you can see the result.

In a real problem, nobody tells you what the “balls” and the “boxes” are. In the four stops below the principle is the same but the boxes look completely different, and at every stop, choosing the right boxes is the whole solution.

Stop 1 · Integers: sort by remainder

Among any integers, there are two whose difference is a multiple of . Why?

First pick numbers from to , trying to make sure no two of them differ by a multiple of . How many can you pick at most? Then try the options under “Boxes” one by one: which way of sorting proves “at most ”?

Loading figure…
Sorting by “Last digit” is not wrong: two numbers in the same box differ by a multiple of . But there are boxes, too many: it only shows that “picking forces a clash”.

There are only five remainders on division by : . With numbers and boxes, two numbers have the same remainder, and numbers with the same remainder differ by a multiple of . Boxes = remainders.

Stop 2 · Pairing: lock the “troublemakers” up together

If you take any numbers from to , two of them add up to .

Predict first

Don't look below yet. To prove this, how would you sort to into boxes?

Choose an answer first; then you can see the result.

The trick is to think backwards: whatever you want to collide, put in the same box.

Stop 3 · Geometry: cut the shape up

Put any points in a square of side . Two of them are at most apart.

First drag the points to spread them as far apart as you can. Then choose a way to cut the square.

Loading figure…
All three cuts give boxes, so all of them guarantee that “two points share a box”. Only one of them guarantees that those two points are close enough.

Getting the number of boxes right is not enough; the shape of the boxes must be right too. The two farthest points in one box must be no farther apart than the distance you want to prove.

Stop 4 · The same numbers, two kinds of boxes

Boxes are tailor-made for the conclusion. Both problems below start with “take numbers from to ”, but the conclusions differ, so the boxes are completely different.

One problem, several solutions

Take any numbers from to . Prove that (a) two of them are coprime; (b) there are two of them such that one is a multiple of the other.

(a) Coprime: lock up neighbors together

Use as boxes. Among numbers, two share a box. They are neighbors, so they are coprime.

Loading figure…

CostThe boxes are easy to find: two consecutive integers are always coprime.

(b) Multiples: lock up “doubling chains” together

Keep halving a number until you reach an odd number. Put the numbers that end at the same odd number together: , , , … There are odd numbers from to , so there are exactly boxes. Of two numbers in the same box, the larger is , , , … times the smaller.

Loading figure…

CostThe boxes are hard to find, but once you see them it is one step.

Each side also offers the other side's boxes. Swap them around and see why they do not work.

What if there are no more objects than boxes?

Break it

Counterexample lab: remove one condition

Conclusion: Two points are at most apart

points and small squares. With “2×2 small squares” chosen, however you drag, one square is always outlined in bold: two points are crowded into it.

Loading figure…

Practice

Exercise 1Basic

A bag holds balls of each of four colors: red, yellow, blue and green. With your eyes closed, what is the smallest number of balls you must take out to be sure of having of the same color?

Exercise 2Basic

You take any integers and want to be sure that two of them differ by a multiple of . What is the smallest ?

Exercise 3Advanced

From the numbers to , what is the smallest number you must take to be sure that two of them add up to ?

Exercise 4Advanced

Prove: if you put any points in a square of side , two of them are at most apart.

Exercise 5Challenge

Take some numbers from to so that no number is a multiple of another. What is the largest number you can take? (Show both that you cannot take more, and that you really can take that many.)

Mistake Museum · Exhibits from this stop

Before you leave, look at the traps other people fell into here.See every exhibit in the museum →

Exhibit

Saying “exactly” for “at least”, and “every” for “some”

The wrong step: balls go into boxes, so one box has exactly balls and each of the others has .
What went wrong? Think first, then open

Diagnosis The pigeonhole principle only promises that there is a box with at least . Putting all balls in one box is also allowed: then one box has and four boxes are empty.

The right step: All you can conclude is: at least one box has at least balls. Which box, and how many exactly, the principle does not tell you.

“The pigeonhole principle only says “there is” and “at least””

Exhibit

Not taking the worst case all the way

The wrong step: A bag has lots of red, yellow and blue socks. To be sure of getting socks of the same color, you need to take socks.
What went wrong? Think first, then open

Diagnosis is certainly enough, but the question asks for the smallest number. The unluckiest case is socks of each color ( socks, and still no of a color). Then just more is sure to complete a set.

The right step: socks. In general: fill every box to “one short of success”, then add .

“Imagine the unluckiest case first, then add just 1”

Exhibit

Boxes that are too big, so sharing a box proves nothing

The wrong step: There are points in a square of side . Cut the square into vertical strips; two points must share a strip, so they are at most apart.
What went wrong? Think first, then open

Diagnosis Two points in the same strip can be one at the top and one at the bottom, more than apart. A box is only useful if “being in the same box” automatically gives the conclusion you want.

The right step: Cut it into small squares of side : two points in the same small square are at most its diagonal, , apart.

“A good box: if two things share it, the conclusion holds”