Extremal Graph Theory and Ramsey Theory

Study Sheet

Extremal Graph Theory and Ramsey Theory

How many edges force a triangle, and why complete disorder is impossible

Mantel's Theorem

Concept
Triangle-free graphs and the n2/4n^2/4 bound

The Turán number ex⁡(n,K3)\operatorname{ex}(n, K_3) is the maximum number of edges a triangle-free graph on nn vertices can have. Mantels Theorem:

ex⁡(n,K3)=⌊n24⌋,\operatorname{ex}(n, K_3) = \left\lfloor \frac{n^2}{4} \right\rfloor,

attained by the complete bipartite graph K⌈n/2⌉,⌊n/2⌋K_{\lceil n/2\rceil, \lfloor n/2\rfloor} and, up to which vertices land on which side, only by it.

A complete bipartite graph is automatically triangle-free, since a bipartite graph has no odd cycle at all (Topic 7, Bipartite Graphs and Odd Cycles) and a triangle is a 33-cycle; the content of the theorem is that this costs almost nothing in edges. Mantels theorem says the densest triangle-free graph is not some clever irregular construction but exactly this simplest one, split as evenly as possible. The bound also runs as a guarantee: any graph with more than ⌊n2/4⌋\lfloor n^2/4\rfloor edges, however it is built, is FORCED to contain a triangle somewhere, whether or not that triangle was intended. This is the first theorem of extremal graph theory, the subject of trading a forbidden pattern for a maximum edge count, and Turáns theorem next generalizes it from triangles to any larger clique.

Example
Six vertices: the bound and its graph
m1m2m3e1e2e3
K3,3K_{3,3}: triangle-free, 99 edges, meeting Mantels bound for n=6n=6.

For n=6n=6, Mantels bound is ⌊36/4⌋=9\lfloor 36/4\rfloor = 9. The complete bipartite graph K3,3K_{3,3} (parts of size 3,33,3) realizes it exactly: it is triangle-free, since it is bipartite, and ∣E∣=3⋅3=9|E| = 3\cdot3 = 9.

Example
Five vertices: an uneven split
m1m2e1e2e3
K2,3K_{2,3}: triangle-free, 66 edges, meeting Mantels bound for n=5n=5.

For n=5n=5 the bound is ⌊25/4⌋=6\lfloor 25/4 \rfloor = 6 — rounding down, since 55 splits unevenly. K2,3K_{2,3} realizes it: triangle-free, with ∣E∣=2⋅3=6|E| = 2\cdot3=6. Splitting 55 as 11 and 44 instead gives only 1⋅4=41\cdot4=4 edges, so the BALANCED split is what matters, not merely bipartiteness; K1,4K_{1,4} is triangle-free too but far from extremal.

Example
A genuine problem: is 1313 edges on 77 vertices possible, triangle-free?

Could a triangle-free graph on 77 vertices have 1313 edges? Mantels bound is ⌊49/4⌋=12\lfloor49/4\rfloor = 12, so 13>1213 > 12 is impossible: any graph on 77 vertices with 1313 edges, however it is drawn, must contain a triangle. The bound 1212 itself IS attainable, by K3,4K_{3,4}: 3⋅4=123\cdot4=12.

Side note
Where it goes wrong

Mantels theorem bounds a triangle-free graphs edges from ABOVE; it says nothing about a lower bound. The empty graph on any nn vertices has 00 edges and is triangle-free, nowhere near ⌊n2/4⌋\lfloor n^2/4\rfloor, and so is any tree, with only n−1n-1 edges (Topic 4). The bound is a ceiling that the balanced complete bipartite graph alone reaches, not a floor every triangle-free graph must clear.

Try it
Try it: eight vertices

Find the maximum number of edges a triangle-free graph on 88 vertices can have, and a graph achieving it.

Show the answer

Mantels bound is ⌊64/4⌋=16\lfloor64/4\rfloor=16, attained by the balanced complete bipartite graph K4,4K_{4,4}: bipartite, hence triangle-free, with ∣E∣=4⋅4=16|E|=4\cdot4=\mathbf{16}.

Turán's Theorem

Concept
Forbidding a bigger clique: the Turán graph

For r≥2r \ge 2, the Turán graph T(n,r)T(n,r) is the complete rr-partite graph on nn vertices whose parts are as equal as possible (sizes ⌈n/r⌉\lceil n/r\rceil or ⌊n/r⌋\lfloor n/r\rfloor). Turáns Theorem: ex⁡(n,Kr+1)=e(T(n,r))\operatorname{ex}(n, K_{r+1}) = e(T(n,r)) — among all Kr+1K_{r+1}-free graphs on nn vertices, T(n,r)T(n,r) has the most edges, and it is the unique graph that does.

