Graph Ramsey Theory

Thirteen modules, one for each chapter of a first course on graph Ramsey theory, from Ramsey's theorem to bipartite and size Ramsey numbers. Colour the edges yourself, run the random experiments, watch a random graph grow, work through an example one step at a time, then check yourself with concept questions and practice problems.

Follows the chapter order of Y. Li and Q. Lin, Elementary Methods of Graph Ramsey Theory, Applied Mathematical Sciences 211 (Springer, 2022). All thirteen chapters are covered, one module each. Chapter and exercise numbers refer to that book; the questions and examples here are written for this page.

Play it yourselfLi–Lin, Ch. 1: Existence

Ramsey's theorem

Colour every edge of K6K_6 red or blue and you cannot avoid a triangle in one colour. Ramsey's theorem says this is not a fluke: for any target, a large enough complete graph forces it. Try to beat the bound yourself before reading the proof.

The idea

Ramsey number. r(m,n)r(m,n) is the least NN such that every red/blue colouring of the edges of KNK_N contains a red KmK_m or a blue KnK_n. Equivalently, every graph on NN vertices has a clique of size mm or an independent set of size nn. More generally r(G,H)r(G,H) asks for a red GG or a blue HH, and rk(G)r_k(G) uses kk colours.
Erdős–Szekeres recursion. For m,n≥2m,n\ge 2,
r(m,n)≤r(m−1,n)+r(m,n−1),hencer(m,n)≤(m+n−2m−1).r(m,n)\le r(m-1,n)+r(m,n-1), \qquad\text{hence}\qquad r(m,n)\le\binom{m+n-2}{m-1}.

Proof in one line: a vertex vv of KNK_N with N=r(m−1,n)+r(m,n−1)N=r(m-1,n)+r(m,n-1) has N−1N-1 edges, so by pigeonhole it has at least r(m−1,n)r(m-1,n) red neighbours or at least r(m,n−1)r(m,n-1) blue ones. Inside those neighbours, the smaller Ramsey number finds what we need, and vv completes it. If both terms on the right are even the inequality is strict, by a parity argument (worked example below).

In particular r(k,k)≤(2k−2k−1)<4k−1r(k,k)\le\binom{2k-2}{k-1}<4^{k-1}. The same pigeonhole idea gives multicolour and hypergraph versions.

What is actually known. Exact values are rare: r(3,3)=6r(3,3)=6, r(3,4)=9r(3,4)=9, r(3,5)=14r(3,5)=14, r(4,4)=18r(4,4)=18, r(4,5)=25r(4,5)=25. Already r(5,5)r(5,5) is unknown: it lies between 43 and 46 (the upper bound 46 was proved with computer help in 2024; the previous bound, from 2018, was 48).

Explore

Click an edge to colour it: red, then blue, then back to uncoloured. A forbidden pattern lights up as soon as it appears.
Target
Board

Worked example

Prove r(3,4)≤9r(3,4)\le 9. (The board above has a colouring of K8K_8 with no red triangle and no blue K4K_4, so in fact r(3,4)=9r(3,4)=9.)

  1. What are r(2,4)r(2,4) and r(3,3)r(3,3), and what does the recursion give?

    r(2,n)=nr(2,n)=n: a single red edge is a red K2K_2; if there is none, all of KnK_n is blue. With r(3,3)=6r(3,3)=6 the recursion gives r(3,4)≤r(2,4)+r(3,3)=4+6=10r(3,4)\le r(2,4)+r(3,3)=4+6=10.

  2. In a colouring of K9K_9, suppose some vertex vv has at least 4 red edges. Finish the argument.

    Look at 4 red neighbours of vv. A red edge among them makes a red triangle with vv. If there is none, the 4 neighbours span a blue K4K_4.

  3. Now suppose some vertex has at least 6 blue edges.

    Among 6 blue neighbours, r(3,3)=6r(3,3)=6 gives a red triangle (done) or a blue triangle, which together with vv is a blue K4K_4.

  4. If neither case happens, every vertex has at most 3 red and at most 5 blue edges. Why is that impossible in K9K_9?

    Each vertex has 8 edges, so it has exactly 3 red and 5 blue. Then the red graph is 3-regular on 9 vertices, and its degree sum 9⋅3=279\cdot 3=27 would be odd. That is impossible, since the degree sum is twice the number of edges. So r(3,4)≤9r(3,4)\le 9.

Check your understanding

A colouring of K5K_5 has no monochromatic triangle. What must its red graph be?

  1. A 5-cycle.
  2. The complete bipartite graph K2,3K_{2,3}.K2,3K_{2,3} has no triangle, but its complement is a triangle plus an edge, so the blue graph has a triangle.
  3. Any graph with 5 edges.Count each vertex's red edges. What happens if a vertex has 3 red neighbours?
If a vertex had 3 neighbours in one colour, a same-colour edge among them makes a triangle with it, and otherwise they form a triangle in the other colour. So every vertex has exactly 2 red and 2 blue edges: the red graph is 2-regular on 5 vertices with no triangle, which leaves only C5C_5.

Using r(3,4)=9r(3,4)=9 and the recursion, what upper bound do you get for r(4,4)r(4,4)?

  1. 18
  2. 20That is the binomial bound (63)\binom{6}{3}. Feed in the known value of r(3,4)r(3,4) instead.
  3. 17The parity improvement needs both terms on the right to be even, and 9 is odd.
r(4,4)≤r(3,4)+r(4,3)=9+9=18r(4,4)\le r(3,4)+r(4,3)=9+9=18. This turns out to be the exact value: module 2 shows a colouring of K17K_{17} with no monochromatic K4K_4.

Someone exhibits a red/blue colouring of K42K_{42} with no monochromatic K5K_5. What does this prove?

  1. r(5,5)≥43r(5,5)\ge 43.
  2. r(5,5)=43r(5,5)=43.One good colouring gives only a lower bound. An upper bound needs a statement about every colouring.
  3. r(5,5)≤42r(5,5)\le 42.A colouring that avoids the pattern shows K42K_{42} is too small, not big enough.
A colouring with no monochromatic K5K_5 shows K42K_{42} does not force one, so r(5,5)>42r(5,5)>42. Lower bounds come from constructions; upper bounds come from arguments that cover all 2(N2)2^{\binom N2} colourings.

Practice

Three coloursPigeonhole once more

Show that every colouring of the edges of K17K_{17} with three colours contains a monochromatic triangle, that is, r3(3)≤17r_3(3)\le 17.

Hint

A vertex has 16 edges. At least how many share a colour?

Solution

Some colour, say colour 1, appears on at least ⌈16/3⌉=6\lceil 16/3\rceil=6 edges at a vertex vv. If two of those 6 neighbours are joined in colour 1, we have a triangle with vv. Otherwise the 6 neighbours span a K6K_6 coloured with colours 2 and 3 only, and r(3,3)=6r(3,3)=6 gives a monochromatic triangle there. (Module 2 shows 17 is exact.)

The binomial boundInduction

Deduce r(m,n)≤(m+n−2m−1)r(m,n)\le\binom{m+n-2}{m-1} from the recursion.

Hint

Induct on m+nm+n. The base cases are r(2,n)=nr(2,n)=n and r(m,2)=mr(m,2)=m. Which identity for binomial coefficients matches the recursion?

Solution

Base: (n1)=n=r(2,n)\binom{n}{1}=n=r(2,n), and similarly for r(m,2)r(m,2). Step: r(m,n)≤r(m−1,n)+r(m,n−1)≤(m+n−3m−2)+(m+n−3m−1)=(m+n−2m−1)r(m,n)\le r(m-1,n)+r(m,n-1)\le\binom{m+n-3}{m-2}+\binom{m+n-3}{m-1}=\binom{m+n-2}{m-1} by Pascal's rule.

More practice: Li–Lin, Exercises 1.2, 1.6 and 1.9.

InteractiveLi–Lin, Ch. 2: Small Ramsey Numbers

Paley graphs and small values

Upper bounds come from counting. Lower bounds need an explicit colouring, and the best small ones come from finite fields. The Paley graph on 17 vertices proves r(4,4)>17r(4,4)>17, and with the bound from module 1 that settles r(4,4)=18r(4,4)=18.

The idea

Paley graph. Let qq be a prime power with q≡1(mod4)q\equiv1\pmod 4. The Paley graph PqP_q has vertex set the field 𝔽q\mathbb F_q, with x∼yx\sim y when x−yx-y is a nonzero square. Since −1-1 is a square when q≡1(mod4)q\equiv1\pmod4, this relation is symmetric. Every vertex has (q−1)/2(q-1)/2 neighbours.
Self-complementary. If aa is a non-square, the map x↦axx\mapsto ax sends squares to non-squares, so it maps PqP_q onto its complement. Hence ω(Pq)=α(Pq)\omega(P_q)=\alpha(P_q), and colouring edges of PqP_q red and non-edges blue gives r(ω+1,ω+1)>qr(\omega+1,\omega+1)>q.

For q=17q=17 the squares mod 17 are {1,2,4,8,9,13,15,16}\{1,2,4,8,9,13,15,16\}, and ω(P17)=3\omega(P_{17})=3. So r(4,4)>17r(4,4)>17; together with r(4,4)≤18r(4,4)\le18 this gives r(4,4)=18r(4,4)=18.

Schur numbers. A set of integers is sum-free if x+yx+y is never in it when x,yx,y are (x=yx=y allowed). The Schur number sks_k is the largest NN such that {1,…,N}\{1,\dots,N\} splits into kk sum-free sets. Known: s1=1, s2=4, s3=13, s4=44s_1=1,\ s_2=4,\ s_3=13,\ s_4=44, and s5=160s_5=160 (by computer, 2017).
Schur meets Ramsey. rk(3)≥sk+2r_k(3)\ge s_k+2. Also r3(3)=17r_3(3)=17: Greenwood and Gleason coloured K16K_{16} on 𝔽16\mathbb F_{16} by sending the edge xyxy to the coset of the cubes that contains x−yx-y; each coset is sum-free.

Explore

Vertex xx sits at position xx around the circle. Click vertices to build a set; it is checked as you go.
Field size q
Draw

Worked example

Show that s2=4s_2=4, and turn that into the lower bound r(3,3)≥6r(3,3)\ge 6.

  1. Split {1,2,3,4}\{1,2,3,4\} into two sum-free sets.

    {1,4}\{1,4\} and {2,3}\{2,3\}. Sums within the first: 2,5,82,5,8; within the second: 4,5,64,5,6. None lands back in the same set.

  2. Why can {1,…,5}\{1,\dots,5\} not be split this way?

    Put 1 in AA. Then 2=1+1∉A2=1+1\notin A, so 2∈B2\in B, and 4=2+2∉B4=2+2\notin B, so 4∈A4\in A. Now 3∉A3\notin A (since 1+3=41+3=4), so 3∈B3\in B. Finally 5=1+45=1+4 rules out AA and 5=2+35=2+3 rules out BB.

  3. Given a sum-free split of {1,…,N}\{1,\dots,N\} into kk classes, colour KN+1K_{N+1} on vertices 0,…,N0,\dots,N by giving edge ijij the class of |i−j||i-j|. Why is there no monochromatic triangle?

    For a triangle i<j<li<j<l the three differences are a=j−ia=j-i, b=l−jb=l-j and a+b=l−ia+b=l-i. If all three had the same class, that class would contain aa, bb and a+ba+b, so it would not be sum-free.

  4. What do you get for k=2k=2 and k=3k=3?

    So rk(3)>sk+1r_k(3)>s_k+1. With s2=4s_2=4: a good colouring of K5K_5 (it is the pentagon), so r(3,3)≥6r(3,3)\ge6. With s3=13s_3=13: r3(3)≥15r_3(3)\ge15, which is weaker than the true value 17, found with 𝔽16\mathbb F_{16} instead.

Check your understanding

