Skip to main content

The pigeonhole principle: guaranteed coincidences in counting problems

Syllabus dot point

“State and apply the pigeonhole principle in counting and existence problems”

HSCMaths Extension 1Combinatorics (ME-A1)10 min read

Quick answer

The pigeonhole principle: if n+1n + 1 or more objects are placed into nn boxes, at least one box contains ≥2\ge 2 objects; generalised, kn+1kn + 1 or more in nn boxes forces some box to hold ≥k+1\ge k + 1 (equivalently ⌈m/n⌉\lceil m/n \rceil for mm objects). It proves existence only, and the skill is choosing boxes (often remainders, intervals or subset-sums) that make the conclusion fall out.

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Exam-style questions

What this dot point is asking

NESA wants you to recognise problems where the pigeonhole principle applies, identify the "boxes" and "pigeons" appropriately, and use the principle to prove that some box must contain at least two objects (or more, in the generalised form). The principle itself is almost trivially true; the marks are won by the modelling, that is, choosing the boxes so cleverly that "two pigeons in one box" turns into exactly the statement you were asked to prove.

The answer

The pigeonhole principle (basic form)

If n+1n + 1 or more objects are placed into nn boxes, then at least one box contains at least 22 objects.

Why: if every box held at most 11 object, the total number of objects could be at most nn, which contradicts having n+1n + 1 or more. This is a proof by contradiction, and it is worth writing out that one line in an exam because it shows you understand why the principle holds, not just that it does.

Watch objects fill the boxes, stage by stage

The principle is easiest to believe when you try (and fail) to keep every box to one object. Take 44 boxes and place objects one at a time. The first four can spread out, but the fifth has nowhere new to go.

Stage 1, place the first object. Drop object 1 into a box. Every box still holds at most one object, so there is no doubling-up yet.

Pigeonhole stage 1: first object placedFour boxes; the first of five objects is placed into box one. Every box still holds at most one object.Object 1box 1box 2box 3box 41Place object 1 in box 1. Each box holds at most one so far.

Stage 2, fill every box once. Objects 2, 3 and 4 each take an empty box. Now all four boxes hold exactly one object. This is the tight case: with exactly as many objects as boxes, you can avoid a repeat, so 44 objects in 44 boxes guarantees nothing.

Pigeonhole stage 2: four objects, one per boxFour objects placed one in each of the four boxes. Every box holds exactly one object and there is no doubling up yet.Objects 1 to 4box 1box 2box 3box 41234Four objects can sit one per box: still no box has two. This is the tight case.

Stage 3, the fifth object forces a pair. Every box is already occupied, so the fifth object must share a box with one already there. Whichever box it lands in (box 1 shown) now holds two. This is the principle: 5=4+15 = 4 + 1 objects in 44 boxes forces a repeat.

Pigeonhole stage 3: the fifth object forces a pairA fifth object is placed; the four boxes already hold one each, so wherever the fifth goes that box now holds two. Box one is highlighted holding objects one and five.Object 5box 1box 2box 3box 415234The 5th object has no empty box: some box (here box 1) now holds two.

Key fact

Basic form: if n+1n + 1 or more objects go into nn boxes, some box holds at least 22. Generalised form: if kn+1kn + 1 or more objects go into nn boxes, some box holds at least k+1k + 1; equivalently, mm objects in nn boxes force some box to hold at least ⌈mn⌉\left\lceil \frac{m}{n} \right\rceil (the ceiling). The whole skill is choosing the boxes so that "two in one box" is exactly the conclusion you need.

The generalised pigeonhole principle

If kn+1k n + 1 or more objects are placed into nn boxes, then at least one box contains at least k+1k + 1 objects.

The reasoning is the same contradiction: if every one of the nn boxes held at most kk objects, the total would be at most knkn, contradicting kn+1kn + 1. Equivalently, if mm objects are placed in nn boxes, at least one box contains at least