Mantels theorem is exactly the case r=2r=2: T(n,2)T(n,2) is the balanced complete bipartite graph, and forbidding K3K_3 is forbidding K2+1K_{2+1}. The same picture scales up: a complete rr-partite graph can never contain Kr+1K_{r+1}, since any r+1r+1 vertices must have two in the same part, and vertices in the same part are never adjacent — so the upper bound on cliques is automatic, and the content of the theorem is that this many-parts construction is also the DENSEST way to avoid Kr+1K_{r+1}. As rr grows, more and larger cliques are allowed, the parts can shrink, and T(n,r)T(n,r) gets denser; letting rr grow without bound recovers nearly all of (n2)\binom{n}{2} edges, since forbidding only an enormous clique barely restricts a graph at all.

Example
Nine vertices, forbidding K4K_4

How many edges can a K4K_4-free graph on 99 vertices have? Here r=3r=3 (forbidding Kr+1=K4K_{r+1}=K_4), and 99 splits evenly into three parts of size 33. T(9,3)T(9,3) has (32)=3\binom{3}{2}=3 pairs of parts, each pair contributing 3⋅3=93\cdot3=9 cross edges, for e(T(9,3))=3⋅9=27e(T(9,3)) = 3\cdot9 = 27.

Example
Ten vertices, forbidding K4K_4: an uneven split

For n=10n=10, r=3r=3, the parts cannot be equal: 10=4+3+310 = 4+3+3. Counting edges between every pair of parts, e(T(10,3))=4⋅3+4⋅3+3⋅3=12+12+9=33e(T(10,3)) = 4\cdot3 + 4\cdot3 + 3\cdot3 = 12+12+9 = 33. Equivalently, e(T(n,r))=(n2)−∑i(ni2)e(T(n,r)) = \binom{n}{2} - \sum_i \binom{n_i}{2} (total pairs, minus the pairs lost inside each part): (102)−[(42)+(32)+(32)]=45−[6+3+3]=33\binom{10}{2} - \left[\binom{4}{2}+\binom{3}{2}+\binom{3}{2}\right] = 45 - [6+3+3] = 33, the same answer.

Example
A genuine problem: the densest K4K_4-free graph on 77 vertices
a1a2a3b1b2c1c2
T(7,3)T(7,3): parts of size 3,2,23,2,2, 1616 edges, no K4K_4.

What is ex⁡(7,K4)\operatorname{ex}(7, K_4), and what does the extremal graph look like? With r=3r=3, 77 splits as 3+2+23+2+2. The complete 33-partite graph on parts of size 3,2,23,2,2 has 3⋅2+3⋅2+2⋅2=6+6+4=163\cdot2 + 3\cdot2 + 2\cdot2 = 6+6+4=16 edges; checking with the other formula, (72)−[(32)+(22)+(22)]=21−[3+1+1]=16\binom{7}{2} - \left[\binom{3}{2}+\binom{2}{2}+\binom{2}{2}\right] = 21 - [3+1+1] = 16. So ex⁡(7,K4)=16\operatorname{ex}(7,K_4) = 16, realized by T(7,3)T(7,3) with parts 3,2,23,2,2.

Side note
Where it goes wrong

Confusing which clique T(n,r)T(n,r) forbids. T(n,r)T(n,r) has rr PARTS and forbids Kr+1K_{r+1}, one size larger — Mantels r=2r=2 forbids K3K_3, not K2K_2 (an edge). Using rr parts to bound ex⁡(n,Kr)\operatorname{ex}(n,K_r) instead of ex⁡(n,Kr+1)\operatorname{ex}(n,K_{r+1}) is the single most common index slip with this theorem; always check the forbidden clique is exactly one bigger than the part count.

Try it
Try it: twelve vertices, forbidding K5K_5

Find ex⁡(12,K5)\operatorname{ex}(12, K_5).

Show the answer

Forbidding K5=Kr+1K_5=K_{r+1} means r=4r=4, and 1212 splits evenly into four parts of size 33. There are (42)=6\binom{4}{2}=6 pairs of parts, each contributing 3⋅3=93\cdot3=9 edges, so ex⁡(12,K5)=6⋅9=54\operatorname{ex}(12,K_5) = 6\cdot9 = \mathbf{54}.

Ramsey Numbers and R(3,3)=6R(3,3)=6

Concept
Ramsey numbers