Why does the Paley construction need q≡1(mod4)q\equiv 1\pmod 4?

  1. So that −1-1 is a square, which makes "x−yx-y is a square" symmetric in xx and yy.
  2. So that qq is prime.qq may be any prime power, such as 9 or 25. The condition is about −1-1.
  3. So that the graph has an even number of vertices.q≡1(mod4)q\equiv1\pmod4 makes qq odd.
y−x=(−1)(x−y)y-x=(-1)(x-y), so if −1-1 is a square, x−yx-y and y−xy-x are squares together. In 𝔽q\mathbb F_q with qq odd, −1-1 is a square exactly when q≡1(mod4)q\equiv1\pmod4.

P13P_{13} has ω=α=3\omega=\alpha=3. What does it tell you about r(4,4)r(4,4)?

  1. r(4,4)>13r(4,4)>13, weaker than what P17P_{17} gives.
  2. r(4,4)=14r(4,4)=14.A single graph only ever gives a lower bound.
  3. Nothing, because 13 is prime and 17 is needed.Any graph with no K4K_4 and no independent 4-set gives a lower bound. Check what this one gives.
Colour edges of P13P_{13} red and non-edges blue: there is no monochromatic K4K_4, so K13K_{13} does not force one. P17P_{17} does the same on more vertices, which is why it is the one that matches the upper bound.

In the explorer, select a triangle in P17P_{17} and press "Multiply by a non-square". What do you get, and why?

  1. An independent set of size 3, because x↦axx\mapsto ax turns every square difference into a non-square one.
  2. Another triangle, because multiplication is an automorphism.Multiplying by a square is an automorphism. A non-square swaps edges and non-edges.
  3. A set of size 6.The map is a bijection on vertices, so the size is preserved.
ax−ay=a(x−y)ax-ay=a(x-y), and a non-square times a nonzero square is a non-square. So cliques become independent sets of the same size and vice versa, which is why ω(Pq)=α(Pq)\omega(P_q)=\alpha(P_q).

Practice

Symmetry of Paley graphsAutomorphisms

Show that any two edges of PqP_q have the same number of common neighbours.

Hint

Which maps x↦ax+bx\mapsto ax+b are automorphisms? Can one of them send the edge {0,1}\{0,1\} to any given edge?

Solution

If aa is a nonzero square, ϕ(x)=ax+b\phi(x)=ax+b is an automorphism, since ϕ(x)−ϕ(y)=a(x−y)\phi(x)-\phi(y)=a(x-y) is a square exactly when x−yx-y is. For an edge {u,v}\{u,v\}, take a=v−ua=v-u (a square) and b=ub=u: then ϕ(0)=u\phi(0)=u and ϕ(1)=v\phi(1)=v. Automorphisms preserve common neighbourhoods, so every edge has as many common neighbours as {0,1}\{0,1\}.

A triangle-free graph on 13 verticesSum-free connection sets

On ℤ13\mathbb Z_{13}, join xx and yy when x−y∈S={1,5,8,12}x-y\in S=\{1,5,8,12\}. Show this graph has no triangle. (A computer check shows its independence number is 4, so it proves r(3,5)≥14r(3,5)\ge14; in fact r(3,5)=14r(3,5)=14.)

Hint

A triangle {x,x+a,x+a+b}\{x,x+a,x+a+b\} needs aa, bb and a+ba+b all in SS.

Solution

SS is closed under negation, so the graph is well defined, and a triangle needs a,b∈Sa,b\in S with a+b∈Sa+b\in S. The sums mod 13 of pairs from SS are 2,6,9,0,10,0,4,3,7,112,6,9,0,10,0,4,3,7,11, none of which lies in SS. So there is no triangle.

More practice: Li–Lin, Exercises 2.1, 2.3 and 2.6.

SimulationLi–Lin, Ch. 3: Basic Probabilistic Method

Random colourings

Nobody knows how to write down a colouring of KnK_n with no monochromatic KkK_k when nn is close to 2k/22^{k/2}. Erdős showed in 1947 that a random colouring does the job with positive probability. The proof never says which colouring works.

The idea

Colour each edge of KnK_n red or blue independently, with probability 12\tfrac12 each. A fixed kk-set of vertices is monochromatic with probability 2⋅2−(k2)2\cdot 2^{-\binom k2}. If XX counts the monochromatic kk-sets, linearity of expectation gives

𝔼X=(nk)21−(k2).\mathbb E X=\binom nk\,2^{1-\binom k2}.
Erdős's bound. If (nk)21−(k2)<1\binom nk 2^{1-\binom k2}<1, then r(k,k)>nr(k,k)>n. Taking n=⌊2k/2⌋n=\lfloor 2^{k/2}\rfloor shows r(k,k)>2k/2r(k,k)>2^{k/2} for all k≥3k\ge3.

The reason: XX is a whole number and its average is below 1, so some colouring has X=0X=0.

Deletion. For every nn, r(k,k)>n−(nk)21−(k2)r(k,k)>n-\binom nk 2^{1-\binom k2}. Some colouring has at most 𝔼X\mathbb E X monochromatic kk-sets; delete one vertex from each.
Two tools used all the time. Markov's inequality: Pr⁡(X≥a)≤𝔼X/a\Pr(X\ge a)\le \mathbb E X/a for X≥0X\ge0. Linearity: 𝔼(X+Y)=𝔼X+𝔼Y\mathbb E(X+Y)=\mathbb EX+\mathbb EY, with no independence needed.

The same chapter bounds independence numbers: every graph has α(G)≥∑v1d(v)+1\alpha(G)\ge\sum_v \frac{1}{d(v)+1} (the worked example).

Explore

red blue · vertices with a ring are deleted to kill every monochromatic KkK_k; the rest are shown in teal.

Worked example

Prove that every graph GG has α(G)≥∑v1d(v)+1\alpha(G)\ge\sum_{v}\frac1{d(v)+1} (Caro–Wei), and deduce Turán's theorem from it.

  1. Order the vertices uniformly at random. Let II be the set of vertices that come before all of their neighbours. Why is II independent?

    If u,v∈Iu,v\in I were adjacent, uu would come before vv and vv before uu.

  2. What is Pr⁡(v∈I)\Pr(v\in I)?

    Only the relative order of vv and its d(v)d(v) neighbours matters, and each of these d(v)+1d(v)+1 vertices is equally likely to come first. So Pr⁡(v∈I)=1d(v)+1\Pr(v\in I)=\frac{1}{d(v)+1}.

  3. Finish the bound.

    𝔼|I|=∑v1d(v)+1\mathbb E|I|=\sum_v\frac1{d(v)+1} by linearity, so some ordering gives an independent set at least this large.

  4. Deduce: a graph on nn vertices with no Kr+1K_{r+1} has at most (1−1r)n22(1-\frac1r)\frac{n^2}{2} edges.

    x↦1x+1x\mapsto\frac1{x+1} is convex, so by Jensen α(H)≥nd‾+1\alpha(H)\ge\frac{n}{\bar d+1} for any HH with average degree d‾\bar d. Apply this to the complement G‾\bar G: a clique in GG is an independent set in G‾\bar G, so r≥α(G‾)≥nd‾G‾+1r\ge\alpha(\bar G)\ge\frac{n}{\bar d_{\bar G}+1}. Hence d‾G‾≥nr−1\bar d_{\bar G}\ge\frac nr-1 and d‾G=n−1−d‾G‾≤n−nr\bar d_G=n-1-\bar d_{\bar G}\le n-\frac nr. So e(G)=nd‾G2≤(1−1r)n22e(G)=\frac{n\bar d_G}{2}\le(1-\frac1r)\frac{n^2}2. Module 7 returns to this.

Check your understanding

For k=4k=4 and n=6n=6, 𝔼X=(64)2−5=15/32\mathbb E X=\binom64 2^{-5}=15/32. What follows?

  1. Some colouring of K6K_6 has no monochromatic K4K_4, so r(4,4)>6r(4,4)>6.
  2. Every colouring of K6K_6 has no monochromatic K4K_4.An average below 1 guarantees some colouring with X=0X=0, not that all have it.
  3. A random colouring has a monochromatic K4K_4 with probability exactly 15/3215/32.Markov gives Pr⁡(X≥1)≤15/32\Pr(X\ge1)\le 15/32. Equality would need X≤1X\le1 always.
XX takes whole-number values with mean below 1, so Pr⁡(X=0)>0\Pr(X=0)>0. Here Markov even gives Pr⁡(X=0)≥17/32\Pr(X=0)\ge 17/32.

Two 4-sets that share an edge are not independent events. Why is 𝔼X=(nk)21−(k2)\mathbb EX=\binom nk 2^{1-\binom k2} still right?

  1. Linearity of expectation holds for any random variables, dependent or not.
  2. Because the overlaps are rare enough to ignore.The formula is exact for every nn, not an approximation.
  3. It isn't; the formula is an upper bound.Write XX as a sum of indicator variables and take expectations term by term.
X=∑S𝟏[S mono]X=\sum_S \mathbf 1[S\text{ mono}] and 𝔼\mathbb E of a sum is the sum of the 𝔼\mathbb E's, always. Dependence matters for the variance, not the mean.

For some kk and n=40n=40, 𝔼X=6.2\mathbb E X=6.2. What does deletion give?

  1. r(k,k)>34r(k,k)>34.
  2. r(k,k)>40r(k,k)>40.That needs 𝔼X<1\mathbb EX<1. Here typical colourings do have monochromatic kk-sets.
  3. Nothing, because 𝔼X>1\mathbb E X>1.Some colouring has at most 6 bad sets. What can you remove?
Some colouring has X≤6.2X\le 6.2, and XX is a whole number, so X≤6X\le6. Remove one vertex from each bad set: at least 34 vertices remain with no monochromatic KkK_k.

Practice

The 2k/22^{k/2} boundChecking the inequality

Show that n=⌊2k/2⌋n=\lfloor2^{k/2}\rfloor satisfies (nk)21−(k2)<1\binom nk2^{1-\binom k2}<1 for k≥3k\ge3.

Hint

Use (nk)≤nk/k!\binom nk\le n^k/k! and nk≤2k2/2n^k\le 2^{k^2/2}.

Solution

(nk)21−(k2)≤2k2/2k!21−k2/2+k/2=21+k/2k!\binom nk2^{1-\binom k2}\le\frac{2^{k^2/2}}{k!}\,2^{1-k^2/2+k/2}=\frac{2^{1+k/2}}{k!}. For k=3k=3 this is 22.5/6≈0.94<12^{2.5}/6\approx0.94<1, and going from kk to k+1k+1 multiplies it by 2/(k+1)<1\sqrt2/(k+1)<1.

Half the edges are bipartiteA one-line expectation

Show that every graph with mm edges has a bipartite subgraph with at least m/2m/2 edges.

Hint

Put each vertex on the left or right at random. When does an edge cross?

Solution

Each edge crosses with probability 12\tfrac12, so the expected number of crossing edges is m/2m/2, and some split achieves at least that. The crossing edges form a bipartite subgraph.

More practice: Li–Lin, Exercises 3.6 and 3.7.

Animated lessonLi–Lin, Ch. 4: Random Graph

The random graph process

Start with nn isolated vertices and add random edges one at a time. Properties do not appear gradually: each one shows up suddenly, near an edge count you can predict with a short expectation calculation.

The idea

The model. G(n,p)G(n,p) has vertex set {1,…,n}\{1,\dots,n\}, and each of the (n2)\binom n2 edges is present independently with probability pp. A property holds asymptotically almost surely (a.a.s.) if its probability tends to 1 as n→∞n\to\infty. The process that adds edges in random order behaves at mm edges like G(n,p)G(n,p) with p=m/(n2)p=m/\binom n2.
Threshold. p*(n)p^*(n) is a threshold for an increasing property QQ if Pr⁡(G(n,p)∈Q)→0\Pr(G(n,p)\in Q)\to0 when p/p*→0p/p^*\to0 and →1\to1 when p/p*→∞p/p^*\to\infty.
Three thresholds.
  • Triangles: threshold 1/n1/n. At p=c/np=c/n the number of triangles is approximately Poisson with mean c3/6c^3/6.
  • Giant component: at p=c/np=c/n, if c<1c<1 every component has O(log⁡n)O(\log n) vertices; if c>1c>1 there is a unique component with a constant fraction of the vertices.
  • Connectivity: at p=(ln⁡n+c)/np=(\ln n+c)/n, Pr⁡(connected)→e−e−c\Pr(\text{connected})\to e^{-e^{-c}}. The last obstacle is an isolated vertex.