⌈mn⌉\left\lceil \frac{m}{n} \right\rceil

objects (the ceiling, the smallest integer not less than mn\frac{m}{n}). The basic form is just k=1k = 1.

Strategy for applying it

  1. Identify the objects (pigeons) and the categories (boxes).
  2. Count the number of each.
  3. Check whether the pigeons exceed (or sufficiently exceed) the boxes, that is m>nm > n for the basic form, or m>knm > kn for the generalised form.
  4. State the conclusion, naming the principle.

The whole difficulty, and where the marks are, is step 1: choosing the boxes so that two pigeons in one box gives the statement you want.

Common box choices

  • Remainders modulo nn. Any n+1n + 1 integers must include two with the same remainder on division by nn, so their difference is divisible by nn. This is the most common HSC pattern.
  • Intervals partitioning a range. Split a length or a range of values into equal sub-intervals; the values in the range are the pigeons. (The 2525-points-in-a-square question splits the square into 1616 cells.)
  • Sums or subset-sums. When proving two subsets share a sum, the possible sums are the boxes and the subsets are the pigeons.
  • Pairs that "use up" a value. When proving two of a collection match, the distinct possible values are the boxes.

Limitations

The pigeonhole principle gives existence, not construction. It tells you that two such objects exist, but never which ones. It is also sharp: with exactly nn objects in nn boxes, every box can hold exactly one, so m=nm = n guarantees nothing, you genuinely need m≥n+1m \ge n + 1. The same sharpness applies to the generalised form at m=knm = kn.

How exam questions ask about the pigeonhole principle

  • "Show that among any NN [integers / people / points] ... two must ...": a near-certain pigeonhole. Make the "..." the box description.
  • "... two leave the same remainder on division by dd" / "... two whose difference is divisible by dd": boxes are the dd remainders 0,1,…,d−10, 1, \dots, d - 1.
  • "... two share a [birthday month / starting letter / value]": boxes are the categories (12 months, 26 letters, and so on).
  • "Show that at least kk of them ...": the generalised form; you need more than (k−1)×(boxes)(k - 1) \times (\text{boxes}) pigeons.
  • Points in a region, "two within distance dd": cut the region into cells whose diameter is dd; the cells are the boxes.
  • The phrasing is almost always "show that", "prove that", or "must" (a guarantee), never "find" or "how many" (those are direct counting). A guarantee with more objects than obvious categories is the cue.
Exam technique

Open by naming the boxes and the pigeons in one sentence each: "Let the boxes be the four remainders 0,1,2,30, 1, 2, 3 modulo 44; the five integers are the pigeons." Then state the inequality (5>45 > 4) and invoke the principle by name. For the generalised form, write the explicit comparison, "25>4×625 > 4 \times 6, so some box has at least 55", so the marker sees the kn+1kn + 1 structure. Finish by translating "two in one box" back into the wording of the question (for example, "their difference is divisible by 44"). Markers reward a clearly identified box set far more than any clever arithmetic; an unclear box choice is the difference between full marks and zero.

Worked example

Share a birthday month (basic form)

Show that among any 1313 people, at least two share a birthday month. The boxes are the 1212 months; the pigeons are the 1313 people. Since 13=12+1>1213 = 12 + 1 > 12, by the pigeonhole principle at least one month is shared by two people.

Share a birth date (larger numbers, same idea)

Show that among any 367367 people, at least two share a birth date. The boxes are the 365365 possible dates (ignoring leap years); the pigeons are the 367367 people. Since 367>365367 > 365, some date is shared by at least two people. (This is the certainty point of the birthday problem.)

Force five with the same remainder (generalised form)

Show that among any 2525 integers, at least 55 leave the same remainder when divided by 66. The boxes are the 66 remainders 0,…,50, \dots, 5; the pigeons are the 2525 integers. Since ⌈256⌉=5\left\lceil \frac{25}{6} \right\rceil = 5 (equivalently 25>4×6=2425 > 4 \times 6 = 24), at least one remainder is shared by 55 of the integers.

