Pigeonhole & Extremal

Study Sheet

Pigeonhole & Extremal

Existence from counting and extremes

Two Existence Principles

Tip
Pigeonhole principle

If n+1n+1 objects go into nn boxes, some box holds at least two; more generally some box holds at least ⌈m/n⌉\lceil m/n\rceil of mm objects.

In plain terms. More items than boxes forces a box to double up. The trick is choosing boxes so that "two in a box" is exactly what you want.

Example. Among any 1313 people, two share a birth month: 1313 people, 1212 months, so some month repeats.

Tip
Extremal principle

Consider the largest, smallest, or closest object; its extremal property forces structure.

In plain terms. Look at the most extreme case in the setup — the biggest, smallest, or nearest — and its special status usually breaks the problem open.

Example. Among finitely many points, the two closest ones can't have a third point strictly between them.

Pigeonhole: Choosing the Boxes

Theorem
The principle, and where the work is

If more than knkn objects are placed in nn boxes, some box holds at least k+1k + 1. Equivalently, some box holds at least the average mn\tfrac mn of mm objects, rounded up. The work in a problem is never the principle; it is the choice of boxes, made so that two objects in one box is exactly the conclusion you want.

If every box held at most kk objects there would be at most knkn in all — that is the proof. So everything rests on design: boxes are the classes of an equivalence relation (same residue, same odd part, same small square), and the relation must be chosen so that “same class” implies the desired property. A good test before counting: take two objects in one box and check that the conclusion really follows. If it doesn't, the boxes are wrong, however the numbers come out.

Example
Example 1: one divides another

Prove that among any n+1n + 1 numbers chosen from {1,2,…,2n}\{1, 2, \ldots, 2n\}, one divides another. Show that nn numbers are not enough.

Step 1 — boxes: write each number as 2jm2^j m with mm odd, and put it in box mm. The odd parts are among 1,3,…,2n−11, 3, \ldots, 2n - 1: nn boxes.

Step 2 — n+1n + 1 numbers in nn boxes: two share an odd part, 2im2^i m and 2jm2^j m with i<ji < j, and the first divides the second.

Step 3 — sharpness: {n+1,n+2,…,2n}\{n + 1, n + 2, \ldots, 2n\} has nn numbers and no divisibility, since the smallest proper multiple of k≥n+1k \ge n + 1 is 2k>2n2k > 2n. ■\blacksquare (The same bound with boxes {1,2},{3,4},…\{1, 2\}, \{3, 4\}, \ldots shows two chosen numbers are consecutive, hence coprime.)

How to find it. Divisibility inside a chain m,2m,4m,…m, 2m, 4m, \ldots is automatic. So partition {1,…,2n}\{1, \ldots, 2n\} into nn such chains.

Example
Example 2: a subset sum divisible by n

Prove that any nn integers a1,…,ana_1, \ldots, a_n contain a nonempty block of consecutive terms ai+1+⋯+aja_{i+1} + \cdots + a_j whose sum is divisible by nn.

Step 1 — the objects are the n+1n + 1 prefix sums S0=0,S1=a1,…,Sn=a1+⋯+anS_0 = 0, S_1 = a_1, \ldots, S_n = a_1 + \cdots + a_n; the boxes are their residues mod nn, of which there are nn.

Step 2 — two prefix sums share a residue: Si≡SjS_i \equiv S_j with i<ji < j. Then n∣Sj−Si=ai+1+⋯+ajn \mid S_j - S_i = a_{i+1} + \cdots + a_j, a nonempty block. ■\blacksquare

How to find it. Sums of consecutive terms are differences of prefix sums, and “difference divisible by nn” is “same residue”. The empty prefix S0S_0 is what supplies the (n+1)(n+1)-st pigeon.

Example
Example 3: monotone subsequences
ixᵢ
The sequence 5, 8, 2, 9, 1, 6, 3, 10, 4, 7 with the increasing run 1, 3, 4, 7 marked.