Random graphs are also where Ramsey lower bounds come from: taking G(N,p)G(N,p) with a well-chosen pp and deleting a vertex from each triangle shows r(3,n)≥c(n/log⁡n)3/2r(3,n)\ge c\,(n/\log n)^{3/2}. The true order, n2/log⁡nn^2/\log n, is due to Kim and to Ajtai, Komlós and Szemerédi.

Watch

largest component other components with a cycle isolated vertices
  1. 50 isolated vertices. Edges will arrive in a uniformly random order.
  2. Up to m=n/4m=n/4 edges (p≈12np\approx\tfrac{1}{2n}): a scattering of small trees. Cycles are unlikely this early.
  3. Up to m=n/2m=n/2 (p≈1/np\approx 1/n): the critical point. Cycles start to appear, and components merge quickly.
  4. Up to m=nm=n (p≈2/np\approx2/n): one component swallows most of the others. This is the giant component.
  5. Up to m≈n2ln⁡nm\approx\tfrac n2\ln n (p≈ln⁡n/np\approx\ln n/n): the last isolated vertices get their first edge, and the graph becomes connected around here.
  6. Beyond the threshold: connected, with plenty of triangles. Press "New random graph" and replay to see how much these moments vary for n=50n=50.

Worked example

Let XX be the number of triangles in G(n,p)G(n,p). Show that 1/n1/n is a threshold for X≥1X\ge1.

  1. Compute 𝔼X\mathbb EX.

    Each of the (n3)\binom n3 triples is a triangle with probability p3p^3, so 𝔼X=(n3)p3∼(np)3/6\mathbb EX=\binom n3p^3\sim (np)^3/6.

  2. Suppose np→0np\to0. Why is there a.a.s. no triangle?

    Markov: Pr⁡(X≥1)≤𝔼X∼(np)3/6→0\Pr(X\ge1)\le\mathbb EX\sim(np)^3/6\to0.

  3. Suppose np→∞np\to\infty. Then 𝔼X→∞\mathbb EX\to\infty, but that alone is not enough. Bound Var⁡X\operatorname{Var}X.

    Write X=∑TXTX=\sum_T X_T. Triples sharing at most one vertex share no edge, so they are independent and contribute nothing to the covariance. Pairs sharing an edge span 4 vertices and 5 edges: there are O(n4)O(n^4) of them, each with Cov⁡≤p5\operatorname{Cov}\le p^5. So Var⁡X≤𝔼X+O(n4p5)\operatorname{Var}X\le \mathbb EX+O(n^4p^5).

  4. Finish with Chebyshev.

    Pr⁡(X=0)≤Var⁡X(𝔼X)2≤1𝔼X+O(n4p5n6p6)=O(1(np)3)+O(1n2p)→0.\Pr(X=0)\le\frac{\operatorname{Var}X}{(\mathbb EX)^2}\le\frac{1}{\mathbb EX}+O\!\left(\frac{n^4p^5}{n^6p^6}\right)=O\!\left(\frac{1}{(np)^3}\right)+O\!\left(\frac{1}{n^2p}\right)\to0.

    Between the two regimes, at p=c/np=c/n, XX is approximately Poisson with mean c3/6c^3/6, so Pr⁡(X=0)→e−c3/6\Pr(X=0)\to e^{-c^3/6}.

Check your understanding

About how many triangles do you expect in G(n,1/n)G(n,1/n) for large nn?

  1. About 1/61/6.
  2. About n/6n/6.Compute (n3)p3\binom n3p^3 with p=1/np=1/n: the powers of nn cancel.
  3. About 1.You are close. Remember (n3)≈n3/6\binom n3\approx n^3/6.
(n3)n−3→1/6\binom n3 n^{-3}\to 1/6. So at p=1/np=1/n a triangle is present with probability about 1−e−1/6≈0.151-e^{-1/6}\approx 0.15: right at the threshold, neither likely nor negligible.

At p=ln⁡n/np=\ln n/n, how many isolated vertices do you expect?

  1. About 1.
  2. About 0.Compute n(1−p)n−1≈ne−pnn(1-p)^{n-1}\approx n e^{-pn}.
  3. About ln⁡n\ln n.The exponential e−pn=1/ne^{-pn}=1/n cancels the factor nn exactly.
n(1−p)n−1≈ne−ln⁡n=1n(1-p)^{n-1}\approx ne^{-\ln n}=1. Shifting pp to (ln⁡n+c)/n(\ln n+c)/n makes the mean e−ce^{-c}, and the count is approximately Poisson, which is where e−e−ce^{-e^{-c}} comes from.

If 𝔼X→∞\mathbb EX\to\infty, must Pr⁡(X≥1)→1\Pr(X\ge1)\to1?

  1. No. XX could be huge on a rare event and 0 otherwise, so a second-moment bound is needed.
  2. Yes, by Markov's inequality.Markov bounds Pr⁡(X≥a)\Pr(X\ge a) from above. It says nothing about XX being positive.
  3. Yes, because XX is a sum of many indicators.Indicators can be strongly correlated, for example all equal to one event of small probability.
Take X=n2X=n^2 with probability 1/n1/n and X=0X=0 otherwise: 𝔼X=n→∞\mathbb EX=n\to\infty but Pr⁡(X≥1)→0\Pr(X\ge1)\to0. Chebyshev with Var⁡X=o((𝔼X)2)\operatorname{Var}X=o((\mathbb EX)^2) rules this out.

Practice

When does K4K_4 appear?Same method, new numbers

Find the threshold for G(n,p)G(n,p) to contain a K4K_4.

Hint

