Olympiad Combinatorics

Study Sheet

Olympiad Combinatorics

Invariants, extremal arguments, double counting, graphs

Existence and Impossibility

Tip
Invariants and monovariants

To prove a process can never reach a state, find a quantity it preserves (parity, a sum mod mm, a coloring count) that differs between start and goal. To prove it terminates, find a monovariant — an integer quantity that strictly decreases. The 1..2026 difference game: the parity of the sum is invariant and odd, so the last number is odd — at least 11.

Tip
Extremal principle and pigeonhole

Look at the largest, smallest, or closest object — extremeness forces structure. Pigeonhole with kn+1kn + 1 objects in nn boxes forces k+1k + 1 together; the generalized and infinite versions and "pigeonhole on residues" cover a huge fraction of olympiad existence proofs.

Tip
Double counting and graphs

Count incidences two ways to derive an identity or inequality (the handshake lemma is the prototype). Graph theory: degree sums, trees have n−1n - 1 edges, bipartite iff no odd cycle, Mantel/Turán bound edges without a triangle (≤n2/4\le n^2/4; 2525 for n=10n = 10). Model the problem as a graph the moment "pairs" or "relations" appear.

Double Counting in Full

Theorem
Count one set two ways

Let S\mathcal S be a set of pairs (element, set), (vertex, edge), (point, line), and so on. Counting S\mathcal S by its first coordinates and by its second gives the same number: ∑xd(x)=∑Y∣Y∣\sum_x d(x) = \sum_Y |Y|. When one side can only be bounded, the equation becomes an inequality, and convexity finishes: since x↦(x2)x \mapsto \binom x2 is convex, ∑i=1n(di2)≥n(dˉ2)\sum_{i=1}^n\binom{d_i}{2} \ge n\binom{\bar d}{2} where dˉ\bar d is the average of the did_i.

Write the incidences as a 0/10/1 matrix with a row for each xx and a column for each YY. The total number of 11s is the sum of the row sums and also the sum of the column sums; that is all double counting is. Its power is in choosing S\mathcal S: count the objects the problem cares about (triangles, common neighbours, pairs of committee members) through something you can control on the other side. The convexity step is Jensen for f(x)=x(x−1)2f(x) = \tfrac{x(x - 1)}{2}, whose second derivative is 1>01 > 0; it turns a sum of (di2)\binom{d_i}{2} into a statement about the average degree alone.

Example
Example 1: the total size of all subsets

Compute ∑A⊆{1,…,n}∣A∣\sum_{A \subseteq \{1, \ldots, n\}} |A|.

Count pairs (x,A)(x, A) with x∈Ax \in A. Grouped by AA, the count is the requested sum. Grouped by xx: each element lies in exactly 2n−12^{n-1} subsets (the other n−1n - 1 elements are free). So the sum is n 2n−1n\,2^{n-1}; for n=5n = 5 it is 8080. A check from the other side: sizes 0,…,50, \ldots, 5 occur 1,5,10,10,5,11, 5, 10, 10, 5, 1 times, and 0+5+20+30+20+5=800 + 5 + 20 + 30 + 20 + 5 = 80.

How to find it. A sum over sets of a size is a count of (element, set) memberships. Swap the order of summation.

Example
Example 2: cyclic triangles in a tournament

In a tournament (every pair of nn players plays once, no draws) player ii has sis_i wins. Prove that the number of cyclic triangles (aa beats bb beats cc beats aa) is (n3)−∑i(si2)\binom n3 - \sum_i\binom{s_i}{2}. For n=7n = 7, what is the largest possible number?

Step 1 — a triangle that is not cyclic is transitive, and a transitive triangle has exactly one player who beat both others. So count pairs (player, two players she beat): grouped by player, there are ∑i(si2)\sum_i\binom{s_i}{2}; grouped by triangle, every transitive triangle contributes exactly 11 and every cyclic one 00. Hence the number of transitive triangles is ∑(si2)\sum\binom{s_i}{2} and the rest, (n3)−∑(si2)\binom n3 - \sum\binom{s_i}2, are cyclic.

Step 2 — the sis_i sum to (n2)\binom n2 (each game produces one win), so their average is n−12\tfrac{n - 1}{2}. By convexity ∑(si2)≥n((n−1)/22)\sum\binom{s_i}{2} \ge n\binom{(n-1)/2}{2}. For n=7n = 7 the average is 33, so ∑(si2)≥7⋅3=21\sum\binom{s_i}2 \ge 7\cdot3 = 21 and there are at most 35−21=1435 - 21 = 14 cyclic triangles.