Prove that every sequence of mn+1mn + 1 distinct real numbers has an increasing subsequence of length m+1m + 1 or a decreasing subsequence of length n+1n + 1. (Erdős–Szekeres, 1935.)

Step 1 — label each term xix_i with the pair (ai,di)(a_i, d_i): the length of the longest increasing, and of the longest decreasing, subsequence ending at xix_i.

Step 2 — the labels are distinct. For i<ji < j, if xi<xjx_i < x_j then appending xjx_j to an increasing subsequence ending at xix_i gives aj≥ai+1a_j \ge a_i + 1; if xi>xjx_i > x_j, likewise dj≥di+1d_j \ge d_i + 1.

Step 3 — if every ai≤ma_i \le m and every di≤nd_i \le n, there are at most mnmn possible labels for mn+1mn + 1 terms: two terms would share a label. So some ai≥m+1a_i \ge m + 1 or some di≥n+1d_i \ge n + 1. ■\blacksquare For 5,8,2,9,1,6,3,10,4,75, 8, 2, 9, 1, 6, 3, 10, 4, 7 (m=n=3m = n = 3) the labels are (1,1),(2,1),(1,2),(3,1),(1,3),(2,2),(2,3),(4,1),(3,3),(4,2)(1,1), (2,1), (1,2), (3,1), (1,3), (2,2), (2,3), (4,1), (3,3), (4,2), and the label (4,2)(4, 2) of the last term records the increasing subsequence 1,3,4,71, 3, 4, 7.

How to find it. The boxes are not given; you manufacture them as labels. When a pigeonhole argument has no visible boxes, attach to each object the data you would like to be large and show that no two objects can carry the same data.

Side note
Where it goes wrong

In Example 2 the tempting version uses the numbers themselves as pigeons: “nn numbers, nn residues, so two numbers are congruent and ...” — first, nn pigeons in nn boxes force nothing: 1,2,3,41, 2, 3, 4 are pairwise incongruent mod 44. Second, two congruent terms give a difference divisible by nn, not a sum. The proof works only with the n+1n + 1 prefix sums, and it is the empty sum S0=0S_0 = 0 that tips the count.

Try it
Try it: sum or difference

Prove that among any 77 integers there are two whose sum or difference is divisible by 1010.

Show the answer

Boxes by residue mod 1010, merging rr with 10−r10 - r: {0}\{0\}, {5}\{5\}, {1,9}\{1, 9\}, {2,8}\{2, 8\}, {3,7}\{3, 7\}, {4,6}\{4, 6\} — six boxes for seven integers. Two share a box: if their residues are equal, the difference is divisible by 1010; if they are rr and 10−r10 - r, the sum is.

The Extremal Principle at Work

Theorem
Choose the extreme, then beat it

Among finitely many candidates — or any nonempty set of nonnegative integers — some one is largest or smallest. Assume the conclusion fails, take the extreme object, and use the failure to build a more extreme one. The contradiction proves the conclusion.

The logic is the well-ordering principle: a nonempty set of nonnegative integers has a least element, and a finite set of reals has a least and a greatest. Choosing the extreme object gives you a free inequality — nothing is smaller — which often is exactly the missing hypothesis. The two things to check in every extremal proof are that the extreme exists (finiteness, or integer values, or compactness) and that the new object is genuinely of the same kind as the old.

Example
Example 1: an averaging grid

Each cell of the infinite square grid holds a positive integer equal to the average of its four neighbours. Prove that all the integers are equal.

Step 1 — the values are positive integers, so there is a smallest value mm, attained at some cell cc.

Step 2 — mm is the average of four numbers, each at least mm; the average equals mm only if all four equal mm. So every neighbour of cc also holds mm.

Step 3 — repeating the argument at those neighbours, and so on, every cell reachable by steps between neighbours — that is, every cell — holds mm. ■\blacksquare