Color every edge of the complete graph KnK_n either red or blue. The Ramsey number R(s,t)R(s,t) is the smallest nn such that EVERY such 22-coloring contains a red KsK_s or a blue KtK_t (a set of ss vertices joined entirely in red, or tt vertices joined entirely in blue). Theorem: R(3,3)=6R(3,3) = 6.

Extremal graph theory, in Mantel and Turán, asked how many EDGES force a pattern inside one graph. Ramsey theory asks a different question: how many VERTICES force a pattern, no matter how the edges of a complete graph are split into two colors. The two subjects meet directly here: a red-triangle-free coloring makes the red graph itself triangle-free, so Mantels theorem caps how much "red" a coloring can have before it is forced to yield — though, as the examples below show, that cap alone is not sharp enough to pin down R(3,3)R(3,3) exactly. R(3,3)=6R(3,3)=6 needs two separate halves: a coloring of K5K_5 avoiding both colors triangles (showing R(3,3)>5R(3,3) > 5), and a proof that K6K_6 never avoids them (showing R(3,3)≤6R(3,3) \le 6).

Example
A coloring of K5K_5 with no monochromatic triangle
12345
Bold (red) pentagon, thin (blue) pentagram: no monochromatic triangle in K5K_5.

Color the 55-cycle 1-2-3-4-5-11\text{-}2\text{-}3\text{-}4\text{-}5\text{-}1 red and the five remaining "diagonal" edges (13,24,35,41,5213,24,35,41,52) blue — a red pentagon and a blue pentagram. Every triangle on 33 of the 55 vertices uses a mix: checking all (53)=10\binom{5}{3}=10 triples, each one turns out to use at least one red edge and at least one blue edge, so none is monochromatic. This single coloring proves R(3,3)>5R(3,3) > 5.

Example
A genuine problem: why does K6K_6 always have one?

Take any 22-coloring of K6K_6 and any vertex vv; it has 55 edges to the other vertices, so by pigeonhole at least 33 are the same color, say red, to vertices a,b,ca,b,c. If any edge among a,b,ca,b,c is red, that edge together with vvs two red edges to its endpoints is a red triangle. If NONE of ab,ac,bcab,ac,bc is red, all three are blue, and a,b,ca,b,c is itself a blue triangle. Either way K6K_6 has a monochromatic triangle — and since vv and the coloring were arbitrary, this holds for EVERY 22-coloring of K6K_6, proving R(3,3)≤6R(3,3) \le 6.

Example
Applying the argument to a specific coloring
123456
Bold (red) edges join same-parity vertices: two monochromatic triangles, {1,3,5}\{1,3,5\} and {2,4,6}\{2,4,6\}.

Color {1,…,6}\{1,\ldots,6\} by parity: edge {i,j}\{i,j\} is red if i+ji+j is even (both odd or both even), blue if i+ji+j is odd. From vertex 11 (odd), the edges to 3,53,5 (odd) are red and to 2,4,62,4,6 (even) are blue — 33 blue edges, matching the pigeonhole argument with blue in place of red. Checking the three edges among 2,4,62,4,6: 2+4,2+6,4+62+4,2+6,4+6 are all even, so ALL THREE are red, not blue — so the triangle forced is not among {2,4,6}\{2,4,6\} in blue, but the arguments other case applies directly to {2,4,6}\{2,4,6\} itself as a monochromatic RED triangle. (The same reasoning finds the red triangle 1,3,51,3,5 directly: 1+3,1+5,3+51+3,1+5,3+5 are all even.)

Side note
Where it goes wrong

Proving only one half of the equality. The K5K_5 coloring above shows R(3,3)>5R(3,3) > 5, and the pigeonhole argument shows R(3,3)≤6R(3,3) \le 6 — BOTH are needed to conclude R(3,3)=6R(3,3) = 6 exactly. A coloring avoiding monochromatic triangles on 55 vertices does not, by itself, say anything about 66 vertices; and the pigeonhole argument for K6K_6 does not, by itself, rule out some cleverer coloring of K5K_5 working too (it does not, but that needs the explicit construction to settle).

Try it
Try it: friends and strangers

At a party of 66 people, is it guaranteed that some 33 are mutual friends or some 33 are mutual strangers?

Show the answer

Model the party as K6K_6, coloring each edge red for "friends" and blue for "strangers." Since R(3,3)=6R(3,3)=6, every 22-coloring of K6K_6 contains a monochromatic triangle: either 33 mutual friends (red) or 33 mutual strangers (blue). **Yes** — guaranteed, for any 66 people (and this is the smallest party size for which it is guaranteed, since the pentagon-pentagram coloring shows 55 people are not enough).

