Method line M16 · When and why do we use it?

The Pigeonhole Principle

In the Chinese book: 抽屉原理

More objects than boxes means a box holds two. The art is building boxes.

📖 §4.1 of 《解题方法与策略》

One idea, one picturePick numbers from 1 to 10, but no two of them may add up to 11. How many can you pick at most? When you are stuck, click “Open the boxes”.

Loading figure…

In one sentence

Put objects into boxes, and at least one box holds two or more.

The reason takes one line: if every box held at most one, there would be at most objects, not .

Everyone understands this sentence. The real skill is that the problem never hands you the boxes: you have to build them yourself. Build them well, and “two in the same box” is exactly the pair the problem is asking for.

Predict first

Choose any numbers from . Must two of them add up to ?

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

Example: choose 6 numbers from 1 to 10; two of them must add up to 11

Step 1 / 4
Loading figure…
  1. First, try to avoid it

    Pick . Any two add up to at most , so there is no clash. numbers can avoid it.

Solving a problem with the pigeonhole principle really means answering three questions: What are the objects? What are the boxes? What does it mean for two to share a box?

Stop 1 · Building the boxes (Vol. 7)

Sometimes the boxes are hidden a little deeper.

Choose any numbers from . Prove that one of them is a multiple of another.

Every positive integer can be written as “an odd number × some s”. Put numbers with the same odd part in the same box: for two numbers in the same box, the larger one is , or times the smaller one.

Example: choose 6 numbers from 1 to 10; one must be a multiple of another

Step 1 / 4
Loading figure…
  1. First, try to avoid it

    Pick . None of these five numbers is a multiple of another.

Stop 2 · Residue systems (Vol. 6)

When you divide integers by , there are only possible remainders: . Remainders are natural boxes, and two numbers in the same box have a difference that is a multiple of .

Example: among any 6 integers, two have a difference that is a multiple of 5

Step 1 / 3
Loading figure…
  1. The boxes: remainders

    Sort by the remainder when dividing by : that gives boxes. Only to are drawn here, but every other integer goes into one of these five boxes too.

You can even use the boxes twice in a row.

Example: among any 5 integers, three have a sum that is a multiple of 3

Step 1 / 4
  1. The boxes: remainders mod 3

    Put the integers into three boxes: “remainder ”, “remainder ”, “remainder ”. There are two cases.

Stop 3 · Boxes in a figure (Vol. 4)

In geometry the boxes are small regions: cut the figure into a few pieces, and two points in the same piece cannot be too far apart.

Place any points in a square of side (edges included).

Predict first

You want the points to be as far apart from each other as possible. How large can “the distance between the closest two points” be?

Choose an answer first; then you can see the result.
Loading figure…
Drag the five points and try to make the closest pair more than apart. If you cannot, look at which small cell has two points crammed into it.

The Pythagorean theorem is used only once here: a square of side has a diagonal of length . What really does the work is “”.

Practice

Exercise 1Basic

What is the smallest number of numbers you must choose from to guarantee that two of them add up to ?

Exercise 2Advanced

What is the smallest number of integers you must take to guarantee that two of them have a difference that is a multiple of ?

Exercise 3Challenge

What is the smallest number of numbers you must choose from to guarantee that one of them is a multiple of another?

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

Two in the same box, but not the property you wanted

The wrong step: Take any integers and put them into boxes by their remainder when divided by . Two of them must leave the same remainder. So two of them must have a sum that is a multiple of .
What went wrong? Think first, then open

Diagnosis Two numbers with the same remainder have a difference that is a multiple of , but not necessarily a sum. For example, all leave remainder , and any two of them add up to something with remainder . The boxes were right; the conclusion was read wrongly.

The right step: First work out exactly what “two in the same box” guarantees. Remainder boxes guarantee that two of the numbers have a difference that is a multiple of . The original claim about the “sum” is simply false: the numbers above are a counterexample.

“Before building the boxes, ask what two in the same box would mean”

Exhibit

Forgetting to add one to the average

The wrong step: objects go into boxes. remainder , so at least one box has objects.
What went wrong? Think first, then open

Diagnosis That is not wrong, but it says too little. If every box had at most , there would be at most objects, which is not enough room for . So you can guarantee .

The right step: Count by contradiction: suppose every box holds at most . Then there are at most objects. So at least one box holds . When there is a remainder, add to the quotient.

“Suppose no box is full enough, and see whether everything still fits”

Stops on this line

The same idea, used once in each of several places.

  1. The Pigeonhole PrincipleVol. 7 Fun Problems in Combinatorics, ch. 2
  2. Residue Systems and Their UsesVol. 6 Divisibility, Congruences and Diophantine Equations, §2.2
  3. Triangles: Basic Concepts and PropertiesVol. 4 Triangles and Quadrilaterals, ch. 1