Step 3 — the bound is attained: seat the players around a circle and let each beat the next three clockwise. Everyone has 33 wins, so exactly 1414 triangles are cyclic.

How to find it. Cyclic triangles are hard to count; transitive ones have a distinguished vertex. Count the complement through the vertex that makes it special.

Example
Example 3: no four-cycle means few edges

A graph on nn vertices contains no 44-cycle. Prove that it has at most n4(1+4n−3)\tfrac n4\left(1 + \sqrt{4n - 3}\right) edges. (Reiman, 1958.)

Step 1 — count “cherries”: triples (w,{u,v})(w, \{u, v\}) with u,vu, v distinct neighbours of ww. Grouped by ww, there are ∑w(dw2)\sum_w\binom{d_w}{2}.

Step 2 — grouped by the pair {u,v}\{u, v\}: two distinct vertices w,w′w, w' both adjacent to uu and vv would give the 44-cycle u w v w′u\,w\,v\,w'. So each pair has at most one common neighbour, and ∑w(dw2)≤(n2)\sum_w\binom{d_w}{2} \le \binom n2.

Step 3 — with ee edges the average degree is 2en\tfrac{2e}{n}, and convexity gives n(2e/n2)≤(n2)n\binom{2e/n}{2} \le \binom n2, i.e. 2en(2en−1)≤n−1\tfrac{2e}{n}\left(\tfrac{2e}{n} - 1\right) \le n - 1. Multiply by n2n^2: 4e2−2en−n2(n−1)≤04e^2 - 2en - n^2(n - 1) \le 0. The larger root of this quadratic in ee is 2n+4n2+16n2(n−1)8=n4(1+4n−3)\tfrac{2n + \sqrt{4n^2 + 16n^2(n - 1)}}{8} = \tfrac n4\left(1 + \sqrt{4n - 3}\right), so ee is at most that. ■\blacksquare For n=10n = 10 the bound is 104(1+37)≈17.7\tfrac{10}{4}(1 + \sqrt{37}) \approx 17.7, so at most 1717 edges.

How to find it. A forbidden subgraph with two paths of length two between the same ends: count paths of length two. The forbidden structure is exactly a statement about the other side of the count.

Side note
Where it goes wrong
12345
Each player beats the next two clockwise: every transitive triangle has one top and one bottom.

In Example 2 it is tempting to count transitive triangles by both their top and bottom players: ∑(si2)\sum\binom{s_i}{2} tops plus ∑(n−1−si2)\sum\binom{n - 1 - s_i}{2} bottoms. For the five-player tournament in which each player beats the next two around a circle, that gives 5+5=105 + 5 = 10 “transitive triangles” — all (53)=10\binom53 = 10 of them — predicting no cyclic triangles. Yet 11 beats 33, 33 beats 44 and 44 beats 11: that triangle is cyclic, and in fact 10−5=510 - 5 = 5 of the triangles are. The error: every transitive triangle has one top AND one bottom, so the second sum counts each of them again. Decide before counting what each object contributes, and make it exactly one.

Try it
Try it: committees

Fifty people form 3030 committees of 55 members each. Prove that someone serves on at least 33 committees.

Show the answer

Count (person, committee) memberships: by committees there are 30⋅5=15030\cdot5 = 150; by people it is the sum of the 5050 numbers of committees per person. Their average is 15050=3\tfrac{150}{50} = 3, and some number is at least the average. (If everyone served on at most 22, the total would be at most 100<150100 < 150.)

Graphs as Models: Ramsey Arguments

Theorem
Monochromatic triangles are forced

If the 1515 edges of K6K_6 are colored red and blue, some triangle has all three edges the same color; K5K_5 can be colored with none. In symbols, R(3,3)=6R(3, 3) = 6. With three colors, every coloring of K17K_{17} has a monochromatic triangle.

Pick a vertex vv of K6K_6. Of its 55 edges, at least 33 share a color — pigeonhole, 5=2⋅2+15 = 2\cdot2 + 1 — say red edges to a,b,ca, b, c. If any edge among a,b,ca, b, c is red, it closes a red triangle with vv; if none is, abcabc is a blue triangle. For K5K_5, color the five sides of a pentagon red and the five diagonals blue: each color class is a 55-cycle, and a 55-cycle has no triangle. The same step with three colors: a vertex of K17K_{17} has 16=3⋅5+116 = 3\cdot5 + 1 edges, so 66 share a color; either that color appears among the 66 neighbours (a triangle) or they span a K6K_6 in two colors.