Bounds on Ramsey Numbers

Concept
The Erdős–Szekeres recursion
vr1r2r3b1b2b3
Schematic (not to scale): vvs edges split into a red group and a blue group.

For s,t≥2s,t\ge2,

R(s,t)≤R(s−1,t)+R(s,t−1),R(s,t) \le R(s-1,t) + R(s,t-1),

with base cases R(s,2)=sR(s,2)=s and R(2,t)=tR(2,t)=t for all s,t≥2s,t\ge2. Unrolling the recursion with Pascals identity gives the closed form

R(s,t)≤(s+t−2s−1).R(s,t) \le \binom{s+t-2}{s-1}.

This is the pigeonhole argument from R(3,3)=6R(3,3)=6, generalized: a vertex vv in KnK_n has n−1n-1 other vertices, and if n−1≥R(s−1,t)+R(s,t−1)−1n-1 \ge R(s-1,t)+R(s,t-1)-1 then vv has either R(s−1,t)R(s-1,t) red neighbors or R(s,t−1)R(s,t-1) blue neighbors (Why It Works spells out why one of the two must happen). Red neighbors that size already force a red Ks−1K_{s-1} or a blue KtK_t among themselves, and adding vv to a red Ks−1K_{s-1} among its red neighbors gives a red KsK_s; the blue case is symmetric. The base cases say almost nothing (KsK_s-free needs no blue at all when t=2t=2, since a single blue edge already IS a blue K2K_2), yet bootstrapping them through the recursion already pins down several exact values, as the examples show — though, as with Mantel versus Turáns better bound, a recursive bound built from WEAK sub-bounds is itself weak, while one built from exact known values can land exactly on the truth.

Example
Bounding R(3,4)R(3,4)

Apply the recursion with s=3,t=4s=3,t=4: R(3,4)≤R(2,4)+R(3,3)=4+6=10R(3,4) \le R(2,4) + R(3,3) = 4 + 6 = 10. (The true value, found by exhaustive search, is R(3,4)=9R(3,4)=9 — the recursive bound is correct but not sharp here.)

Example
Bounding R(3,5)R(3,5), and landing on the truth

With s=3,t=5s=3,t=5: R(3,5)≤R(2,5)+R(3,4)=5+9=14R(3,5) \le R(2,5) + R(3,4) = 5 + 9 = 14, using the already-established R(3,4)=9R(3,4)=9 rather than the cruder base-case bound. This time the bound is exact: R(3,5)=14R(3,5)=14.

Example
A genuine problem: bounding R(4,4)R(4,4) from R(3,4)R(3,4)

Bound R(4,4)R(4,4) using R(3,4)=9R(3,4)=9 (established above) on both sides of the recursion: R(4,4)≤R(3,4)+R(4,3)=9+9=18R(4,4) \le R(3,4) + R(4,3) = 9+9=18, since R(4,3)=R(3,4)R(4,3)=R(3,4) by symmetry of the definition (swapping the roles of red and blue swaps ss and tt). This again lands exactly on the known value, R(4,4)=18R(4,4)=18. Compare the crude binomial bound ignoring any improved sub-values: (4+4−24−1)=(63)=20\binom{4+4-2}{4-1} = \binom{6}{3} = 20 — weaker than 1818, since it never uses the fact that R(3,4)R(3,4) is 99 rather than the base-case estimate of 1010.

Side note
Where it goes wrong

Misremembering the recursion as R(s,t)≤R(s−1,t)+R(s−1,t−1)R(s,t) \le R(s-1,t) + R(s-1,t-1), decreasing BOTH arguments in the second term. The correct split decreases only the term that actually shrinks — vvs red neighbors still need to avoid a blue KtK_t, not a blue Kt−1K_{t-1}, since vv itself is not one of them. The wrong recursion on R(4,4)R(4,4) gives R(3,4)+R(3,3)=9+6=15R(3,4)+R(3,3) = 9+6=15, strictly LESS than the true value 1818 — an impossible upper bound, which exposes the error immediately.

Try it
Try it: bounding R(3,6)R(3,6)

Use the recursion, together with R(3,5)=14R(3,5)=14, to bound R(3,6)R(3,6).

Show the answer

With s=3,t=6s=3,t=6: R(3,6)≤R(2,6)+R(3,5)=6+14=20R(3,6) \le R(2,6) + R(3,5) = 6 + 14 = \mathbf{20}. (The true value is R(3,6)=18R(3,6)=18, so the bound is valid but not sharp.)