𝔼(#K4)=(n4)p6\mathbb E(\#K_4)=\binom n4p^6. Where is it of constant order? Check that no subgraph of K4K_4 is denser than K4K_4 itself.

Solution

(n4)p6≍n4p6\binom n4p^6\asymp n^4p^6, which is of constant order at p=n−2/3p=n^{-2/3}. Below it Markov gives no K4K_4. Above it, the second moment works because every subgraph FF of K4K_4 has e(F)/v(F)≤6/4e(F)/v(F)\le 6/4, so no smaller piece appears later than K4K_4 itself. The threshold is n−2/3n^{-2/3}.

No isolated verticesFirst moment

Show that at p=2ln⁡n/np=2\ln n/n, G(n,p)G(n,p) a.a.s. has no isolated vertex.

Solution

The expected number of isolated vertices is n(1−p)n−1≤ne−p(n−1)=n⋅n−2(n−1)/n=n−1+2/n→0n(1-p)^{n-1}\le n e^{-p(n-1)}=n\cdot n^{-2(n-1)/n}=n^{-1+2/n}\to0. By Markov, a.a.s. there are none.

More practice: Li–Lin, Exercises 4.10 and 4.12.

CalculatorLi–Lin, Ch. 5: Lovász Local Lemma

The local lemma

The union bound needs the bad events' probabilities to add up to less than 1. The Lovász Local Lemma needs much less: if each bad event depends on only a few others, all of them can be avoided at once, however many there are. For Ramsey numbers this gains a constant factor over Erdős's bound.

The idea

Dependency graph. Events A1,…,ANA_1,\dots,A_N have a dependency graph DD if each AiA_i is mutually independent of the family {Aj:j≠i, ij∉D}\{A_j: j\ne i,\ ij\notin D\}. Typical case: each event is determined by a set of independent coin flips, and i∼ji\sim j when the two sets overlap.
Symmetric local lemma. If Pr⁡(Ai)≤p\Pr(A_i)\le p for all ii, every vertex of DD has degree at most dd, and
ep(d+1)≤1,e\,p\,(d+1)\le1,

then Pr⁡(⋂iAi)>0\Pr\big(\bigcap_i\overline{A_i}\big)>0: with positive probability no bad event happens.

For r(k,k)r(k,k): colour KnK_n at random and let ASA_S be the event that the kk-set SS is monochromatic, so p=21−(k2)p=2^{1-\binom k2}. ASA_S depends only on the edges inside SS, so it is independent of all ATA_T with |S∩T|≤1|S\cap T|\le1. The number of other TT with |S∩T|≥2|S\cap T|\ge2 is

d=∑i=2k−1(ki)(n−kk−i).d=\sum_{i=2}^{k-1}\binom ki\binom{n-k}{k-i}.
Three lower bounds, compared. As k→∞k\to\infty,
union: 1e2k2k/2,deletion: 1ek2k/2,local lemma (Spencer): 2ek2k/2,\text{union: } \tfrac{1}{e\sqrt2}\,k2^{k/2},\qquad \text{deletion: } \tfrac1e\,k2^{k/2},\qquad \text{local lemma (Spencer): } \tfrac{\sqrt2}{e}\,k2^{k/2},

each up to a factor 1+o(1)1+o(1). Nothing better than 2k\sqrt2^{\,k} in the exponent is known. The same chapter uses the local lemma for r(3,n)≥c(n/log⁡n)2r(3,n)\ge c(n/\log n)^2, and the triangle-free process improves this to (14−o(1))n2/log⁡n(\tfrac14-o(1))\,n^2/\log n.

Explore

Each bound divided by k2k/2k2^{k/2}. Dashed lines: the limits 1/(e2)1/(e\sqrt2), 1/e1/e and 2/e\sqrt2/e. union deletion local lemma

Worked example

A hypergraph is 2-colourable if its vertices can be coloured red and blue with no edge monochromatic. Show: if every edge has exactly kk vertices and meets at most dd other edges, and e(d+1)21−k≤1e(d+1)2^{1-k}\le1, then the hypergraph is 2-colourable.

  1. Set up the random experiment and the bad events.

    Colour each vertex red or blue independently with probability 12\tfrac12. For each edge ff, let AfA_f be the event that ff is monochromatic.

  2. What is Pr⁡(Af)\Pr(A_f)?

    All red or all blue: 2⋅2−k=21−k2\cdot2^{-k}=2^{1-k}.

  3. Find a dependency graph with maximum degree dd.

    AfA_f is determined by the colours on ff. The events AgA_g with g∩f=⌀g\cap f=\varnothing are determined by colours off ff, so AfA_f is mutually independent of all of them together. Joining ff to the edges it meets gives degree at most dd.

  4. Conclude, and compare with the union bound for k=10k=10.

    The local lemma applies, so with positive probability no edge is monochromatic. For k=10k=10 the condition is e(d+1)≤512e(d+1)\le512, that is d≤187d\le187, with no limit at all on the total number of edges. The union bound would need fewer than 29=5122^{9}=512 edges in total.

Check your understanding

Why is the event "SS is monochromatic" independent of all the events "TT is monochromatic" with |S∩T|≤1|S\cap T|\le1?

  1. Such a TT shares no edge with SS, so those events depend only on edges outside SS.
  2. Because such a TT shares no vertex with SS.TT may share one vertex. What do the events actually depend on?
  3. Because each event has small probability.Small probability says nothing about independence.
Two vertices are needed to share an edge. The colours of edges are independent, so events determined by disjoint sets of edges are independent, even as a whole family.

Asymptotically, Spencer's local lemma bound for r(k,k)r(k,k) is how many times Erdős's union bound?

  1. 2
  2. 2\sqrt2That is the gain over the deletion method, not over the union bound.
  3. eeDivide the two constants: 2e/1e2\frac{\sqrt2}{e}\big/\frac1{e\sqrt2}.
2/e1/(e2)=2\frac{\sqrt2/e}{1/(e\sqrt2)}=2. The improvement is only a constant factor. For moderate kk the convergence is slow: the calculator shows deletion doing at least as well as the local lemma for every k≤16k\le16.

If the events are fully independent (d=0d=0), the condition reads ep≤1ep\le1. Is that what independent events actually need?

  1. No. Independent events, each with probability below 1, can all be avoided, since ∏(1−pi)>0\prod(1-p_i)>0.
  2. Yes, the local lemma is exact when d=0d=0.Try p=12p=\tfrac12 with two independent events.
  3. No, they need ∑pi<1\sum p_i<1.That is the union bound, which is only a sufficient condition.
The factor ee is the price of handling arbitrary dependencies with one clean condition. With d=0d=0 the product formula is exact and much weaker conditions suffice.

Practice

Regular uniform hypergraphsCount the dependencies

Show that every kk-uniform hypergraph in which each vertex lies in exactly kk edges is 2-colourable once k≥9k\ge9.

Hint

Each edge has kk vertices, each in k−1k-1 other edges.

Solution

An edge meets at most d=k(k−1)d=k(k-1) others. For k=9k=9: e(d+1)21−k=e⋅73/256≈0.78≤1e(d+1)2^{1-k}=e\cdot73/256\approx0.78\le1, so the worked example applies. For larger kk the left side only shrinks, since k(k−1)+1k(k-1)+1 grows polynomially while 2k−12^{k-1} doubles.

Satisfiable formulasThe same lemma, in logic

A kk-CNF formula has clauses of exactly kk distinct literals. Show that if each clause shares a variable with at most 2k/e−12^k/e-1 other clauses, the formula is satisfiable.

Solution

Set each variable true or false at random. A clause fails with probability 2−k2^{-k} (all kk literals false), and its failure depends only on its own variables. With d≤2k/e−1d\le 2^k/e-1 we get ep(d+1)≤e2−k⋅2k/e=1ep(d+1)\le e2^{-k}\cdot2^k/e=1, so with positive probability no clause fails.

More practice: Li–Lin, Exercises 5.2 and 5.5.

Build it yourselfLi–Lin, Ch. 6: Constructive Lower Bounds

Explicit Ramsey graphs

Random colourings beat every explicit construction anyone knows. Still, explicit graphs exist whose cliques and independent sets can be bounded by linear algebra. Here is the simplest one: its vertices are triples, and you can try to build a large clique or independent set by hand.

The idea

Oddtown theorem. If ℱ\mathcal F is a family of subsets of {1,…,t}\{1,\dots,t\}, each of odd size, and any two distinct members meet in an even number of elements, then |ℱ|≤t|\mathcal F|\le t.
Fisher-type inequality. If distinct subsets of {1,…,t}\{1,\dots,t\} pairwise meet in exactly λ≥1\lambda\ge1 elements, there are at most tt of them.
The graph. Let NtN_t have the (t3)\binom t3 three-element subsets of {1,…,t}\{1,\dots,t\} as vertices, with A∼BA\sim B when |A∩B|=1|A\cap B|=1.

A clique is a family of triples meeting pairwise in exactly one point: at most tt by Fisher. An independent set is a family of triples meeting pairwise in 0 or 2 points, an even number: at most tt by Oddtown. So

r(t+1,t+1)>(t3).r(t+1,t+1)>\binom t3.

That is only polynomial in tt, against Erdős's exponential 2t/22^{t/2}. Frankl and Wilson replaced "intersection 1" by conditions on intersections modulo a prime and got explicit graphs with cliques and independent sets of size eclog⁡nlog⁡log⁡ne^{c\sqrt{\log n\log\log n}} on nn vertices. The same intersection theorems disproved Borsuk's conjecture: Kahn and Kalai found bounded sets in ℝd\R^d that cannot be split into fewer than 1.2d1.2^{\sqrt d} pieces of smaller diameter.

Explore

Each chip is a vertex of NtN_t. Click chips to choose a family of triples. A pair that breaks the pattern is outlined in red.
Ground set size t

Worked example

Prove the Oddtown theorem.

  1. Turn each set into a vector. Over which field?

    Over 𝔽2\mathbb F_2: let vA∈𝔽2tv_A\in\mathbb F_2^t be the indicator vector of AA. Then vA⋅vB=|A∩B|mod2v_A\cdot v_B=|A\cap B|\bmod 2.

  2. What are vA⋅vAv_A\cdot v_A and vA⋅vBv_A\cdot v_B for A≠BA\ne B?

    vA⋅vA=|A|≡1v_A\cdot v_A=|A|\equiv1 since sizes are odd, and vA⋅vB=|A∩B|≡0v_A\cdot v_B=|A\cap B|\equiv0 since intersections are even.

  3. Show the vectors are linearly independent.

    If ∑AcAvA=0\sum_A c_Av_A=0, take the dot product with vBv_B: every term vanishes except cBvB⋅vB=cBc_B\,v_B\cdot v_B=c_B. So every cB=0c_B=0.

  4. Conclude.

    Linearly independent vectors in 𝔽2t\mathbb F_2^t number at most tt, so |ℱ|≤t|\mathcal F|\le t. For triples, an independent set of NtN_t is such a family, so α(Nt)≤t\alpha(N_t)\le t.

Check your understanding

Which family is a clique in NtN_t?

  1. The seven lines of the Fano plane, such as {1,2,3},{1,4,5},{2,4,6},…\{1,2,3\},\{1,4,5\},\{2,4,6\},\dots
  2. All triples containing the element 1.{1,2,3}\{1,2,3\} and {1,2,4}\{1,2,4\} share two elements, so they are not adjacent.
  3. The four triples inside {1,2,3,4}\{1,2,3,4\}.These meet pairwise in two elements. That makes them independent, not a clique.
Any two lines of the Fano plane meet in exactly one point. That gives a clique of size 7 in N7N_7, so Fisher's bound tt is attained there. Try the button in the explorer.

Oddtown needs odd set sizes. What goes wrong with even sizes and even intersections?

  1. vA⋅vAv_A\cdot v_A becomes 0 and the independence argument fails; indeed there can be 2⌊t/2⌋2^{\lfloor t/2\rfloor} such sets.
  2. Nothing; the same bound tt holds.Try all unions of the pairs {1,2},{3,4},…\{1,2\},\{3,4\},\dots
  3. The vectors no longer live in 𝔽2t\mathbb F_2^t.They still do. Look at which dot product changes.
Unions of the disjoint pairs {1,2},{3,4},…\{1,2\},\{3,4\},\dots all have even size and even intersections: 2⌊t/2⌋2^{\lfloor t/2\rfloor} sets ("Eventown"). The diagonal entries of the Gram matrix are what make the odd case linear in tt.

NtN_t gives r(t+1,t+1)>(t3)r(t+1,t+1)>\binom t3, and Erdős gives r(t+1,t+1)>2(t+1)/2r(t+1,t+1)>2^{(t+1)/2}. For t=10t=10, (103)=120\binom{10}{3}=120 beats 25.5≈452^{5.5}\approx45. What happens as tt grows?

  1. Erdős's bound wins for every t≥19t\ge19: it is exponential, (t3)\binom t3 is cubic.
  2. NtN_t stays ahead, because explicit graphs are better than random ones.Compare growth rates: t3/6t^3/6 against 2t/22^{t/2}.
  3. They stay within a constant factor of each other.The ratio 2t/2/t32^{t/2}/t^3 tends to infinity.
At t=18t=18: 816816 against 29.5≈7242^{9.5}\approx724; at t=19t=19: 969969 against 10241024. From then on the exponential wins by more and more. Erdős asked for an explicit construction giving (1+ϵ)t(1+\epsilon)^t; none is known.

Practice

The clique boundA positive definite Gram matrix

Show directly that a family of triples in {1,…,t}\{1,\dots,t\} meeting pairwise in exactly one element has at most tt members.

Hint

Use real indicator vectors this time. What is their Gram matrix?

Solution

With real vectors, vA⋅vA=3v_A\cdot v_A=3 and vA⋅vB=1v_A\cdot v_B=1, so the Gram matrix is 2I+J2I+J, which is positive definite (its eigenvalues are 2 and 2+m2+m). A positive definite Gram matrix means the vectors are linearly independent in ℝt\R^t, so there are at most tt.

TetrahedraAn independent set of size t

When 4|t4\mid t, find an independent set of size exactly tt in NtN_t, so the Oddtown bound is attained.

Solution

Split {1,…,t}\{1,\dots,t\} into blocks of 4 and take all four triples inside each block. Triples in the same block meet in 2 elements and triples in different blocks are disjoint, so every intersection is even. There are 4⋅t/4=t4\cdot t/4=t triples. The "Tetrahedra" button in the explorer shows this for t=8t=8.

More practice: Li–Lin, Exercises 6.3 and 6.4.

InteractiveLi–Lin, Ch. 7: Turán Number and Related Ramsey Number

Turán numbers

How many edges can a graph on nn vertices have without containing a Kr+1K_{r+1}? Split the vertices into rr parts as equally as possible and join every pair in different parts. Drag vertices between parts to see why equal parts are best.

The idea

Turán number. ex(n,H)\mathrm{ex}(n,H) is the largest number of edges in an nn-vertex graph with no copy of HH. The Turán graph T(n,r)T(n,r) is the complete rr-partite graph with part sizes ⌊n/r⌋\lfloor n/r\rfloor or ⌈n/r⌉\lceil n/r\rceil.
Turán's theorem. ex(n,Kr+1)=e(T(n,r))≤(1−1r)n22\mathrm{ex}(n,K_{r+1})=e(T(n,r))\le\left(1-\frac1r\right)\frac{n^2}2, and T(n,r)T(n,r) is the only extremal graph.
Erdős–Stone–Simonovits. ex(n,H)=(1−1χ(H)−1+o(1))n22\mathrm{ex}(n,H)=\left(1-\frac1{\chi(H)-1}+o(1)\right)\frac{n^2}2. The chromatic number decides the answer to first order.

For bipartite HH that first-order answer is o(n2)o(n^2), and the real question is the exponent. Kővári, Sós and Turán: ex(n,Ks,t)=O(n2−1/s)\mathrm{ex}(n,K_{s,t})=O(n^{2-1/s}) for s≤ts\le t. For C4=K2,2C_4=K_{2,2} the order n3/2n^{3/2} is right: the Erdős–Rényi polarity graph, built from the projective plane over 𝔽q\mathbb F_q, has q2+q+1q^2+q+1 vertices, no C4C_4, and about 12q3\tfrac12q^3 edges.

Why Ramsey cares. In a kk-colouring of KNK_N some colour has at least (N2)/k\binom N2/k edges. If that exceeds ex(N,H)\mathrm{ex}(N,H), that colour contains HH. Bipartite Turán numbers therefore bound multicolour Ramsey numbers, such as rk(C4)=O(k2)r_k(C_4)=O(k^2).

Explore

All edges between different parts are drawn. Drag a vertex into another part. A complete rr-partite graph never contains Kr+1K_{r+1}: two of any r+1r+1 vertices share a part.

Worked example

Show that a graph on nn vertices with no 4-cycle has at most n4(1+4n−3)\frac n4\big(1+\sqrt{4n-3}\big) edges.

  1. Count "cherries": pairs of edges vx,vyvx, vy at a common vertex vv. How many are there in terms of degrees?

    ∑v(d(v)2)\sum_v\binom{d(v)}{2}: choose the centre vv, then two of its neighbours.

  2. Why is this at most (n2)\binom n2 when there is no C4C_4?

    Each cherry has a pair of endpoints {x,y}\{x,y\}. If two cherries had the same endpoints and different centres v≠wv\ne w, then x,v,y,wx,v,y,w would be a 4-cycle. So each pair {x,y}\{x,y\} is used at most once.

  3. Use convexity to bring in the average degree d‾=2e/n\bar d=2e/n.

    x↦(x2)x\mapsto\binom x2 is convex, so n(d‾2)≤∑v(d(v)2)≤(n2)n\binom{\bar d}{2}\le\sum_v\binom{d(v)}2\le\binom n2, that is d‾(d‾−1)≤n−1\bar d(\bar d-1)\le n-1.

  4. Solve for ee.

    d‾≤1+4n−32\bar d\le\frac{1+\sqrt{4n-3}}2, so e=nd‾2≤n4(1+4n−3)≈12n3/2e=\frac{n\bar d}{2}\le\frac n4\big(1+\sqrt{4n-3}\big)\approx\tfrac12n^{3/2}. The polarity graph shows the constant 12\tfrac12 cannot be improved.

Check your understanding

To first order, what is ex(n,C5)\mathrm{ex}(n,C_5)?

  1. n2/4n^2/4
  2. o(n2)o(n^2)That holds for bipartite graphs. Is C5C_5 bipartite?
  3. n2/3n^2/3χ(C5)=3\chi(C_5)=3, so the formula gives 1−121-\frac12, not 1−131-\frac13.
χ(C5)=3\chi(C_5)=3 gives (1−12)n22=n24\big(1-\tfrac12\big)\tfrac{n^2}2=\tfrac{n^2}4. The complete bipartite graph Kn/2,n/2K_{n/2,n/2} has no odd cycle at all, and Erdős–Stone says you cannot do much better.

In a complete multipartite graph, you move one vertex from a part of size 7 to a part of size 4. How does the number of edges change?

  1. It goes up by 2.
  2. It goes up by 3.The moved vertex belongs to its new part too, so that part then has 5 vertices, not 4.
  3. It stays the same.Only its own edges change. Count its neighbours before and after.
Before, the vertex is adjacent to everything outside its part: n−7n-7 vertices. After, to n−5n-5 (its new part has 4+14+1 vertices). The gain is 2=7−4−12=7-4-1. In general moving from size aa to size bb changes the count by a−b−1a-b-1, which is positive whenever a≥b+2a\ge b+2. That is why balanced parts are optimal.

A graph on nn vertices has no 4-cycle. Roughly how large can its average degree be?

  1. About n\sqrt n.
  2. About n/2n/2.Kn/2,n/2K_{n/2,n/2} has average degree n/2n/2 but is full of 4-cycles.
  3. Bounded by a constant.The polarity graph has degrees about n\sqrt n and no C4C_4.
The worked example gives d‾(d‾−1)≤n−1\bar d(\bar d-1)\le n-1, so d‾≲n\bar d\lesssim\sqrt n, and the polarity graph attains this order.

Practice

Mantel's theoremTurán for triangles, by Cauchy–Schwarz

Show that a triangle-free graph on nn vertices has at most n2/4n^2/4 edges.

Hint

For an edge xyxy, the neighbourhoods of xx and yy are disjoint. Sum d(x)+d(y)d(x)+d(y) over all edges.

Solution

Disjoint neighbourhoods give d(x)+d(y)≤nd(x)+d(y)\le n for each edge. Summing over edges, each vertex vv appears d(v)d(v) times, so ∑vd(v)2≤ne\sum_v d(v)^2\le ne. By Cauchy–Schwarz, ∑vd(v)2≥(2e)2/n\sum_vd(v)^2\ge(2e)^2/n. Hence 4e2/n≤ne4e^2/n\le ne, so e≤n2/4e\le n^2/4.

Many colours, one 4-cycleTurán meets Ramsey

Use the worked example to show that every kk-colouring of the edges of KNK_N with N=k2+k+2N=k^2+k+2 contains a monochromatic C4C_4.

Hint

Some colour class has at least (N2)/k\binom N2/k edges. Compare with N4(1+4N−3)\frac N4(1+\sqrt{4N-3}).

Solution

It suffices that (N2)/k>N4(1+4N−3)\binom N2/k>\frac N4(1+\sqrt{4N-3}), that is 2(N−1)k>1+4N−3\frac{2(N-1)}{k}>1+\sqrt{4N-3}. With N−1=k2+k+1N-1=k^2+k+1 the left side is 2k+2+2k2k+2+\frac2k. On the right, 4N−3=(2k+1)2+44N-3=(2k+1)^2+4, so 4N−3<2k+1+22k+1\sqrt{4N-3}<2k+1+\frac{2}{2k+1}, and the right side is less than 2k+2+22k+1<2k+2+2k2k+2+\frac{2}{2k+1}<2k+2+\frac2k. So rk(C4)≤k2+k+2r_k(C_4)\le k^2+k+2.

More practice: Li–Lin, Exercises 7.4 and 7.5.

Build it yourselfLi–Lin, Ch. 8: Communication Channels

Shannon capacity

A channel sends one of five letters, and each letter can be received as itself or as a neighbour around a pentagon. With single letters you can send only 2 messages with no risk of confusion. With two-letter words you can send 5, not 4. That 5 is r(3,3)−1r(3,3)-1, and the coincidence is a theorem.

The idea

Confusability graph. Letters are vertices, joined when they can be confused. A zero-error code of single letters is an independent set, so it has at most α(G)\alpha(G) words.
Strong product. In G⊠HG\boxtimes H (written ∧\wedge in the book), distinct pairs (a,b)(a,b) and (a′,b′)(a',b') are adjacent when, in each coordinate, the entries are equal or adjacent. Words of length nn are confusable exactly when they are adjacent in G⊠nG^{\boxtimes n}.
Shannon capacity. Θ(G)=limn⁡α(G⊠n)1/n=supn⁡α(G⊠n)1/n\Theta(G)=\lim_n\alpha(G^{\boxtimes n})^{1/n}=\sup_n\alpha(G^{\boxtimes n})^{1/n}. Always Θ(G)≥α(G)\Theta(G)\ge\alpha(G). Lovász proved Θ(C5)=5\Theta(C_5)=\sqrt5, attained by the two-letter code below; even cycles have Θ(C2m)=m\Theta(C_{2m})=m. Θ(C7)\Theta(C_7) is unknown.
Erdős–McEliece–Taylor. The largest possible α(G1⊠⋯⊠Gn)\alpha(G_1\boxtimes\cdots\boxtimes G_n) over graphs with α(Gi)<ki\alpha(G_i)<k_i is exactly r(k1,…,kn)−1r(k_1,\dots,k_n)-1.

For n=2n=2, k1=k2=3k_1=k_2=3: α(C5)=2<3\alpha(C_5)=2<3, and α(C5⊠C5)=5=r(3,3)−1\alpha(C_5\boxtimes C_5)=5=r(3,3)-1. The pentagon reaches the maximum.

Explore

Cell (i,j)(i,j) is the word "iji\,j". Letters ii and i±1(mod5)i\pm1\pmod 5 can be confused. Click cells to choose codewords; confusable pairs are joined in red. Shaded cells could be confused with a chosen word.

Worked example

Show that α(C5⊠C5)=5\alpha(C_5\boxtimes C_5)=5, with letters 0,…,40,\dots,4 and ii confusable with i±1mod5i\pm1\bmod 5.

  1. Show that the five words (i,2imod5)(i,2i\bmod5) form a code.

    Take two of them, with first letters differing by δ=j−i≠0\delta=j-i\ne0. If δ=±1\delta=\pm1 the first letters are confusable, but the second letters differ by 2δ=±22\delta=\pm2, which is not confusable. If δ=±2\delta=\pm2 the first letters already differ by 2. Either way, some coordinate tells the words apart.

  2. For the upper bound, look at the codewords whose first letter is ii or i+1i+1. At most how many are there?

    Any two of them have confusable first letters (equal or adjacent), so their second letters must be distinct and non-adjacent. That is an independent set in C5C_5, so there are at most 2.

  3. Add up over the five windows {i,i+1}\{i,i+1\}.

    Each codeword's first letter lies in exactly two windows. So 2|𝒞|≤5⋅22|\mathcal C|\le5\cdot2, giving |𝒞|≤5|\mathcal C|\le5.

  4. What does this give for Θ(C5)\Theta(C_5)?

    Θ(C5)≥α(C5⊠2)1/2=5≈2.236\Theta(C_5)\ge\alpha(C_5^{\boxtimes2})^{1/2}=\sqrt5\approx2.236, better than α(C5)=2\alpha(C_5)=2. Lovász's theta function gives the matching upper bound, so Θ(C5)=5\Theta(C_5)=\sqrt5: longer words never do better per letter.

Check your understanding

The five-word code uses two letters per word. What is its zero-error rate, in bits per letter?

  1. 12log2⁡5≈1.16\tfrac12\log_25\approx1.16
  2. log2⁡5≈2.32\log_25\approx2.32That is per word. Each word costs two channel uses.
  3. 1That is the single-letter rate log2⁡α(C5)\log_2\alpha(C_5). The two-letter code does better.
Five messages in two channel uses: log2⁡5\log_25 bits per two letters. Shannon capacity in bits is log2⁡Θ\log_2\Theta, and for C5C_5 this code already achieves it.

Why is α(G⊠mn)≥α(G⊠n)m\alpha(G^{\boxtimes mn})\ge\alpha(G^{\boxtimes n})^m?

  1. Concatenate mm codewords of length nn: two such long words differ in some block, and that block tells them apart.
  2. Because α\alpha is multiplicative under ⊠\boxtimes.It is only super-multiplicative: α(C5⊠2)=5>2⋅2\alpha(C_5^{\boxtimes2})=5>2\cdot2.
  3. Because G⊠mnG^{\boxtimes mn} has more vertices.More vertices alone does not give large independent sets. Build the code explicitly.
Distinct concatenations differ in some block, where the two length-nn codewords are non-confusable, so the long words are non-confusable. This super-multiplicativity is why the limit defining Θ\Theta exists and equals the supremum.

GG and HH both have independence number at most 2. Why must α(G⊠H)≤5\alpha(G\boxtimes H)\le5?

  1. For two codewords, some coordinate has distinct non-adjacent letters; colour the pair by such a coordinate. A monochromatic triangle would be an independent 3-set in GG or HH. So at most r(3,3)−1=5r(3,3)-1=5 codewords.
  2. Because α(G⊠H)=α(G)α(H)≤4\alpha(G\boxtimes H)=\alpha(G)\alpha(H)\le4.The pentagon gives 5, so the product formula fails.
  3. Because G⊠HG\boxtimes H has at most 25 vertices.GG and HH can be as large as you like.
This is the easy half of Erdős–McEliece–Taylor. The code gives a 2-colouring of the complete graph on the codewords with no monochromatic triangle, so it has at most 5 vertices.

Practice

The square channelClique covers

Show that Θ(C4)=2\Theta(C_4)=2.

Hint

C4C_4 is covered by two cliques (edges). What covers C4⊠nC_4^{\boxtimes n}?

Solution

α(C4)=2\alpha(C_4)=2 gives Θ≥2\Theta\ge2. Cover C4C_4 by the cliques {0,1}\{0,1\} and {2,3}\{2,3\}. Products of cliques are cliques in the strong product, so C4⊠nC_4^{\boxtimes n} is covered by 2n2^n cliques. An independent set has at most one vertex per clique, so α(C4⊠n)≤2n\alpha(C_4^{\boxtimes n})\le2^n and Θ(C4)=2\Theta(C_4)=2.

Long words for the pentagonConcatenation

Show that α(C5⊠2n)≥5n\alpha(C_5^{\boxtimes 2n})\ge5^n, and that α(C5⊠(2n+1))≥2⋅5n\alpha(C_5^{\boxtimes(2n+1)})\ge2\cdot5^n.

Solution

Concatenate nn words from the five-word code: 5n5^n codewords of length 2n2n. For odd length, append one more letter from the independent set {0,2}\{0,2\} of C5C_5, doubling the count.

More practice: Li–Lin, Exercises 8.1 and 8.4.

SimulationLi–Lin, Ch. 9: Dependent Random Choice

Dependent random choice

Pick a few random vertices and keep their common neighbourhood. The set you get is small, but it is special: pairs with few common neighbours rarely survive the choice. That is exactly what you need to embed sparse bipartite graphs into dense graphs.

The idea

The lemma. Let GG have nn vertices and average degree dd. Suppose positive integers t,r,m,at,r,m,a satisfy
n(dn)t−(nr)(mn)t≥a.n\left(\frac dn\right)^{t}-\binom nr\left(\frac mn\right)^{t}\ge a.

Then GG has a set UU of at least aa vertices in which every rr vertices have at least mm common neighbours.

Why. Choose tt vertices TT uniformly at random, with repetition, and let AA be their common neighbourhood.

  • A vertex vv is in AA when all tt picks land in N(v)N(v): probability (d(v)/n)t(d(v)/n)^t. By convexity 𝔼|A|=∑v(d(v)/n)t≥n(d/n)t\mathbb E|A|=\sum_v(d(v)/n)^t\ge n(d/n)^t.
  • An rr-set SS with fewer than mm common neighbours ("bad") lies in AA only if all picks land in its common neighbourhood: probability below (m/n)t(m/n)^t. So the expected number YY of bad sets inside AA is below (nr)(m/n)t\binom nr(m/n)^t.
  • Some choice has |A|−Y≥a|A|-Y\ge a. Delete one vertex from each bad set in AA.
Application. If HH is bipartite and every vertex on one side has degree at most rr, then ex(n,H)≤cHn2−1/r\mathrm{ex}(n,H)\le c_H\,n^{2-1/r}. The worked example does a case by hand.

Explore

the picks TT common neighbourhood AA bad pairs in AA (fewer than mm common neighbours) and the vertices deleted for them the final set UU

Worked example

Let HH be K4K_4 with every edge subdivided once: 4 branch vertices and 6 subdivision vertices, each subdivision vertex adjacent to two branch vertices. Show that every graph with at least 3.7n3/23.7\,n^{3/2} edges contains HH.

  1. What set UU would make embedding HH easy?

    A set of 4 vertices in which every pair has at least 10 common neighbours. Put the branch vertices on UU. Then give each of the 6 subdivision vertices a common neighbour of its two branch vertices, avoiding the at most 4+5=94+5=9 vertices already used. With 10 common neighbours there is always one left.

  2. Apply the lemma with r=2r=2, m=10m=10, t=2t=2. What is the second term?

    (n2)(10/n)2<n22⋅100n2=50\binom n2(10/n)^2<\frac{n^2}{2}\cdot\frac{100}{n^2}=50.

  3. How large must dd be?

    We need n(d/n)2−50≥4n(d/n)^2-50\ge4, i.e. d2/n≥54d^2/n\ge54, i.e. d≥54nd\ge\sqrt{54n}.

  4. Translate into edges.

    e=nd/2e=nd/2, so e≥542n3/2≈3.67n3/2e\ge\frac{\sqrt{54}}{2}n^{3/2}\approx3.67\,n^{3/2} suffices. Hence ex(n,H)<3.7n3/2\mathrm{ex}(n,H)<3.7\,n^{3/2}, matching the n2−1/rn^{2-1/r} shape with r=2r=2.

Check your understanding

In a graph on 40 vertices, a pair {u,v}\{u,v\} has only 3 common neighbours. With t=3t=3 picks, what is the probability that both uu and vv end up in AA?

  1. (3/40)3≈0.0004(3/40)^3\approx0.0004
  2. 3/403/40That is for one pick. All three picks must land among the 3 common neighbours.
  3. (6/40)3(6/40)^3The picks must be adjacent to both uu and vv, so they must land in the intersection of the two neighbourhoods.
u,v∈Au,v\in A means every pick is a common neighbour of uu and vv. The picks are independent, each succeeding with probability 3/403/40.

Why is 𝔼|A|≥n(d/n)t\mathbb E|A|\ge n(d/n)^t, even if GG is far from regular?

  1. 𝔼|A|=∑v(d(v)/n)t\mathbb E|A|=\sum_v(d(v)/n)^t, and x↦xtx\mapsto x^t is convex, so the sum is at least nn times the value at the average.
  2. Because every vertex has degree dd.dd is only the average degree. The argument must handle uneven degrees.
  3. Because AA always contains TT.TT is usually not inside its own common neighbourhood.
By Jensen, 1n∑v(d(v)/n)t≥(1n∑vd(v)/n)t=(d/n)t\frac1n\sum_v (d(v)/n)^t\ge\big(\frac1n\sum_v d(v)/n\big)^t=(d/n)^t. Uneven degrees only help.

Suppose m<dm<d. As tt grows, what happens to the ratio of the two terms, (nr)(m/n)t/n(d/n)t\binom nr(m/n)^t\big/\,n(d/n)^t?

  1. It tends to 0, because it equals (nr)n(m/d)t\frac{\binom nr}{n}(m/d)^t and m/d<1m/d<1.
  2. It grows, because (nr)\binom nr is huge.(nr)\binom nr is fixed while tt grows. Which factor depends on tt?
  3. It stays constant.Write the ratio out and see where tt appears.
More picks make bad sets die off faster than the good set shrinks. The price is that |A||A| itself shrinks like (d/n)t(d/n)^t, so tt is chosen just large enough.

Practice

Subdivided K5K_5Same recipe, new numbers

Repeat the worked example for K5K_5 with each edge subdivided. What constant cc do you get in ex(n,H)≤cn3/2\mathrm{ex}(n,H)\le c\,n^{3/2}?

Hint

Now |U|≥5|U|\ge5, and you embed 10 subdivision vertices. How many common neighbours does each pair need?

Solution

When placing a subdivision vertex, at most 5+9=145+9=14 vertices are already used, so m=15m=15 works. With t=2t=2 the bad term is below 152/2=112.515^2/2=112.5, so we need d2/n≥117.5d^2/n\ge117.5. Then e=nd/2≥117.52n3/2≈5.42n3/2e=nd/2\ge\frac{\sqrt{117.5}}2n^{3/2}\approx5.42\,n^{3/2} suffices.

The size of AAIndicators

Prove 𝔼|A|=∑v(d(v)/n)t\mathbb E|A|=\sum_v(d(v)/n)^t when the tt vertices are chosen independently and uniformly, with repetition allowed. Why does the lemma allow repetition?

Solution

|A|=∑v𝟏[v∈A]|A|=\sum_v\mathbf 1[v\in A], and v∈Av\in A exactly when each of the tt independent picks lies in N(v)N(v), which has probability (d(v)/n)t(d(v)/n)^t. Repetition makes the picks independent, so probabilities multiply exactly. Without repetition the formula would be a ratio of falling factorials, which is messier to estimate.

More practice: Li–Lin, Exercises 9.2 and 9.7.

CompareLi–Lin, Ch. 10: Quasi-Random Graphs

Quasi-random graphs

The Paley graph is completely determined by arithmetic, yet every statistic you compute says it looks random. Chung, Graham and Wilson showed that several very different-looking "random-like" properties are in fact equivalent. Compare four graphs of the same density and see which tests catch the fakes.

The idea

Fix 0<p<10<p<1 and a sequence of graphs GG on n→∞n\to\infty vertices. The following are equivalent; graphs satisfying them are called quasi-random with density pp.

  • Cycle count. e(G)≥(1+o(1))pn22e(G)\ge(1+o(1))\,p\frac{n^2}{2} and the number of closed 4-walks, tr⁡A4\operatorname{tr}A^4, is at most (1+o(1))p4n4(1+o(1))\,p^4n^4.
  • Discrepancy. For every vertex set SS, e(S)=p|S|22+o(n2)e(S)=p\frac{|S|^2}{2}+o(n^2).
  • Eigenvalues. λ1=(1+o(1))pn\lambda_1=(1+o(1))\,pn and every other eigenvalue has |λi|=o(n)|\lambda_i|=o(n).

The striking part is the first: one number, the 4-cycle count, controls the edge count of every subset.

Expander mixing lemma. If GG is dd-regular and λ=maxi≥2⁡|λi|\lambda=\max_{i\ge2}|\lambda_i|, then for all vertex sets S,TS,T,
|e(S,T)−d|S||T|n|≤λ|S||T|.\left|e(S,T)-\frac{d\,|S|\,|T|}{n}\right|\le\lambda\sqrt{|S|\,|T|}.

The Paley graph PqP_q is q−12\frac{q-1}2-regular with other eigenvalues −1±q2\frac{-1\pm\sqrt q}{2}, so it is quasi-random with p=12p=\tfrac12. Graphs with a small second eigenvalue are the source of many explicit Ramsey lower bounds, for multicolour numbers and for off-diagonal r(s,t)r(s,t).

Explore

Graph on 37 vertices, density about ½
Adjacency matrix: a filled cell at row ii, column jj means ijij is an edge. Rows of the tested set SS are marked in gold.
All 37 eigenvalues, largest first. The band shows ±n\pm\sqrt n, roughly where a random graph's non-top eigenvalues sit.

Worked example

For a prime q≡1(mod4)q\equiv1\pmod4, find the eigenvalues of PqP_q and use them to show α(Pq)≤q\alpha(P_q)\le\sqrt q.

  1. PqP_q is a circulant graph: x∼yx\sim y depends only on x−yx-y. What are the eigenvectors?

    For ω=e2πi/q\omega=e^{2\pi i/q} and each j∈ℤqj\in\mathbb Z_q, the vector uj=(ωjx)xu_j=(\omega^{jx})_{x} is an eigenvector with eigenvalue λj=∑s∈Qωjs\lambda_j=\sum_{s\in Q}\omega^{js}, where QQ is the set of nonzero squares. For j=0j=0 this is |Q|=q−12|Q|=\frac{q-1}2.

  2. Relate λj\lambda_j (j≠0j\ne0) to the Gauss sum gj=∑x∈ℤqωjx2g_j=\sum_{x\in\mathbb Z_q}\omega^{jx^2}.

    As xx runs over ℤq\mathbb Z_q, x2x^2 takes the value 0 once and each nonzero square twice. So gj=1+2λjg_j=1+2\lambda_j.

  3. Use the classical fact gj2=qg_j^2=q for q≡1(mod4)q\equiv1\pmod4 (gjg_j is real). What are the eigenvalues?

    gj=±qg_j=\pm\sqrt q, so λj=−1±q2\lambda_j=\frac{-1\pm\sqrt q}{2} for every j≠0j\ne0. Half of them take each sign.

  4. Apply Hoffman's bound α≤n−λmin⁡d−λmin⁡\alpha\le n\frac{-\lambda_{\min}}{d-\lambda_{\min}} for dd-regular graphs.

    With −λmin⁡=1+q2-\lambda_{\min}=\frac{1+\sqrt q}{2} and d−λmin⁡=q+q2d-\lambda_{\min}=\frac{q+\sqrt q}{2}: α(Pq)≤q⋅1+qq+q=q\alpha(P_q)\le q\cdot\frac{1+\sqrt q}{q+\sqrt q}=\sqrt q. For q=17q=17 this gives α≤4\alpha\le4; the truth is 3. The spectrum alone gets close.

Check your understanding

Two disjoint cliques of size n/2n/2 have edge density close to 12\tfrac12. Are they quasi-random?

  1. No. If SS is one of the cliques, e(S)≈|S|2/2e(S)\approx|S|^2/2, twice what density 12\tfrac12 predicts.
  2. Yes, the density is right.Density is a single number. Quasi-randomness asks every large subset to have the right density.
  3. Yes, because random halves have the right number of edges.They do, which is why the test must range over all sets, not random ones.
The discrepancy condition fails for one well-chosen set. The spectrum sees it too: the second eigenvalue is about n/2n/2, not o(n)o(n). Try it in the explorer.

"Shuffle the labels" changes the picture of the matrix but not the numbers. Why?

  1. Relabelling replaces AA by PAP−1PAP^{-1} for a permutation matrix PP, which has the same eigenvalues and the same tr⁡A4\operatorname{tr}A^4.
  2. Because the shuffle is undone before computing.It isn't. The stats are computed from the shuffled matrix.
  3. Because the graphs are all symmetric.Every adjacency matrix is symmetric. The point is what relabelling does to it.
Quasi-randomness is a property of the graph, not of a drawing. Structure that is obvious in one labelling can be invisible in another, but similar matrices have identical spectra.

A 500-regular graph on 1000 vertices has λ=maxi≥2⁡|λi|=30\lambda=\max_{i\ge2}|\lambda_i|=30. For sets S,TS,T of size 100, what range does the mixing lemma give for e(S,T)e(S,T)?

  1. Between 2000 and 8000.
  2. Between 4970 and 5030.The error term is λ|S||T|\lambda\sqrt{|S||T|}, not λ\lambda.
  3. Exactly 5000.5000 is the centre, d|S||T|/nd|S||T|/n. The lemma allows an error.
Centre 500⋅100⋅100/1000=5000500\cdot100\cdot100/1000=5000, error at most 30⋅100=300030\cdot100=3000. For larger sets the relative error shrinks: it is λn/(d|S||T|)\lambda n/(d\sqrt{|S||T|}).

Practice

Every graph has many 4-cyclesThe easy half of the cycle count

Let GG have nn vertices and e=pn2/2e=pn^2/2 edges. Show tr⁡A4≥p4n4\operatorname{tr}A^4\ge p^4n^4.

Hint

tr⁡A4=∑λi4\operatorname{tr}A^4=\sum\lambda_i^4. Bound λ1\lambda_1 below using the all-ones vector.

Solution

By the Rayleigh quotient with 𝟏\mathbf 1, λ1≥𝟏TA𝟏n=2en=pn\lambda_1\ge\frac{\mathbf 1^TA\mathbf 1}{n}=\frac{2e}{n}=pn. So tr⁡A4=∑iλi4≥λ14≥p4n4\operatorname{tr}A^4=\sum_i\lambda_i^4\ge\lambda_1^4\ge p^4n^4. Quasi-random graphs are exactly those where this is nearly tight.

Random tests miss structureWhy "every set" matters

In two disjoint cliques of size n/2n/2, let SS be a uniformly random set of size ss. Estimate e(S)e(S), and explain why random sets cannot detect this structure.

Solution

SS has about s/2s/2 vertices in each clique, so e(S)≈2(s/22)≈s2/4=12⋅s22e(S)\approx2\binom{s/2}{2}\approx s^2/4=\tfrac12\cdot\frac{s^2}{2}: exactly what density 12\tfrac12 predicts. Only special sets, like one whole clique, reveal the structure. That is why the discrepancy property quantifies over every set, and why spectral and cycle-count tests, which see all sets at once, are so useful.

More practice: Li–Lin, Exercises 10.1 and 10.5.

Play it yourselfLi–Lin, Ch. 11: Regularity Lemma and van der Waerden Number

Van der Waerden and regularity

Colour 1,2,…,N1,2,\dots,N in two colours: once NN is large, some arithmetic progression is monochromatic. Szemerédi's work on the density version of this produced the regularity lemma, which says every large graph is a bounded number of random-looking pieces.

The idea

Van der Waerden's theorem. For all kk and tt there is NN such that every kk-colouring of {1,…,N}\{1,\dots,N\} contains a monochromatic arithmetic progression of length tt. The least such NN is wk(t)w_k(t); write w(t)w(t) for two colours.

Known exactly: w(3)=9w(3)=9, w(4)=35w(4)=35, w(5)=178w(5)=178, w(6)=1132w(6)=1132. Szemerédi's theorem is the density version: any set of integers with positive upper density contains arbitrarily long progressions.

Regular pairs. For disjoint vertex sets X,YX,Y, the density is d(X,Y)=e(X,Y)|X||Y|d(X,Y)=\frac{e(X,Y)}{|X||Y|}. The pair is ε\varepsilon-regular if |d(X′,Y′)−d(X,Y)|≤ε|d(X',Y')-d(X,Y)|\le\varepsilon for all X′⊆XX'\subseteq X, Y′⊆YY'\subseteq Y with |X′|≥ε|X||X'|\ge\varepsilon|X|, |Y′|≥ε|Y||Y'|\ge\varepsilon|Y|. Edges between a regular pair are spread like random edges.
Szemerédi's regularity lemma. For every ε>0\varepsilon>0 and mm there is MM such that every graph with at least mm vertices has a partition V0∪V1∪⋯∪VkV_0\cup V_1\cup\dots\cup V_k, with m≤k≤Mm\le k\le M, |V0|≤εn|V_0|\le\varepsilon n, |V1|=⋯=|Vk||V_1|=\dots=|V_k|, in which all but at most εk2\varepsilon k^2 of the pairs (Vi,Vj)(V_i,V_j) are ε\varepsilon-regular.

MM does not depend on the graph, but it grows like a tower of 2s of height polynomial in 1/ε1/\varepsilon, and Gowers showed this is unavoidable. Uses in Ramsey theory: graphs of bounded maximum degree have Ramsey numbers linear in their order (Chvátal, Rödl, Szemerédi and Trotter), and Ramsey–Turán problems such as RT(n,K4,o(n))=(18+o(1))n2\mathrm{RT}(n,K_4,o(n))=(\tfrac18+o(1))n^2.

Explore

Click a number to colour it red, again for blue, again to clear. A monochromatic progression is outlined, with its first term and common difference listed below.
Board

Worked example

Prove w(3)≤9w(3)\le9: every red/blue colouring of {1,…,9}\{1,\dots,9\} has a monochromatic 3-term progression. Suppose one doesn't, and look at 4, 5 and 6.

  1. Suppose 4 and 6 have the same colour, say red. What goes wrong?

    2 (from 2, 4, 6), 5 (from 4, 5, 6) and 8 (from 4, 6, 8) must all be blue. But 2, 5, 8 is a progression. The same happens if 4 and 6 are both blue.

  2. So 4 and 6 differ, say 4 red and 6 blue. Reflecting x↦10−xx\mapsto10-x and swapping the colours preserves this situation and sends a red 5 to a blue 5. Why may we assume 5 is red?

    The reflection maps progressions to progressions, and swapping colours keeps "monochromatic". Under the combined map, 4 (red) goes to 6 and becomes blue, 6 (blue) goes to 4 and becomes red, and 5's colour flips. So the case "5 blue" turns into the case "5 red".

  3. With 4, 5 red and 6 blue, force as many colours as you can.

    3 is blue (3, 4, 5). Then 9 is red (3, 6, 9). Then 7 is blue (5, 7, 9), and 8 is red (6, 7, 8). Also 1 is blue (1, 5, 9), so 2 is red (1, 2, 3).

  4. Find the contradiction.

    2, 5 and 8 are all red. So no good colouring of {1,…,9}\{1,\dots,9\} exists. The colouring RRBBRRBB of {1,…,8}\{1,\dots,8\} shows w(3)>8w(3)>8, so w(3)=9w(3)=9.

Check your understanding

Extend the good colouring RRBBRRBB of {1,…,8}\{1,\dots,8\} by colouring 9 red. Which progression is now monochromatic?

  1. 1, 5, 9
  2. 3, 6, 93 is blue and 6 is red.
  3. 2, 5, 88 is blue.
1, 5 and 9 are all red. Colouring 9 blue fails too (7, 8, 9 are then all blue), which is a quick way to see that this particular colouring cannot be extended.

|X|=|Y|=100|X|=|Y|=100. The only edges join the first 50 vertices of XX to the first 50 of YY, all of them. The density is 14\tfrac14. Is (X,Y)(X,Y) 0.10.1-regular?

  1. No: those two halves have density 1, far from 14\tfrac14.
  2. Yes: regularity only asks about the overall density.It asks about every pair of subsets of at least ε\varepsilon times the size.
  3. Yes: halves are too small to count.The threshold is ε|X|=10\varepsilon|X|=10 vertices, and 50 is well above it.
With X′X' and Y′Y' the two halves, |d(X′,Y′)−d(X,Y)|=34>0.1|d(X',Y')-d(X,Y)|=\tfrac34>0.1. A regular pair cannot hide a dense block on a large piece.

V1,V2,V3V_1,V_2,V_3 are pairwise ε\varepsilon-regular with densities d12,d13,d23d_{12},d_{13},d_{23}, all well above ε\varepsilon. Roughly how many triangles have one vertex in each?

  1. About d12d13d23|V1||V2||V3|d_{12}d_{13}d_{23}\,|V_1||V_2||V_3|, as for random edges.
  2. Possibly none.That can happen for dense pairs that are not regular. Regularity is what rules it out.
  3. About (d12+d13+d23)|V1||V2||V3|/3(d_{12}+d_{13}+d_{23})\,|V_1||V_2||V_3|/3.A triangle needs all three edges, so the densities multiply.
This is the triangle counting lemma, the step that makes the regularity lemma useful: a triangle in the "reduced graph" of dense regular pairs gives many real triangles.

Practice

Counting 4-term progressionsWhy good colourings are rare

How many 4-term progressions does {1,…,34}\{1,\dots,34\} contain? How many monochromatic ones does a random 2-colouring have on average?

Hint

For common difference δ\delta, the first term aa needs a+3δ≤34a+3\delta\le34.

Solution

For δ=1,…,11\delta=1,\dots,11 there are 34−3δ34-3\delta choices of aa, giving ∑δ=111(34−3δ)=374−198=176\sum_{\delta=1}^{11}(34-3\delta)=374-198=176. Each is monochromatic with probability 2⋅2−4=182\cdot2^{-4}=\tfrac18, so the average is 22. A good colouring exists (try "Show a good colouring" on the 34-board), but a random one is far from it.

Progressions inside progressionsScaling

Show that if a,a+δ,…,a+(N−1)δa,a+\delta,\dots,a+(N-1)\delta is 2-coloured with N≥w(t)N\ge w(t), it contains a monochromatic tt-term progression.

Solution

Colour i∈{1,…,N}i\in\{1,\dots,N\} with the colour of a+(i−1)δa+(i-1)\delta. A monochromatic progression i,i+c,…i,i+c,\dots gives the monochromatic progression a+(i−1)δ, a+(i−1+c)δ,…a+(i-1)\delta,\ a+(i-1+c)\delta,\dots, with difference cδc\delta. This is the kind of step used in the proofs of the recursive bounds for wk(t)w_k(t).

More practice: Li–Lin, Exercises 11.1 and 11.8.

Construction labLi–Lin, Ch. 12: More Ramsey Linear Functions

Linear Ramsey numbers

For complete graphs Ramsey numbers grow exponentially. For sparse graphs they can be linear in the number of vertices, sometimes with an exact formula. Trees against cliques is the cleanest case: one construction gives the lower bound, and it is the truth.

The idea

Burr's lower bound. Let GG be connected and let σ(H)\sigma(H) be the smallest possible colour class in a proper χ(H)\chi(H)-colouring of HH. If |G|≥σ(H)|G|\ge\sigma(H), then
r(G,H)≥(χ(H)−1)(|G|−1)+σ(H).r(G,H)\ge(\chi(H)-1)(|G|-1)+\sigma(H).

Construction: take χ(H)−1\chi(H)-1 red cliques of size |G|−1|G|-1 and one red clique of size σ(H)−1\sigma(H)-1, and colour every edge between different cliques blue. Red components are too small to hold GG, and a blue HH would need a proper colouring with too few or too small classes.

Goodness. GG is HH-good if equality holds. For H=KpH=K_p the bound reads (p−1)(|G|−1)+1(p-1)(|G|-1)+1, and GG is called pp-good.
Chvátal's theorem. Every tree TT on mm vertices is pp-good for every pp: r(T,Kp)=(m−1)(p−1)+1r(T,K_p)=(m-1)(p-1)+1.

Other exact results: r(Pm,Pn)=n+⌊m/2⌋−1r(P_m,P_n)=n+\lfloor m/2\rfloor-1 for n≥m≥2n\ge m\ge2 (Gerencsér–Gyárfás); r(K1,m,K1,n)=m+n−ϵr(K_{1,m},K_{1,n})=m+n-\epsilon, with ϵ=1\epsilon=1 if m,nm,n are both even and 0 otherwise (Harary); r(C4,C4)=6r(C_4,C_4)=6. Large book graphs are pp-good, subdivided graphs have linear Ramsey numbers, and Lee proved the Burr–Erdős conjecture: dd-degenerate graphs have Ramsey numbers linear in their order.

Explore

Click an edge: red, then blue, then uncoloured. Avoid a red copy of the first graph and a blue copy of the second; any copy found is highlighted.
Pair (red, blue)
Board

Worked example

Prove Chvátal's upper bound: if TT is a tree on mm vertices and N=(m−1)(p−1)+1N=(m-1)(p-1)+1, every red/blue colouring of KNK_N has a red TT or a blue KpK_p.

  1. Show that a graph with minimum degree at least m−1m-1 contains every tree on mm vertices.

    Embed TT one vertex at a time, always adding a leaf next to an already embedded vertex uu. Fewer than m−1m-1 other vertices have been used, and uu has at least m−1m-1 neighbours, so one is free.

  2. Suppose the red graph RR has no copy of TT. What can you say about every subgraph of RR?

    Every subgraph has a vertex of degree at most m−2m-2, by step 1. So RR is (m−2)(m-2)-degenerate: repeatedly removing a vertex of degree at most m−2m-2 empties it.

  3. Why does that give χ(R)≤m−1\chi(R)\le m-1?

    Colour the vertices greedily in the reverse of the removal order. Each vertex has at most m−2m-2 neighbours coloured before it, so one of m−1m-1 colours is free.

  4. Finish.

    Some colour class of RR has at least N/(m−1)>p−1N/(m-1)>p-1 vertices, so at least pp. It is independent in RR, so all edges inside it are blue: a blue KpK_p. With Burr's construction, r(T,Kp)=(m−1)(p−1)+1r(T,K_p)=(m-1)(p-1)+1.

Check your understanding

What lower bound does Burr's construction give for r(P5,K4)r(P_5,K_4), where P5P_5 is the path on 5 vertices?

  1. 13
  2. 16The red cliques have |G|−1=4|G|-1=4 vertices, not |G||G|.
  3. 9There are χ(K4)−1=3\chi(K_4)-1=3 red cliques, not 2.
(4−1)(5−1)+1=13(4-1)(5-1)+1=13: three red K4K_4's with blue between them is a colouring of K12K_{12} with no red P5P_5 and no blue K4K_4. By Chvátal's theorem 13 is exact.

In the construction for a tree TT on mm vertices against KpK_p, why is there no red TT?

  1. Every red component has only m−1m-1 vertices, and TT is connected with mm vertices.
  2. Because the red graph is bipartite.The red graph is a union of cliques, far from bipartite.
  3. Because trees need a vertex of high degree.Paths are trees with maximum degree 2. The reason is size, not degree.
A connected red subgraph lies inside one red component. Connectedness of GG is exactly why Burr's bound assumes it.

Burr's bound with G=H=K1,3G=H=K_{1,3} gives (2−1)(4−1)+1=4(2-1)(4-1)+1=4. The true value is r(K1,3,K1,3)=6r(K_{1,3},K_{1,3})=6. What does this show?

  1. K1,3K_{1,3} is not K1,3K_{1,3}-good: the bound can be strict.
  2. Burr's bound is wrong for stars.A lower bound below the truth is still correct.
  3. r(K1,3,K1,3)r(K_{1,3},K_{1,3}) must be 4.The pentagon colouring of K5K_5 (try it in the lab) has no monochromatic K1,3K_{1,3}.
Goodness is a special property, not a general rule. For two stars the extremal colourings are regular-looking (each colour 2-regular on K5K_5), not block-structured.

Practice

A star against a triangleChvátal, and a direct proof

Show that r(K1,n,K3)=2n+1r(K_{1,n},K_3)=2n+1, first from Chvátal's theorem and then directly.

Hint

Directly: if no vertex has nn red edges, every vertex has many blue edges. Two blue neighbours of each other then share a blue neighbour.

Solution

K1,nK_{1,n} is a tree on n+1n+1 vertices, so Chvátal gives n⋅2+1n\cdot2+1. Directly, in K2n+1K_{2n+1} with no red K1,nK_{1,n}, each vertex has at most n−1n-1 red and so at least n+1n+1 blue edges. Take a blue edge uvuv: uu and vv each have at least nn further blue neighbours among the other 2n−12n-1 vertices, so they share one, giving a blue triangle. Two red KnK_n's with blue between them show 2n2n is not enough.

Two 4-cyclesA pentagon again

Show that r(C4,C4)≥6r(C_4,C_4)\ge6.

Solution

Colour a 5-cycle in K5K_5 red and its complement, another 5-cycle, blue. A 5-cycle has no 4-cycle (it has no cycle other than itself), so neither colour contains C4C_4. The lab confirms that every colouring of K6K_6 fails.

More practice: Li–Lin, Exercises 12.2 and 12.3.

Play it yourselfLi–Lin, Ch. 13: Various Ramsey Problems

Bipartite, size and other variants

Change what is coloured, or what is counted, and you get a new Ramsey problem. Colour the edges of a complete bipartite graph, ask for the fewest edges rather than the fewest vertices, demand induced copies, or forbid large cliques in the host. The grid game below is the smallest bipartite case.

The idea

Bipartite Ramsey number. br(B1,B2)br(B_1,B_2) is the least NN such that every red/blue colouring of KN,NK_{N,N} contains a red B1B_1 or a blue B2B_2. Since K2N⊇KN,NK_{2N}\supseteq K_{N,N}, r(B1,B2)≤2br(B1,B2)r(B_1,B_2)\le2\,br(B_1,B_2).
Known. br(K2,2)=5br(K_{2,2})=5. Thomason: br(Km,n)≤2m(n−1)+1br(K_{m,n})\le2^m(n-1)+1 for n≥mn\ge m. Conlon: br(Kn,n)≤(1+o(1))2n+1log2⁡nbr(K_{n,n})\le(1+o(1))\,2^{n+1}\log_2 n.
Size Ramsey number. r^(G,H)\hat r(G,H) is the fewest edges of a graph FF such that every red/blue colouring of FF has a red GG or a blue HH. For example r^(K1,n,K1,n)=2n−1\hat r(K_{1,n},K_{1,n})=2n-1, and r^(Kn,Kn)=(r(n,n)2)\hat r(K_n,K_n)=\binom{r(n,n)}2: for cliques nothing beats the complete graph. Beck showed paths have linear size Ramsey numbers.
Induced and Folkman. For every graph HH there is a graph GG such that every 2-colouring of E(G)E(G) contains a monochromatic induced copy of HH. And there are graphs with no K4K_4 in which every 2-colouring of the edges has a monochromatic triangle (Folkman): forcing a triangle does not require large cliques.

Explore

Row ii is xix_i, column jj is yjy_j, and cell (i,j)(i,j) is the edge xiyjx_iy_j. A monochromatic K2,2K_{2,2} is four cells of one colour at the corners of a rectangle. Click to cycle red, blue, uncoloured.
Board

Worked example

Prove that every red/blue colouring of K5,5K_{5,5} contains a monochromatic K2,2K_{2,2}. Think of the 5×5 grid above.

  1. A monochromatic rectangle is two rows and two columns with all four cells one colour. Rephrase in terms of "monochromatic row pairs" in each column.

    Say column jj has a red row pair {a,b}\{a,b\} if cells (a,j)(a,j) and (b,j)(b,j) are both red. A red rectangle is a red row pair shared by two columns, and similarly for blue. So with no monochromatic rectangle, each (row pair, colour) combination occurs in at most one column. There are (52)⋅2=20\binom52\cdot2=20 combinations.

  2. A column has aa red and 5−a5-a blue cells. How many monochromatic row pairs does it have, at least?

    (a2)+(5−a2)\binom a2+\binom{5-a}2, which is 4 when a=2a=2 or 33, and at least 6 otherwise. So the five columns give at least 20 monochromatic row pairs.

  3. Combine steps 1 and 2. What must every column look like?

    At least 20 pairs into at most 20 slots, so equality everywhere: every column has 2 or 3 red cells, and all 10 red row pairs are used exactly once.

  4. Count red row pairs and reach a contradiction.

    If xx columns have 3 red cells and 5−x5-x have 2, the red row pairs number 3x+(5−x)=2x+53x+(5-x)=2x+5. This must equal 10, so x=2.5x=2.5, which is impossible. Hence br(K2,2)≤5br(K_{2,2})\le5; the 4×4 board has a good colouring, so br(K2,2)=5br(K_{2,2})=5.

Check your understanding

Why is r(B1,B2)≤2br(B1,B2)r(B_1,B_2)\le2\,br(B_1,B_2) for bipartite B1,B2B_1,B_2?

  1. Split K2NK_{2N} into two halves of size NN: the edges between them form a KN,NK_{N,N}, and its colouring already contains what we need.
  2. Because K2NK_{2N} has twice as many edges as KN,NK_{N,N}.It has about twice as many, but the argument needs a copy of KN,NK_{N,N} inside K2NK_{2N}, not an edge count.
  3. Because bipartite graphs have chromatic number 2.True, but the inequality comes from finding KN,NK_{N,N} inside K2NK_{2N}.
Any colouring of K2NK_{2N} restricts to a colouring of the KN,NK_{N,N} between the halves, and with N=br(B1,B2)N=br(B_1,B_2) that contains a red B1B_1 or a blue B2B_2.

K6K_6 has 15 edges and every 2-colouring of it has a monochromatic triangle. Is there a graph with fewer edges with the same property?

  1. No: r^(K3,K3)=(62)=15\hat r(K_3,K_3)=\binom{6}{2}=15.
  2. Yes: the Folkman graphs.Folkman graphs avoid K4K_4, but they are large and have many more edges.
  3. Yes: K5K_5 with one extra vertex of degree 3.Colour K5K_5 as two pentagons. Can the new vertex's three edges always be coloured safely?
For complete graphs the size Ramsey number is (r(n,n)2)\binom{r(n,n)}{2}: you cannot save edges by using a sparser host. (For the extra vertex of degree 3: colour K5K_5 as two pentagons; whichever three neighbours it has, its three edges can be coloured without closing a monochromatic triangle.)

Can a triangle-free graph GG have the property that every 2-colouring of its edges contains a monochromatic triangle?

  1. No: GG has no triangles at all, monochromatic or not.
  2. Yes, by Folkman's theorem.Folkman's graphs avoid K4K_4, not K3K_3.
  3. Yes, if GG is large enough.A colouring cannot create a triangle that is not there.
To force a monochromatic K3K_3 the host must contain K3K_3. Folkman's surprise is that it need not contain K4K_4, even though the obvious host K6K_6 does.

Practice

Size Ramsey for starsUpper and lower bounds

Show that r^(K1,n,K1,n)≤2n−1\hat r(K_{1,n},K_{1,n})\le2n-1, and that the star K1,2n−2K_{1,2n-2} is not enough.

Solution

In any 2-colouring of the 2n−12n-1 edges of K1,2n−1K_{1,2n-1}, one colour has at least nn edges, all at the centre: a monochromatic K1,nK_{1,n}. In K1,2n−2K_{1,2n-2}, colour n−1n-1 edges red and n−1n-1 blue; no vertex has nn edges of one colour. (The matching lower bound, that no graph with 2n−22n-2 edges works, takes more care.)

The 4×4 boardA good colouring

Find a colouring of K4,4K_{4,4} with no monochromatic K2,2K_{2,2}, and check it.

Hint

A monochromatic rectangle means two rows that share two red columns, or two blue columns. Start from the row RRRB and choose the other rows so that every pair of rows shares at most one red and at most one blue column.

Solution

Rows (R = red, B = blue): RRRB, RBBR, BRBR, BBRR. Check the six pairs of rows: each pair shares at most one red column and at most one blue column (rows 2 and 3, for example, share column 3 in blue and column 4 in red). So no rectangle is monochromatic. "Show a good colouring" on the 4×4 board loads it.

More practice: Li–Lin, Exercises 13.1 and 13.5.