Example
Example 1: the pentagon coloring is the only obstruction
Red sides (solid) and blue diagonals (dashed): each color is a 5-cycle, with no triangle.

Show that in any two-coloring of K5K_5 with no monochromatic triangle, every vertex has exactly two red and two blue edges, and each color class is a 55-cycle.

Step 1 — if a vertex vv had three edges of one color, say red to a,b,ca, b, c, the argument of the box gives a red triangle through vv or a blue triangle abcabc. So each vertex has at most two edges of each color, and with four edges, exactly two of each.

Step 2 — the red graph is then 22-regular on 55 vertices: a union of cycles covering all vertices. A triangle is forbidden, and a 55-vertex 22-regular graph without a 33-cycle cannot split as 3+23 + 2 (no 22-cycles exist), so it is a single 55-cycle. The blue graph is its complement, also a 55-cycle. ■\blacksquare

How to find it. Run the proof of R(3,3)≤6R(3, 3) \le 6 backwards: every inequality in it must be tight, and tightness pins the structure.

Example
Example 2: at least two monochromatic triangles

Prove that every red/blue coloring of the edges of K6K_6 has at least two monochromatic triangles. (Goodman.)

Step 1 — call a pair of edges at a common vertex a bichromatic angle if they have different colors. A vertex with rr red and 5−r5 - r blue edges carries r(5−r)≤2⋅3=6r(5 - r) \le 2\cdot3 = 6 bichromatic angles, so there are at most 6⋅6=366\cdot6 = 36 in all.

Step 2 — count the same angles by triangles. A monochromatic triangle contains none; a triangle with two edges of one color and one of the other contains exactly 22 (at the two ends of the odd edge). So twice the number of non-monochromatic triangles is at most 3636: at most 1818 of them.

Step 3 — K6K_6 has (63)=20\binom63 = 20 triangles, so at least 20−18=220 - 18 = 2 are monochromatic. ■\blacksquare The bound is sharp: color K3,3K_{3,3} red and the two remaining triangles blue.

How to find it. Monochromatic triangles are what you want; bichromatic angles are what you can count at a vertex. Relate the two by counting angles triangle by triangle.

Example
Example 3: three colors on seventeen vertices

Seventeen scientists correspond pairwise, each pair about exactly one of three topics. Prove that some three of them correspond pairwise about the same topic. (IMO 1964/4.)

Step 1 — model: vertices are scientists, edges colored by topic, a 33-coloring of K17K_{17}. Fix a scientist vv. Her 1616 edges carry three colors, so some color, say topic 11, is used at least ⌈16/3⌉=6\lceil 16/3\rceil = 6 times, to w1,…,w6w_1, \ldots, w_6.

Step 2 — if two of the wiw_i correspond about topic 11, they form a topic-11 triangle with vv.

Step 3 — otherwise all (62)=15\binom62 = 15 edges among w1,…,w6w_1, \ldots, w_6 use only topics 22 and 33: a two-coloring of K6K_6, which by the box contains a monochromatic triangle. ■\blacksquare (Sixteen scientists are not enough: a 33-coloring of K16K_{16} without a monochromatic triangle exists — Greenwood and Gleason, 1955.)

How to find it. Reduce the number of colors by one: a large monochromatic neighbourhood either closes a triangle in that color or is a smaller Ramsey problem in the remaining colors.

Side note
Where it goes wrong

“Among 55 people there are 33 mutual acquaintances or 33 mutual strangers — proof: a person knows or does not know each of the other 44, so two of those relations are the same, and ...” The pigeonhole step gives only ⌈4/2⌉=2\lceil 4/2\rceil = 2 edges of one color at a vertex, and two edges never force a triangle. The statement itself is false: the pentagon-and-pentagram coloring of K5K_5 has no monochromatic triangle. Pigeonhole must produce three same-colored edges, which is why the threshold is 66.

Try it
Try it: Goodman for seven

Show that every red/blue coloring of K7K_7 has at least 44 monochromatic triangles.

Show the answer

A vertex with rr red and 6−r6 - r blue edges has r(6−r)≤9r(6 - r) \le 9 bichromatic angles, so there are at most 7⋅9=637\cdot9 = 63. Each non-monochromatic triangle contains exactly 22, so there are at most ⌊63/2⌋=31\lfloor 63/2\rfloor = 31 of them. Out of (73)=35\binom73 = 35 triangles, at least 35−31=435 - 31 = 4 are monochromatic.