The Probabilistic Method

Concept
The first moment method

To prove some object with a property exists, it suffices to build a RANDOM object and show the expected number of "bad" events is less than 11 — since a random variable that is always a non-negative integer and averages below 11 must sometimes equal 00. Applied to Ramsey numbers: color each edge of KnK_n red or blue independently with probability 12\tfrac12 each. Any fixed set of kk vertices is monochromatic with probability 2⋅(12)(k2)=21−(k2)2\cdot(\tfrac12)^{\binom{k}{2}} = 2^{1-\binom k2} (all (k2)\binom k2 of its edges must match, in either color), so the EXPECTED number of monochromatic kk-sets is

(nk)21−(k2).\binom{n}{k}2^{1-\binom k2}.

If this is less than 11, some coloring of KnK_n has zero monochromatic kk-sets, so R(k,k)>nR(k,k) > n.

This is a completely different kind of argument from the last two sections: Mantel, Turán and the pigeonhole bound all built or analyzed one SPECIFIC object by hand, while this method proves an object exists without ever producing it — a strange kind of existence proof, but a rigorous one. It trades the impossible task of checking every one of the 2(n2)2^{\binom n2} colorings for the much easier task of computing one average over all of them. The price is that the resulting bound is usually far from sharp, since it only asks whether the AVERAGE bad count is small, not whether some coloring achieves the best possible count; as the examples show, it can even fail to recover the exact truth already found by the explicit K5K_5 coloring in Ramsey Numbers and R(3,3)=6R(3,3)=6.

Example
Does the method even apply to R(3,3)R(3,3)?
12345
The pentagon/pentagram coloring the first moment method, at n=5n=5, cannot find.

Try n=5n=5, k=3k=3: the expected number of monochromatic triangles is (53)21−(32)=10⋅2−2=2.5\binom{5}{3}2^{1-\binom32} = 10\cdot2^{-2} = 2.5, which is NOT less than 11. The method gives no conclusion here — it cannot rule out that every coloring of K5K_5 has a monochromatic triangle, even though Ramsey Numbers and R(3,3)=6R(3,3)=6 already exhibited one that does not. A high expectation does not mean every outcome is bad; it only means this particular argument is too weak to see the good one.

Example
A genuine problem: the largest nn the method gives for R(4,4)R(4,4)

For k=4k=4, the expected count is (n4)21−(42)=(n4)⋅2−5=(n4)/32\binom{n}{4}2^{1-\binom42} = \binom n4\cdot2^{-5} = \binom n4/32. Check n=6n=6: (64)/32=15/32<1\binom64/32 = 15/32 < 1 — the method succeeds, giving R(4,4)>6R(4,4) > 6. Check n=7n=7: (74)/32=35/32>1\binom74/32 = 35/32 > 1 — it fails at 77. So n=6n=6 is the largest this argument reaches, proving R(4,4)≥7R(4,4) \ge 7. (Recall from Bounds on Ramsey Numbers that the true value is R(4,4)=18R(4,4)=18 — this methods bound is correct but very far from sharp.)

Example
The same bound for R(5,5)R(5,5)

For k=5k=5: expected count =(n5)⋅21−(52)=(n5)⋅2−9=(n5)/512= \binom n5\cdot2^{1-\binom52} = \binom n5\cdot2^{-9} = \binom n5/512. At n=11n=11: (115)/512=462/512<1\binom{11}{5}/512 = 462/512 < 1, succeeding. At n=12n=12: (125)/512=792/512>1\binom{12}{5}/512 = 792/512 > 1, failing. So the method gives R(5,5)>11R(5,5) > 11, i.e. R(5,5)≥12R(5,5) \ge 12 — again correct but weak (the best known bounds place the true value far higher).

Side note
Where it goes wrong

Treating "expectation ≥1\ge 1" as proof that a monochromatic clique always occurs. The first moment method is a ONE-WAY tool: expectation <1<1 guarantees a good coloring exists, but expectation ≥1\ge 1 (as in the n=5,k=3n=5,k=3 case above) proves nothing either way. It is also easy to forget that this method proves existence WITHOUT construction — unlike the explicit pentagon coloring, it gives no recipe for which coloring of K6K_6 avoids a monochromatic K4K_4, only a guarantee that at least one does.

Try it
Try it: the bound for R(6,6)R(6,6)

For k=6k=6, the expected number of monochromatic 66-sets in a random coloring of KnK_n is (n6)⋅21−(62)=(n6)/214\binom n6\cdot2^{1-\binom62} = \binom n6/2^{14}. Find the largest nn for which this is less than 11, and the resulting bound on R(6,6)R(6,6).