How to find it. “Each value is the average of its neighbours” is a statement that fails at a strict minimum. The integer hypothesis is there to make the minimum exist.

Example
Example 2: non-crossing matching
R₁B₁R₂B₂X
Crossing pairs (solid) are longer than the uncrossed pairs (dashed), by the triangle inequality at X.

nn red and nn blue points lie in the plane, no three collinear. Prove that they can be matched in red-blue pairs by nn segments no two of which cross. (Putnam 1979.)

Step 1 — there are n!n! perfect red-blue matchings, finitely many; take one with the smallest total length.

Step 2 — suppose two of its segments R1B1R_1B_1 and R2B2R_2B_2 cross at XX. Replace them by R1B2R_1B_2 and R2B1R_2B_1. By the triangle inequality, R1B2<R1X+XB2R_1B_2 < R_1X + XB_2 and R2B1<R2X+XB1R_2B_1 < R_2X + XB_1 (strict, since no three points are collinear), and the right sides add up to R1B1+R2B2R_1B_1 + R_2B_2.

Step 3 — the new matching is shorter, contradicting minimality. So the minimal matching has no crossings. ■\blacksquare

How to find it. Crossing segments can always be uncrossed, but uncrossing may create new crossings elsewhere, so a step-by-step fix needs a measure that improves every time. Total length does, and the shortest matching is the fixed point.

Example
Example 3: a king in every tournament

In a tournament, player vv is a king if for every other player ww, either vv beat ww or vv beat someone who beat ww. Prove that a player with the most wins is a king, and that the players can be listed so that each beat the next. (Landau; Rédei.)

Step 1 — let vv have the most wins, and suppose some ww is not reached in two steps: vv did not beat ww, so ww beat vv, and no one beaten by vv beat ww, so ww beat everyone vv beat. Then ww beat all of vv's victims and vv as well: more wins than vv. Contradiction.

Step 2 — for the listing, take a longest sequence v1,…,vkv_1, \ldots, v_k in which each beat the next. If some ww is missing: if ww beat v1v_1, put ww first; if vkv_k beat ww, put ww last. Otherwise v1v_1 beat ww and ww beat vkv_k; let ii be the first index with ww beating viv_i (so i≥2i \ge 2), then vi−1v_{i-1} beat ww, and vi−1,w,viv_{i-1}, w, v_i can be inserted. Every case lengthens the sequence, contradicting maximality, so everyone is listed. ■\blacksquare

How to find it. Both claims assert that something reaches everything. Take the object that reaches the most (most wins, longest path) and show any unreached player would let you reach more.

Side note
Where it goes wrong

The extreme has to exist. Replace “positive integer” by “real number” in Example 1 and the claim is false: f(x,y)=xf(x, y) = x is the average of its four neighbours x±1x \pm 1, xx, xx at every cell, and it is not constant. The proof broke at

Step 1 — the values …,−1,0,1,…\ldots, -1, 0, 1, \ldots have no minimum. Any extremal argument over an infinite set must name the reason the extreme is attained.

Try it
Try it: a path through a tournament

In a tournament on 66 players, player 11 beat 2,3,42, 3, 4; player 22 beat 3,5,63, 5, 6; player 33 beat 4,5,64, 5, 6; player 44 beat 2,52, 5; player 55 beat 1,61, 6; player 66 beat 1,41, 4. Find a player who is a king and a listing in which each player beat the next.

Show the answer

Wins: 11 has 33, 22 has 33, 33 has 33, 44 has 22, 55 has 22, 66 has 22. Player 11 has the most wins, so it is a king: it beat 2,3,42, 3, 4 directly, and reaches 55 and 66 through 22 (who beat both). A Hamiltonian listing: 1,2,3,4,5,61, 2, 3, 4, 5, 6 works directly — 11 beat 22, 22 beat 33, 33 beat 44, 44 beat 55, 55 beat 66.