Find a difference divisible by four (choosing the boxes)

Show that among any 55 integers, there are two whose difference is divisible by 44. Let the boxes be the 44 remainders 0,1,2,30, 1, 2, 3 modulo 44; the 55 integers are the pigeons. Since 5>45 > 4, two integers share a remainder. If aa and bb have the same remainder modulo 44, then a−ba - b is divisible by 44, which is the required conclusion.

Two close points in a square (geometry)

Show that if 55 points are placed inside a 2×22 \times 2 square, two of them are at most 2\sqrt{2} apart. Cut the square into four 1×11 \times 1 cells (the boxes). With 55 points and 44 cells, some cell contains at least two points. The farthest two points in a 1×11 \times 1 cell are at its diagonal, 12+12=2\sqrt{1^2 + 1^2} = \sqrt{2}, so those two points are at most 2\sqrt{2} apart.

Two subsets with equal sums (subset-sum)

Show that any 1010 distinct two-digit numbers contain two different subsets with the same sum. There are 210−1=10232^{10} - 1 = 1023 non-empty subsets (the pigeons). Each subset sum lies between 1010 (the smallest possible single element) and 90+91+⋯+99=94590 + 91 + \dots + 99 = 945 (the largest possible total), so there are at most 945−10+1=936945 - 10 + 1 = 936 possible sums (the boxes). Since 1023>9361023 > 936, two different subsets share a sum. Removing any common elements from both leaves two disjoint subsets with equal sums.

Common traps
Wrong choice of boxes
The principle only helps if "two pigeons in one box" gives the conclusion you want. Choosing boxes carelessly proves nothing. This is where most marks are lost.
Off-by-one in the bound
"n+1n + 1 or more" pigeons forces a box with ≥2\ge 2; exactly nn pigeons does not. State the strict inequality.
Generalised-form miscount
kn+1kn + 1 pigeons force ≥k+1\ge k + 1 in some box; knkn pigeons do not. Use the ceiling ⌈m/n⌉\lceil m/n \rceil to be safe, and double-check whether m=knm = kn exactly (in which case the guarantee is only kk).
Trying to construct
The principle is existence-only. Do not attempt to say which box has the extras or which objects coincide.
Confusing it with exact counting
Pigeonhole proves "at least one box has ≥k\ge k"; it never says how many boxes do, nor exactly how full any box is.

Exam-style questions

Questions in the style of NESA exam questions on this dot point, each with a worked answer. They are written by ExamExplained unless tagged "Past paper"; the year shows the paper a question is modelled on.

HSC-style2 marks
Show that among any 55 integers, at least two leave the same remainder when divided by 44.
Show worked answer →

When an integer is divided by 44, the possible remainders are 0,1,2,30, 1, 2, 3, which is 44 categories (boxes).

The 55 integers are the pigeons. Since 5>45 > 4, by the pigeonhole principle at least one remainder is shared by two of the integers.

Hence at least two of the five integers have the same remainder modulo 44.

HSC-style3 marks
2525 points are placed inside a square of side length 11. Show that some pair of points is at most 24\frac{\sqrt{2}}{4} apart.
Show worked answer →

Divide the unit square into a 4×44 \times 4 grid of 1616 smaller squares, each of side 14\frac{1}{4} (these are the boxes).

There are 2525 points (pigeons) and 1616 small squares. Since 25>1625 > 16, by the pigeonhole principle at least one small square contains at least two of the points.

The greatest distance between two points within a small square is its diagonal, (14)2+(14)2=24\sqrt{\left( \tfrac{1}{4} \right)^2 + \left( \tfrac{1}{4} \right)^2} = \frac{\sqrt{2}}{4}.

Therefore those two points are at most 24\frac{\sqrt{2}}{4} apart.

Practise this

Sources & how we know this

ExamExplained