Show the answer

214=163842^{14}=16384. At n=17n=17: (176)=12376<16384\binom{17}{6} = 12376 < 16384, succeeding. At n=18n=18: (186)=18564>16384\binom{18}{6}=18564 > 16384, failing. So the method gives R(6,6)>17R(6,6) > 17, i.e. R(6,6)≥18R(6,6) \ge \mathbf{18}.

Why It Works

Induct on nn. For n≤2n \le 2 there are at most ⌊n2/4⌋\lfloor n^2/4\rfloor possible edges at all (0 for n≤1n\le1, 11 for n=2n=2), so the bound holds trivially. For n≥3n \ge 3, let GG be triangle-free on nn vertices. If GG has no edges, ∣E∣=0≤⌊n2/4⌋|E|=0 \le \lfloor n^2/4\rfloor and we are done; otherwise pick an edge uvuv. Since GG is triangle-free, uu and vv have no common neighbor (a vertex adjacent to both would close a triangle with uvuv), so N(u)∩N(v)=∅N(u) \cap N(v) = \emptyset and N(u)∪N(v)⊆VN(u) \cup N(v) \subseteq V gives deg⁡(u)+deg⁡(v)=∣N(u)∪N(v)∣≤n\deg(u) + \deg(v) = |N(u) \cup N(v)| \le n. uu and vv leaves a triangle-free graph on n−2n-2 vertices, with at most ⌊(n−2)2/4⌋\lfloor(n-2)^2/4\rfloor edges by the inductive hypothesis. Every edge of GG either lies in this smaller graph, or touches uu or vv; the edges touching uu or vv number deg⁡(u)+deg⁡(v)−1\deg(u)+\deg(v)-1 (the −1-1 corrects for uvuv itself, counted in both degrees). So

∣E(G)∣≤⌊(n−2)24⌋+deg⁡(u)+deg⁡(v)−1≤(n−2)24+n−1=n24−n+1+n−1=n24.|E(G)| \le \left\lfloor\frac{(n-2)^2}{4}\right\rfloor + \deg(u)+\deg(v)-1 \le \frac{(n-2)^2}{4} + n - 1 = \frac{n^2}{4} - n + 1 + n - 1 = \frac{n^2}{4}.

Since ∣E(G)∣|E(G)| is an integer, ∣E(G)∣≤⌊n2/4⌋|E(G)| \le \lfloor n^2/4\rfloor, completing the induction. Equality forces deg⁡(u)+deg⁡(v)=n\deg(u)+\deg(v)=n and the smaller graph to be extremal at every step, which pins the graph down to the balanced complete bipartite graph.

Let GG be a Kr+1K_{r+1}-free graph on nn vertices with the MAXIMUM possible number of edges (an extremal graph); such a GG exists since there are finitely many graphs on nn vertices.

Step 1 (symmetrization). Suppose u,vu,v are non-adjacent in GG with deg⁡(v)≥deg⁡(u)\deg(v) \ge \deg(u). Form G′G\prime by deleting all of uus edges and joining uu instead to exactly N(v)N(v) (making uu a "twin" of vv). This changes the edge count by deg⁡(v)−deg⁡(u)≥0\deg(v)-\deg(u) \ge 0, so G′G\prime has at least as many edges as GG. G′G\prime stays Kr+1K_{r+1}-free: u,vu,v are still non-adjacent in G′G\prime (and so cannot both lie in one clique), so any clique of G′G\prime uses at most one of them. A clique avoiding uu entirely uses only original edges of GG restricted to V∖{u}V \setminus \{u\}, so it was already a clique of GG. A clique using uu (not vv) uses only edges from uu to N(v)N(v); replacing uu by vv in that clique uses only edges from vv to N(v)N(v), all present in GG already, so it corresponds to an equal-size clique of GG. Either way, a Kr+1K_{r+1} in G′G\prime would force one in GG, contradicting GGs Kr+1K_{r+1}-freeness. So G′G\prime is Kr+1K_{r+1}-free with at least as many edges as GG; since GG was already extremal, G′G\prime has EXACTLY as many edges, which forces deg⁡(u)=deg⁡(v)\deg(u)=\deg(v), and G′G\prime (now also extremal) may replace GG.

Step 2 (complete multipartite structure). Repeating Step 1 across every non-adjacent pair, we may assume GG itself satisfies: N(u)=N(v)N(u)=N(v) for every non-adjacent pair u,vu,v. Define u∼vu \sim v when u=vu=v or u,vu,v are non-adjacent. This is an equivalence relation: reflexive and symmetric are immediate, and if u∼v∼wu\sim v\sim w with u≠wu\ne w then N(u)=N(v)=N(w)N(u)=N(v)=N(w), and w∉N(v)=N(u)w \notin N(v)=N(u), so u,wu,w are non-adjacent too, giving u∼wu\sim w. The equivalence classes V1,…,VkV_1,\ldots,V_k are each independent sets by definition, and any two vertices in DIFFERENT classes are adjacent (else they would be ∼\sim-related into the same class). So GG is complete kk-partite. Since Kr+1K_{r+1}-free, k≤rk \le r (choosing one vertex from each of r+1r+1 distinct parts, if k≥r+1k\ge r+1, would give a Kr+1K_{r+1}, as all cross-pairs are edges).

Step 3 (balance the parts). Among complete multipartite graphs on nn vertices with at most rr parts, the edge count is (n2)−∑i(ni2)\binom n2 - \sum_i\binom{n_i}2, maximized by minimizing ∑i(ni2)\sum_i \binom{n_i}2. Using exactly rr parts beats fewer (splitting one part into two never-connected pieces only removes the (ni2)\binom{n_i}2 term for edges that did not exist, while every other part still gains a partner, so it strictly helps once k<rk<r, unless some ni=0n_i=0, treated as using fewer parts than allowed). If two parts have sizes differing by ≥2\ge 2, say ni≥nj+2n_i \ge n_j+2, moving one vertex from part ii to part jj changes (ni2)+(nj2)\binom{n_i}2+\binom{n_j}2 by −(ni−1)+nj=nj−ni+1≤−1<0-(n_i-1)+n_j = n_j-n_i+1 \le -1 < 0, strictly decreasing the sum and so strictly increasing the edge count — contradicting extremality unless the parts are already balanced, differing by at most 11. So the extremal complete multipartite graph has exactly rr parts, sizes ⌈n/r⌉\lceil n/r\rceil or ⌊n/r⌋\lfloor n/r\rfloor: this is exactly T(n,r)T(n,r), and e(G)=e(T(n,r))e(G) = e(T(n,r)).

Two halves. R(3,3)>5R(3,3) > 5: the pentagon/pentagram coloring of K5K_5 (Ramsey Numbers and R(3,3)=6R(3,3)=6) has no monochromatic triangle, so some 22-coloring of K5K_5 avoids one, meaning 55 is not large enough to force one. R(3,3)≤6R(3,3) \le 6: let vv be any vertex of any 22-colored K6K_6. It has 55 edges to the other vertices; since 5=2⋅2+15 = 2\cdot2+1, by pigeonhole at least ⌈5/2⌉=3\lceil 5/2\rceil = 3 of them share a color, say red, going to vertices a,b,ca,b,c. If some edge among a,b,ca,b,c is red, it closes a red triangle with vv. If none is, all three of ab,ac,bcab,ac,bc are blue, and a,b,ca,b,c is itself a blue triangle. Either way K6K_6 has a monochromatic triangle, and vv and the coloring were arbitrary, so EVERY 22-coloring of K6K_6 has one. Combining the two halves: 5<R(3,3)≤65 < R(3,3) \le 6, so R(3,3)=6R(3,3)=6.

Let n=R(s−1,t)+R(s,t−1)n = R(s-1,t)+R(s,t-1) and take any 22-coloring of KnK_n. Fix a vertex vv; it has n−1=R(s−1,t)+R(s,t−1)−1n-1 = R(s-1,t)+R(s,t-1)-1 other vertices, split by color into its red neighbors AA and blue neighbors BB, ∣A∣+∣B∣=n−1|A|+|B|=n-1. If ∣A∣<R(s−1,t)|A| < R(s-1,t) and ∣B∣<R(s,t−1)|B| < R(s,t-1) then ∣A∣+∣B∣≤(R(s−1,t)−1)+(R(s,t−1)−1)=n−2<n−1|A|+|B| \le (R(s-1,t)-1)+(R(s,t-1)-1) = n-2 < n-1, a contradiction; so ∣A∣≥R(s−1,t)|A|\ge R(s-1,t) or ∣B∣≥R(s,t−1)|B|\ge R(s,t-1). ∣A∣≥R(s−1,t)|A|\ge R(s-1,t). By definition of the Ramsey number, the coloring restricted to AA contains a red Ks−1K_{s-1} or a blue KtK_t. A blue KtK_t inside AA is already a blue KtK_t in the whole graph. A red Ks−1K_{s-1} inside AA, together with vv (which is joined RED to every vertex of AA), forms a red KsK_s. Either way the coloring of KnK_n has a red KsK_s or a blue KtK_t. The case ∣B∣≥R(s,t−1)|B|\ge R(s,t-1) is symmetric, swapping colors. So every 22-coloring of KnK_n has the desired clique, giving R(s,t)≤n=R(s−1,t)+R(s,t−1)R(s,t) \le n = R(s-1,t)+R(s,t-1). the binomial corollary, induct on s+ts+t. The base cases match the claimed formula: R(s,2)=s=(s+2−2s−1)=(ss−1)R(s,2)=s=\binom{s+2-2}{s-1}=\binom{s}{s-1} and R(2,t)=t=(2+t−22−1)=(t1)R(2,t)=t=\binom{2+t-2}{2-1}=\binom{t}{1}. For the inductive step, assuming R(s−1,t)≤(s+t−3s−2)R(s-1,t)\le\binom{s+t-3}{s-2} and R(s,t−1)≤(s+t−3s−1)R(s,t-1)\le\binom{s+t-3}{s-1}, the recursion just proved gives

R(s,t)≤(s+t−3s−2)+(s+t−3s−1)=(s+t−2s−1)R(s,t) \le \binom{s+t-3}{s-2}+\binom{s+t-3}{s-1} = \binom{s+t-2}{s-1}

by Pascals identity, completing the induction.

First the general principle used throughout the Probabilistic Method: if XX is a random variable taking non-negative integer values and E[X]<1\mathbb E[X] < 1, then Pr⁡[X=0]>0\Pr[X=0] > 0 — otherwise X≥1X \ge 1 always, forcing E[X]≥1\mathbb E[X]\ge1. Applied here, XX counts monochromatic kk-sets in a uniformly random 22-coloring of KnK_n; linearity of expectation over the (nk)\binom nk possible kk-sets, each monochromatic with probability 21−(k2)2^{1-\binom k2} (independently of the others coloring, though linearity needs no independence between terms), gives E[X]=(nk)21−(k2)\mathbb E[X]=\binom nk 2^{1-\binom k2} exactly as stated in the Probabilistic Method section. fix k≥3k \ge 3 and let n=⌊2k/2⌋≤2k/2n=\lfloor 2^{k/2}\rfloor \le 2^{k/2}. Since (nk)=n(n−1)⋯(n−k+1)k!≤nkk!\binom nk = \frac{n(n-1)\cdots(n-k+1)}{k!} \le \frac{n^k}{k!},

E[X]=(nk)21−(k2)≤nkk!⋅21−(k2)≤(2k/2)kk!⋅21−k(k−1)/2=2k2/2+1−k(k−1)/2k!=21+k/2k!.\mathbb E[X] = \binom nk 2^{1-\binom k2} \le \frac{n^k}{k!}\cdot2^{1-\binom k2} \le \frac{(2^{k/2})^k}{k!}\cdot2^{1-k(k-1)/2} = \frac{2^{k^2/2+1-k(k-1)/2}}{k!} = \frac{2^{1+k/2}}{k!}.

It remains to show k!>21+k/2k! > 2^{1+k/2} for every k≥3k\ge3, by induction. Base case k=3k=3: 3!=63!=6 and 21+1.5=22.5≈5.66<62^{1+1.5}=2^{2.5}\approx5.66 < 6. Inductive step: if k!>21+k/2k!>2^{1+k/2} for some k≥3k\ge3, then (k+1)!=(k+1)⋅k!>(k+1)⋅21+k/2(k+1)! = (k+1)\cdot k! > (k+1)\cdot2^{1+k/2}, and since k+1≥4>2k+1\ge4>\sqrt2, this exceeds 2⋅21+k/2=21+(k+1)/2\sqrt2\cdot2^{1+k/2} = 2^{1+(k+1)/2}, completing the induction. E[X]≤21+k/2/k!<1\mathbb E[X] \le 2^{1+k/2}/k! < 1 for every k≥3k\ge3, meaning some 22-coloring of KnK_n (for n=⌊2k/2⌋n=\lfloor2^{k/2}\rfloor) has zero monochromatic kk-sets, so R(k,k)>n≥2k/2−1R(k,k) > n \ge 2^{k/2}-1, i.e. R(k,k)>⌊2k/2⌋R(k,k) > \lfloor2^{k/2}\rfloor. This is Erdőss classical 19471947 theorem, the paper usually credited with founding the probabilistic method.