Skip to content
The Lumenary
First-year graduateGraduate 135 min

The probabilistic method

To prove that an object exists, choose one at random and show that it works with positive probability — Ramsey colourings, large cuts, graphs of high girth, satisfiable formulas and balanced colourings, all from coin flips.

Formally verified · 15 LeanComputationally tested · 3 PythonAI-drafted · awaiting human reviewMathematically reviewed: Awaiting human review
MotivationH

A colouring nobody can write down

Colour every edge of the complete graph KnK_n red or blue. Ramsey's theorem says that if nn is large enough there is always a monochromatic KkK_k — kk vertices all of whose connecting edges have the same colour. The least such nn is the Ramsey number R(k,k)R(k, k). Among any six people there are three mutual acquaintances or three mutual strangers (R(3,3)=6R(3, 3) = 6); R(4,4)=18R(4, 4) = 18 (Greenwood and Gleason, 1955); and already R(5,5)R(5, 5) is unknown — it lies between 4343 (Exoo, 1989) and 4646 (Angeltveit and McKay, 2024). Erdős and Szekeres (1935) showed R(k,k)≤(2k−2k−1)<4kR(k, k) \leq \binom{2k-2}{k-1} < 4^k, and after decades of small improvements Campos, Griffiths, Morris and Sahasrabudhe (2023) proved R(k,k)≤(4−ε)kR(k, k) \leq (4 - \varepsilon)^k for some ε>0\varepsilon > 0.

For a lower bound we need, for large nn, a colouring of KnK_n with no monochromatic KkK_k. Nobody knows how to construct one with nn exponential in kk: Erdős offered a prize for an explicit colouring with n≥(1+ε)kn \geq (1 + \varepsilon)^k, and the best explicit constructions are still far from exponential. Yet in 1947 Erdős proved in a few lines that such colourings exist with n=2k/2n = 2^{k/2}: colour at random. The expected number of monochromatic KkK_k is less than 11, so some colouring has none. This lower bound has not been improved exponentially since; only the constant factor has moved (Spencer, 1975, by the local lemma).

That is the probabilistic method: to show an object with a property exists, define a probability distribution on objects and show that a random object has the property with positive probability. On a finite space it is a counting argument in disguise — the Lean proof below is pure counting — but the language of probability (independence, expectation, concentration) is what makes the counts tractable. This lesson assumes graph theory (including R(3,3)=6R(3, 3) = 6) and probability theory (expectation, variance, Chebyshev's inequality).

IntuitionH

Averages, deletions, and rare bad events

Five ideas organise the subject.

  1. The first moment. If X≥0X \geq 0 is integer-valued and E[X]<1\mathbb{E}[X] < 1, then P(X=0)>0\mathbb{P}(X = 0) > 0. If E[X]≥c\mathbb{E}[X] \geq c, then X≥cX \geq c for some outcome. Expectation is easy to compute because it is linear, with no independence needed: the expected number of bad configurations is the sum of their probabilities.
  2. Alteration. If a random object has a few defects, delete or repair them: a random colouring of KnK_n with on average EE monochromatic KkK_k's yields, after deleting a vertex from each, a good colouring on n−En - E vertices.
  3. The second moment. To show that X>0X > 0 with high probability it is not enough that E[X]→∞\mathbb{E}[X] \to \infty; we also need XX to be concentrated: Var⁡X=o(E[X]2)\operatorname{Var}X = o(\mathbb{E}[X]^2).
  4. The local lemma. If bad events are individually unlikely and each depends on only a few others, then with positive (possibly tiny) probability none occurs — even when there are far too many for the union bound.
  5. Concentration. Sums of many independent small contributions are exponentially unlikely to deviate far from their mean (Chernoff), much better than Chebyshev's polynomial bound.

The method proves existence, but its proofs often say little about how to find the object. Sometimes they do: if good objects are common, sampling finds one fast; the method of conditional expectations and the Moser–Tardos algorithm turn some proofs into deterministic or efficient algorithms.

DefinitionsH

Definitions

Definition— Ramsey numbers

R(k,ℓ)R(k, \ell) is the least nn such that every red/blue colouring of the edges of KnK_n contains a red KkK_k or a blue KℓK_\ell. Equivalently, every graph on nn vertices contains a clique of size kk or an independent set of size ℓ\ell. So R(k,k)>nR(k, k) > n means: some colouring of KnK_n has no monochromatic KkK_k.

Definition— the random graph G(n, p)

G(n,p)G(n, p) is the graph on {1,…,n}\{1, \dots, n\} in which each of the (n2)\binom n2 possible edges is present independently with probability pp. G(n,12)G(n, \frac12) is the uniform distribution on all 2(n2)2^{\binom n2} graphs — equivalently, a uniformly random red/blue colouring of KnK_n. A property holds with high probability if its probability tends to 11 as n→∞n \to \infty.

Definition— Markov's and Chebyshev's inequalities

For X≥0X \geq 0 and a>0a > 0, P(X≥a)≤E[X]/a\mathbb{P}(X \geq a) \leq \mathbb{E}[X]/a (Markov). For any XX with finite variance, P(∣X−EX∣≥a)≤Var⁡X/a2\mathbb{P}(|X - \mathbb{E}X| \geq a) \leq \operatorname{Var}X/a^2 (Chebyshev). Taking a=1a = 1 in Markov for integer X≥0X \geq 0 gives the first-moment method: P(X≠0)≤E[X]\mathbb{P}(X \neq 0) \leq \mathbb{E}[X]. Taking a=EXa = \mathbb{E}X in Chebyshev gives the second-moment method: P(X=0)≤Var⁡X/(EX)2\mathbb{P}(X = 0) \leq \operatorname{Var}X/(\mathbb{E}X)^2.

Definition— dependency graph

Events A1,…,AmA_1, \dots, A_m have a dependency graph DD on {1,…,m}\{1, \dots, m\} if each AiA_i is mutually independent of the family {Aj:j≠i, j≁i}\{A_j : j \neq i,\ j \not\sim i\} of events not adjacent to it. (Pairwise independence is not enough; mutual independence of AiA_i from the whole family is required.) If all events are determined by independent random variables and AiA_i, AjA_j are joined whenever they share a variable, this is a dependency graph.

Definition— girth, chromatic number, independence number

The girth of a graph is the length of its shortest cycle; the chromatic number χ(G)\chi(G) is the least number of colours in a proper vertex colouring; the independence number α(G)\alpha(G) is the largest size of a set of pairwise non-adjacent vertices. Each colour class of a proper colouring is independent, so χ(G)≥∣V(G)∣/α(G)\chi(G) \geq |V(G)|/\alpha(G).

Worked examplesH

Warm-up examples

Example— Large cuts

Every graph with mm edges has a bipartition of its vertices that cuts at least m/2m/2 edges. Proof. Put each vertex on side 00 or 11 by independent fair coin flips. An edge is cut with probability 12\frac12, so by linearity the expected number of cut edges is m/2m/2, and some bipartition does at least as well as the average. Note that the indicator variables "edge ee is cut" are pairwise independent but not mutually independent (the three edges of a triangle cannot all be cut) — linearity does not care.

Example— Tournaments with many Hamiltonian paths (Szele, 1943)

A tournament orients every edge of KnK_n. Orient each edge by a fair coin. For each of the n!n! orderings v1,…,vnv_1, \dots, v_n of the vertices, the probability that v1→v2→⋯→vnv_1 \to v_2 \to \cdots \to v_n is a directed path is 2−(n−1)2^{-(n-1)}. So the expected number of Hamiltonian paths is n!/2n−1n!/2^{n-1}, and some tournament has at least that many — one of the first applications of the method.

Example— Independent sets (Caro, 1979; Wei, 1981)

Every graph satisfies α(G)≥∑v1d(v)+1\alpha(G) \geq \sum_v \frac{1}{d(v) + 1}. Proof. Order the vertices uniformly at random and let II be the set of vertices that come before all their neighbours. II is independent, and v∈Iv \in I with probability 1d(v)+1\frac{1}{d(v) + 1} (among vv and its d(v)d(v) neighbours, each is equally likely to be first). So E∣I∣=∑v1d(v)+1\mathbb{E}|I| = \sum_v \frac{1}{d(v)+1}. By convexity this is at least ndˉ+1\frac{n}{\bar d + 1}, where dˉ\bar d is the average degree — a form of Turán's theorem.

Example— Two-colouring hypergraphs (Erdős, 1963)

A family of mm sets, each of size kk, with m<2k−1m < 2^{k-1}, can be 2-coloured so that no set is monochromatic. Proof. Colour the points at random; each set is monochromatic with probability 21−k2^{1-k}, and the expected number of monochromatic sets is m21−k<1m2^{1-k} < 1. This is the same calculation as Theorem 1, with the kk-sets of vertices replaced by arbitrary sets.

ProofH

The main theorems

Theorem— Theorem 1 (Erdős, 1947)

If (nk)21−(k2)<1\binom nk 2^{1 - \binom k2} < 1, then R(k,k)>nR(k, k) > n. In particular R(k,k)>⌊2k/2⌋R(k, k) > \lfloor 2^{k/2}\rfloor for every k≥3k \geq 3.

Proof

Colour the edges of KnK_n independently and uniformly at random. For a fixed set SS of kk vertices, the (k2)\binom k2 edges inside SS are all red with probability 2−(k2)2^{-\binom k2} and all blue with the same probability, so P(S monochromatic)=21−(k2)\mathbb{P}(S \text{ monochromatic}) = 2^{1 - \binom k2}. Let XX be the number of monochromatic kk-sets. By linearity, E[X]=(nk)21−(k2)<1\mathbb{E}[X] = \binom nk 2^{1-\binom k2} < 1, so P(X=0)>0\mathbb{P}(X = 0) > 0: some colouring has no monochromatic KkK_k, and R(k,k)>nR(k, k) > n.

Now let k≥3k \geq 3 and n=⌊2k/2⌋n = \lfloor 2^{k/2}\rfloor, so n2≤2kn^2 \leq 2^k. Using (nk)≤nkk!\binom nk \leq \frac{n^k}{k!} and nk≤2k2/2n^k \leq 2^{k^2/2},

(nk)21−(k2)≤2k2/2k!⋅21−k22+k2=21+k/2k!<1,\binom nk 2^{1 - \binom k2} \leq \frac{2^{k^2/2}}{k!}\cdot 2^{1 - \frac{k^2}{2} + \frac k2} = \frac{2^{1 + k/2}}{k!} < 1,

because k!>21+k/2k! > 2^{1 + k/2} for k≥3k \geq 3, i.e. (k!)2>4⋅2k(k!)^2 > 4 \cdot 2^k: true for k=3k = 3 (36>3236 > 32), and each step multiplies the left side by (k+1)2≥16(k + 1)^2 \geq 16 and the right side by 22.

∎

The Lean formalisation below proves exactly this, phrased as counting: at most (nk)⋅2⋅2(n2)−(k2)\binom nk \cdot 2 \cdot 2^{\binom n2 - \binom k2} of the 2(n2)2^{\binom n2} colourings have a monochromatic KkK_k, and this is fewer than all of them. The proof gives no colouring — and for k=4k = 4 it is weak (it shows only R(4,4)>6R(4, 4) > 6), while the explicit Paley colouring of K17K_{17} (red when i−ji - j is a square mod 1717) shows R(4,4)>17R(4, 4) > 17. The first experiment checks both. For large kk the roles reverse: random colourings beat every known construction.

Theorem— Theorem 2 (the deletion method)

For all nn and kk, R(k,k)>n−(nk)21−(k2)R(k, k) > n - \binom nk 2^{1 - \binom k2}. Choosing nn optimally gives R(k,k)>(1e+o(1))k 2k/2R(k, k) > \left(\tfrac1e + o(1)\right)k\,2^{k/2}, a factor 2\sqrt 2 better than the best bound obtainable from Theorem 1, which is (1e2+o(1))k 2k/2\left(\tfrac{1}{e\sqrt 2} + o(1)\right)k\,2^{k/2}.

Proof

With XX as above, E[X]=E:=(nk)21−(k2)\mathbb{E}[X] = E := \binom nk 2^{1-\binom k2}, so some colouring has X≤EX \leq E. Delete one vertex from each monochromatic kk-set: at least n−En - E vertices remain, and the colouring restricted to them has no monochromatic KkK_k. So R(k,k)>n−ER(k, k) > n - E. For the asymptotics, (nk)≤(en/k)k\binom nk \leq (en/k)^k and one takes n=ke2k/2(1−o(1))n = \frac{k}{e}2^{k/2}(1 - o(1)) chosen so that E=o(n)E = o(n); see Alon–Spencer, §3.1.

∎

Theorem— Theorem 3 (Erdős, 1959: high girth and high chromatic number)

For all integers g,k≥3g, k \geq 3 there is a graph with girth greater than gg and chromatic number greater than kk.

Proof

Fix 0<θ<1/g0 < \theta < 1/g, let p=nθ−1p = n^{\theta - 1} and consider G∼G(n,p)G \sim G(n, p) for large nn.

Few short cycles. Let YY be the number of cycles of length at most gg. A cycle of length ii is determined by an ordered sequence of ii distinct vertices up to 2i2i rotations and reflections, so

E[Y]=∑i=3g(n)i2ipi≤∑i=3g(np)i2i≤g nθg=o(n),\mathbb{E}[Y] = \sum_{i=3}^{g}\frac{(n)_i}{2i}p^i \leq \sum_{i=3}^g \frac{(np)^i}{2i} \leq g\,n^{\theta g} = o(n),

since θg<1\theta g < 1. By Markov's inequality, P(Y≥n/2)≤2 E[Y]n→0\mathbb{P}(Y \geq n/2) \leq \frac{2\,\mathbb{E}[Y]}{n} \to 0.

No large independent sets. Let a=⌈3plog⁡n⌉a = \lceil \frac{3}{p}\log n\rceil. The probability that some aa-set is independent is at most

(na)(1−p)(a2)<(n e−p(a−1)/2)a≤(n⋅n−3/2 ep/2)a→0.\binom na (1 - p)^{\binom a2} < \left(n\,e^{-p(a-1)/2}\right)^a \leq \left(n \cdot n^{-3/2}\, e^{p/2}\right)^a \to 0.

Deletion. For large nn both bad events have probability less than 12\frac12, so some graph GG on nn vertices has Y<n/2Y < n/2 and α(G)<a\alpha(G) < a. Delete one vertex from each cycle of length at most gg. The resulting graph G∗G^* has more than n/2n/2 vertices, girth greater than gg, and α(G∗)≤α(G)<a\alpha(G^*) \leq \alpha(G) < a. Therefore

χ(G∗)≥∣V(G∗)∣α(G∗)>n/2a≈nθ6log⁡n→∞,\chi(G^*) \geq \frac{|V(G^*)|}{\alpha(G^*)} > \frac{n/2}{a} \approx \frac{n^\theta}{6\log n} \to \infty,

which exceeds kk for large nn.

∎

Explicit graphs with these properties were found later (Lovász, 1968, and, much more elegantly, the Ramanujan graphs of Lubotzky, Phillips and Sarnak, 1988), but the random proof came first and is still the simplest. Locally (within distance g/2g/2 of any vertex) G∗G^* looks like a tree, yet globally it needs many colours: chromatic number is not a local property.

Theorem— Theorem 4 (second moment: the threshold for triangles)

Let XX be the number of triangles in G(n,p)G(n, p). If np→0np \to 0 then P(X>0)→0\mathbb{P}(X > 0) \to 0; if np→∞np \to \infty then P(X>0)→1\mathbb{P}(X > 0) \to 1. So p=1/np = 1/n is a threshold for containing a triangle.

Proof

X=∑T1TX = \sum_T \mathbf{1}_T over the (n3)\binom n3 triples TT, and E[X]=(n3)p3∼(np)3/6\mathbb{E}[X] = \binom n3 p^3 \sim (np)^3/6. If np→0np \to 0, P(X>0)≤E[X]→0\mathbb{P}(X > 0) \leq \mathbb{E}[X] \to 0 (first moment). If np→∞np \to \infty, compute

Var⁡X=∑TVar⁡1T+∑T≠T′Cov⁡(1T,1T′).\operatorname{Var}X = \sum_T \operatorname{Var}\mathbf{1}_T + \sum_{T \neq T'}\operatorname{Cov}(\mathbf{1}_T, \mathbf{1}_{T'}).

The first sum is at most E[X]\mathbb{E}[X]. If T,T′T, T' share at most one vertex they have no common edge, so 1T\mathbf{1}_T and 1T′\mathbf{1}_{T'} are independent and the covariance is 00. If they share two vertices (one edge), Cov⁡≤E[1T1T′]=p5\operatorname{Cov} \leq \mathbb{E}[\mathbf{1}_T\mathbf{1}_{T'}] = p^5, and there are at most n4n^4 such ordered pairs. Hence Var⁡X≤E[X]+n4p5\operatorname{Var}X \leq \mathbb{E}[X] + n^4p^5 and, by the second-moment method,

P(X=0)≤Var⁡X(EX)2≤1EX+n4p5(n3)2p6=O ⁣(1(np)3+1n2p)→0.\mathbb{P}(X = 0) \leq \frac{\operatorname{Var}X}{(\mathbb{E}X)^2} \leq \frac{1}{\mathbb{E}X} + \frac{n^4p^5}{\binom n3^2 p^6} = O\!\left(\frac{1}{(np)^3} + \frac{1}{n^2p}\right) \to 0.

∎

Erdős and Rényi (1960) found such thresholds for many properties; at p=c/np = c/n the random graph undergoes a phase transition: for c<1c < 1 all components have O(log⁡n)O(\log n) vertices, while for c>1c > 1 a unique giant component with a positive fraction of the vertices appears.

Theorem— Theorem 5 (the Lovász local lemma)

Let A1,…,AmA_1, \dots, A_m be events with dependency graph DD. If there are numbers x1,…,xm∈[0,1)x_1, \dots, x_m \in [0, 1) with

P(Ai)≤xi∏j∼i(1−xj)for all i,\mathbb{P}(A_i) \leq x_i\prod_{j \sim i}(1 - x_j) \qquad\text{for all } i,

then P(⋂iAi‾)≥∏i(1−xi)>0\mathbb{P}\big(\bigcap_i \overline{A_i}\big) \geq \prod_i(1 - x_i) > 0. Symmetric form: if every P(Ai)≤p\mathbb{P}(A_i) \leq p, every vertex of DD has degree at most dd, and e p (d+1)≤1e\,p\,(d + 1) \leq 1, then with positive probability no AiA_i occurs.

Proof

Claim: for every S⊆{1,…,m}S \subseteq \{1, \dots, m\} and i∉Si \notin S with P(⋂j∈SAj‾)>0\mathbb{P}(\bigcap_{j \in S}\overline{A_j}) > 0,

P(Ai ∣ ⋂j∈SAj‾)≤xi.\mathbb{P}\Big(A_i \,\Big|\, \bigcap_{j \in S}\overline{A_j}\Big) \leq x_i.

We induct on ∣S∣|S|. Split S=S1∪S2S = S_1 \cup S_2 with S1={j∈S:j∼i}S_1 = \{j \in S : j \sim i\} and S2=S∖S1S_2 = S \setminus S_1, and write B1=⋂S1Aj‾B_1 = \bigcap_{S_1}\overline{A_j}, B2=⋂S2Aj‾B_2 = \bigcap_{S_2}\overline{A_j}. If S1=∅S_1 = \varnothing, the conditional probability is P(Ai∣B2)=P(Ai)≤xi\mathbb{P}(A_i \mid B_2) = \mathbb{P}(A_i) \leq x_i by mutual independence. Otherwise

P(Ai∣B1∩B2)=P(Ai∩B1∣B2)P(B1∣B2).\mathbb{P}(A_i \mid B_1 \cap B_2) = \frac{\mathbb{P}(A_i \cap B_1 \mid B_2)}{\mathbb{P}(B_1 \mid B_2)}.

The numerator is at most P(Ai∣B2)=P(Ai)≤xi∏j∼i(1−xj)\mathbb{P}(A_i \mid B_2) = \mathbb{P}(A_i) \leq x_i\prod_{j \sim i}(1 - x_j). For the denominator, list S1={j1,…,jr}S_1 = \{j_1, \dots, j_r\}; then

P(B1∣B2)=∏t=1r(1−P(Ajt ∣ B2∩Aj1‾∩⋯∩Ajt−1‾))≥∏t=1r(1−xjt)≥∏j∼i(1−xj),\mathbb{P}(B_1 \mid B_2) = \prod_{t=1}^r\Big(1 - \mathbb{P}\big(A_{j_t} \,\big|\, B_2 \cap \overline{A_{j_1}} \cap \cdots \cap \overline{A_{j_{t-1}}}\big)\Big) \geq \prod_{t=1}^r(1 - x_{j_t}) \geq \prod_{j \sim i}(1 - x_j),

by the induction hypothesis (each conditioning set has fewer than ∣S∣|S| events). The ratio is at most xix_i, proving the claim. (Positivity of the conditioning probabilities follows along the way from the same product formula.)

Finally, P(⋂i=1mAi‾)=∏i=1m(1−P(Ai ∣ ⋂j<iAj‾))≥∏i(1−xi)\mathbb{P}\big(\bigcap_{i=1}^m \overline{A_i}\big) = \prod_{i=1}^m\Big(1 - \mathbb{P}\big(A_i \,\big|\, \bigcap_{j < i}\overline{A_j}\big)\Big) \geq \prod_i(1 - x_i). For the symmetric form take xi=1d+1x_i = \frac{1}{d+1}: then xi∏j∼i(1−xj)≥1d+1(1−1d+1)d≥1e(d+1)≥px_i\prod_{j \sim i}(1 - x_j) \geq \frac{1}{d + 1}\left(1 - \frac{1}{d+1}\right)^d \geq \frac{1}{e(d + 1)} \geq p, using (1+1d)d≤e\left(1 + \frac1d\right)^d \leq e.

∎

The conclusion can be exponentially small — ∏(1−xi)\prod(1 - x_i) — which is why the union bound could not have found it.

Example— Applications of the local lemma

  • Satisfiability. A kk-CNF formula in which each clause shares variables with at most 2k/e−12^k/e - 1 other clauses is satisfiable: under a uniform random assignment each clause fails with probability p=2−kp = 2^{-k}, and e p (d+1)≤1e\,p\,(d + 1) \leq 1. No bound on the number of clauses is needed.
  • Hypergraph colouring. If every set of a family of kk-sets meets at most 2k−1/e−12^{k-1}/e - 1 others, the family can be 2-coloured with no monochromatic set — compare the example above, which needed fewer than 2k−12^{k-1} sets in total.
  • Ramsey numbers (Spencer, 1975). With the events "the kk-set SS is monochromatic", two events are dependent only if the sets share an edge, so each depends on at most (k2)(nk−2)\binom k2\binom{n}{k-2} others; the symmetric local lemma gives R(k,k)>(2e+o(1))k 2k/2R(k, k) > \left(\frac{\sqrt 2}{e} + o(1)\right)k\,2^{k/2} — still the best lower bound known, a factor 2\sqrt 2 better than the deletion bound and 22 better than the first moment.

Theorem— Theorem 6 (Chernoff bound for random signs)

Let ε1,…,εn\varepsilon_1, \dots, \varepsilon_n be independent with P(εi=1)=P(εi=−1)=12\mathbb{P}(\varepsilon_i = 1) = \mathbb{P}(\varepsilon_i = -1) = \frac12, and S=ε1+⋯+εnS = \varepsilon_1 + \cdots + \varepsilon_n. For every a>0a > 0,

P(S≥a)<e−a2/(2n),P(∣S∣≥a)<2e−a2/(2n).\mathbb{P}(S \geq a) < e^{-a^2/(2n)}, \qquad \mathbb{P}(|S| \geq a) < 2e^{-a^2/(2n)}.

Proof

For λ>0\lambda > 0, Markov's inequality applied to eλSe^{\lambda S} gives P(S≥a)≤e−λa E[eλS]\mathbb{P}(S \geq a) \leq e^{-\lambda a}\,\mathbb{E}[e^{\lambda S}]. By independence, E[eλS]=∏iE[eλεi]=(cosh⁡λ)n\mathbb{E}[e^{\lambda S}] = \prod_i \mathbb{E}[e^{\lambda\varepsilon_i}] = (\cosh\lambda)^n. Comparing Taylor series, cosh⁡λ=∑kλ2k(2k)!≤∑kλ2k2kk!=eλ2/2\cosh\lambda = \sum_k \frac{\lambda^{2k}}{(2k)!} \leq \sum_k \frac{\lambda^{2k}}{2^k k!} = e^{\lambda^2/2}, because (2k)!≥2kk!(2k)! \geq 2^k k!, with strict inequality for λ≠0\lambda \neq 0 (as (2k)!>2kk!(2k)! > 2^k k! for k≥2k \geq 2). So P(S≥a)<enλ2/2−λa\mathbb{P}(S \geq a) < e^{n\lambda^2/2 - \lambda a}, and λ=a/n\lambda = a/n gives e−a2/(2n)e^{-a^2/(2n)}. By symmetry the same bound holds for P(S≤−a)\mathbb{P}(S \leq -a), which gives the two-sided bound.

∎

Compare Chebyshev: Var⁡S=n\operatorname{Var}S = n gives only P(∣S∣≥a)≤n/a2\mathbb{P}(|S| \geq a) \leq n/a^2. At a=10na = 10\sqrt n Chebyshev gives 0.010.01 and Chernoff 2e−50≈4⋅10−222e^{-50} \approx 4 \cdot 10^{-22}. The same exponential-moment method gives bounds for sums of independent bounded variables (Hoeffding, 1963) and for Bernoulli sums around their mean.

Theorem— Corollary 7 (balancing sets)

For any mm subsets A1,…,AmA_1, \dots, A_m of an nn-element set there is a colouring χ\chi of the points by ±1\pm 1 with ∣∑x∈Ajχ(x)∣≤2nlog⁡(2m)\big|\sum_{x \in A_j}\chi(x)\big| \leq \sqrt{2n\log(2m)} for every jj.

Proof

Colour uniformly at random and let λ=2nlog⁡(2m)\lambda = \sqrt{2n\log(2m)}. For each jj, χ(Aj)\chi(A_j) is a sum of ∣Aj∣≤n|A_j| \leq n random signs, so by Theorem 6, P(∣χ(Aj)∣>λ)<2e−λ2/(2∣Aj∣)≤2e−λ2/(2n)=1m\mathbb{P}(|\chi(A_j)| > \lambda) < 2e^{-\lambda^2/(2|A_j|)} \leq 2e^{-\lambda^2/(2n)} = \frac1m. By the union bound, the probability that some set is unbalanced is less than m⋅1m=1m \cdot \frac1m = 1.

∎

For m=nm = n this gives O(nlog⁡n)O(\sqrt{n\log n}). Spencer's "six standard deviations" theorem (1985) improves it to 6n6\sqrt n, by a cleverer, partly non-random argument; Bansal (2010) and Lovett and Meka (2012) found efficient algorithms achieving O(n)O(\sqrt n).

Theorem— Theorem 8 (derandomisation, two ways)

  1. Conditional expectations. A cut of size at least m/2m/2 can be found deterministically in polynomial time: place the vertices one by one on the side that cuts at least as many of the edges to already-placed vertices.
  2. Moser–Tardos (2010). In the setting of the local lemma with events determined by independent variables: start from a random assignment and, while some bad event AiA_i occurs, resample the variables of one such event. Under the hypothesis of Theorem 5, the expected total number of resamplings is at most ∑ixi1−xi\sum_i \frac{x_i}{1 - x_i}; in the symmetric case, at most m/dm/d.

Proof of 1; 2 is cited. Let WW be the expected number of cut edges when the unplaced vertices are coloured at random, given the placements so far; initially W=m/2W = m/2. Placing the next vertex vv on side 00 or 11 changes WW to W0W_0 or W1W_1 with W=W0+W12W = \frac{W_0 + W_1}{2}, so one choice does not decrease WW; the greedy rule picks it (only the edges from vv to placed vertices change). At the end WW is the actual number of cut edges, which is at least m/2m/2. The Moser–Tardos theorem is proved by an ingenious "witness tree" counting argument (Moser and Tardos, J. ACM 57, 2010; Alon–Spencer, §5.7). □\square

Conditional expectations also derandomise Theorem 1 — but only in time polynomial in (nk)\binom nk, which is not an "explicit construction" in the sense of Ramsey theory (where one wants to compute the colour of an edge in time polynomial in log⁡n\log n).

Explore

Explore: first moments and an explicit colouring

Expectation versus probability. In a group of 2323 people the expected number of pairs sharing a birthday is (232)/365≈0.69<1\binom{23}{2}/365 \approx 0.69 < 1, yet the probability that at least one pair shares a birthday is about 0.5070.507. Both facts are consistent: Markov's inequality only says P(X≥1)≤E[X]\mathbb{P}(X \geq 1) \leq \mathbb{E}[X]. Change kk and compare the simulated probability with the expected count (k2)/365\binom k2/365; the first moment is an upper bound that becomes useless once it exceeds 11.

Shared birthdays: P(X ≥ 1) ≤ E[X]

E[X] = C(k, 2)/365 pairs; the first-moment bound holds, but it is far from the truth once E[X] is large.

0%25%50%75%100%204060people in the groupP(shared birthday)
  • exact probability
  • simulation, with 95% interval

991 of 2,000 groups of 23 shared a birthday

Simulated49.6% ± 2.2%

Exact50.7%

Simulated groups of 23 people: 49.6% had a shared birthday. The exact probability is 50.7%.

Evidence, not proofThis is a simulation of 2,000 groups (run 1) using a seeded random number generator. It is evidence, not proof: the exact values come from mathematics, and a new run gives slightly different numbers.

Exact formula: 1 − (365 × 364 × … × (365 − k + 1)) / 365ᵏ. It assumes 365 equally likely birthdays (no 29 February, no twins). With 23 people the chance first passes 1/2.

An explicit colouring for small kk. Below, the edges of a pentagon are the red edges of K5K_5; the five missing edges (the pentagram) are blue. Neither colour class contains a triangle — check with the Degrees tab that every vertex has two red and two blue edges — so R(3,3)>5R(3, 3) > 5. The Lean file checks this by computation. For large kk no explicit colouring comes close to the random one.

The pentagon colouring of K₅

Drawn edges are red, missing edges blue: no monochromatic triangle, so R(3, 3) > 5.

0212223242
|V| = 5|E| = 5Select a vertex to see the edges that meet there.
deg(0) = 2deg(1) = 2deg(2) = 2deg(3) = 2deg(4) = 2

2 + 2 + 2 + 2 + 2 = 10 = 2 × 5

Every edge has two ends, so it adds exactly 2 to the total: the degrees add up to 10 = 2 × 5. This is the handshake lemma, Σ deg(v) = 2|E|.

Vertices of odd degree: 0. This number is always even, because the total is even.

Formal mathematicsF

A complete formal proof of Erdős's theorem

On a finite probability space with the uniform distribution, every probabilistic argument is a counting argument, and Lean checks counting arguments well. We first formalise the three counting principles behind the method — the union bound (first moment), averaging, and Markov's inequality:

exists_avoidingLean 4Proved here from basic factsFormally verified
/-- **The union bound (first-moment method, counting form).** Let `Ω` be a finite sample space and
`B i` (for `i ∈ S`) a family of "bad" events. If `∑ |B i| < |Ω|` — equivalently, if the bad events
have total probability `< 1` under the uniform distribution — then some outcome `ω` avoids every
bad event. Proof: `|⋃ B i| ≤ ∑ |B i| < |Ω|`, so the union is not everything. -/
theorem exists_avoiding {Ω ι : Type*} [Fintype Ω] [DecidableEq Ω] (S : Finset ι)
    (B : ι → Finset Ω) (h : ∑ i ∈ S, (B i).card < Fintype.card Ω) :
    ∃ ω : Ω, ∀ i ∈ S, ω ∉ B i := by
  have hcard : (S.biUnion B).card < (univ : Finset Ω).card :=
    lt_of_le_of_lt card_biUnion_le (by simpa using h)
  obtain ⟨ω, -, hω⟩ := exists_mem_notMem_of_card_lt_card hcard
  exact ⟨ω, fun i hi hωi => hω (mem_biUnion.mpr ⟨i, hi, hωi⟩)⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor
exists_ge_averageLean 4Proved here from basic factsFormally verified
/-- **The averaging principle** (a random variable takes a value at least its mean). If
`f` has average at least `c` over a non-empty finite set `s`, then `f(ω) ≥ c` for some `ω ∈ s`.
Proof: otherwise `∑ f < ∑ c = |s| c`. -/
theorem exists_ge_average {Ω : Type*} (s : Finset Ω) (hs : s.Nonempty) (f : Ω → ℝ) (c : ℝ)
    (h : s.card * c ≤ ∑ ω ∈ s, f ω) : ∃ ω ∈ s, c ≤ f ω := by
  by_contra hcon
  simp only [not_exists, not_and, not_le] at hcon
  have hlt : ∑ ω ∈ s, f ω < ∑ _ω ∈ s, c := sum_lt_sum_of_nonempty hs hcon
  rw [sum_const, nsmul_eq_mul] at hlt
  linarith
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor
markov_countLean 4Proved here from basic factsFormally verified
/-- **Markov's inequality, counting form.** For a non-negative function `X` on a finite set and
`a > 0`, `a · #{ω : X ω ≥ a} ≤ ∑ X`; dividing by `|Ω|`, `P(X ≥ a) ≤ E[X]/a`. Proof: drop the
terms with `X < a` and bound each remaining term below by `a`. -/
theorem markov_count {Ω : Type*} [Fintype Ω] (X : Ω → ℝ) (hX : ∀ ω, 0 ≤ X ω) (a : ℝ) :
    a * (univ.filter (fun ω => a ≤ X ω)).card ≤ ∑ ω, X ω := by
  classical
  calc a * (univ.filter (fun ω => a ≤ X ω)).card
      = ∑ _ω ∈ univ.filter (fun ω => a ≤ X ω), a := by rw [sum_const, nsmul_eq_mul, mul_comm]
    _ ≤ ∑ ω ∈ univ.filter (fun ω => a ≤ X ω), X ω := sum_le_sum fun ω hω => (mem_filter.mp hω).2
    _ ≤ ∑ ω, X ω := sum_le_sum_of_subset_of_nonneg (filter_subset _ _) fun ω _ _ => hX ω
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor

Then the probability space of Theorem 1: edges of KnK_n, colourings, and monochromatic sets.

EdgeLean 4Formally verified
/-- The edges of the complete graph `Kₙ`: the two-element subsets of `Fin n = {0, …, n − 1}`. -/
abbrev Edge (n : ℕ) := {e : Finset (Fin n) // e.card = 2}
Axioms used: propext, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor
ColouringLean 4Formally verified
/-- A red/blue colouring of the edges of `Kₙ` (`true` = red, `false` = blue). There are
`2^{C(n,2)}` of them; the uniform distribution on them is the random colouring of the lesson. -/
abbrev Colouring (n : ℕ) := Edge n → Bool
Axioms used: propext, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor
MonochromaticLean 4Formally verified
/-- A set `K` of vertices is **monochromatic** for `c` if all edges inside `K` have one colour. -/
def Monochromatic {n : ℕ} (c : Colouring n) (K : Finset (Fin n)) : Prop :=
  ∃ b : Bool, ∀ e : Edge n, e.1 ⊆ K → c e = b
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor

The counting steps: KnK_n has (n2)\binom n2 edges, a kk-set spans (k2)\binom k2 of them, and therefore a fixed kk-set is monochromatic in at most 2⋅2(n2)−(k2)2 \cdot 2^{\binom n2 - \binom k2} colourings — the formal version of P(S monochromatic)=21−(k2)\mathbb{P}(S\text{ monochromatic}) = 2^{1 - \binom k2}:

card_edgeLean 4Applies a library theoremFormally verified
/-- `Kₙ` has `C(n, 2)` edges. Mathlib: `Fintype.card_finset_len`. -/
theorem card_edge (n : ℕ) : Fintype.card (Edge n) = n.choose 2 := by
  simp [Edge, Fintype.card_finset_len]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor
card_edges_insideLean 4Proved here from basic factsFormally verified
/-- A set of `k` vertices spans (at least — in fact exactly) `C(k, 2)` edges: every two-element
subset of `K` is an edge inside `K`. -/
theorem card_edges_inside {n : ℕ} (K : Finset (Fin n)) :
    K.card.choose 2 ≤ Fintype.card {e : Edge n // e.1 ⊆ K} := by
  classical
  let f : (K.powersetCard 2) → {e : Edge n // e.1 ⊆ K} := fun s =>
    ⟨⟨s.1, (mem_powersetCard.mp s.2).2⟩, (mem_powersetCard.mp s.2).1⟩
  have hf : Function.Injective f := by
    intro s t hst
    apply Subtype.ext
    exact congrArg (fun e : {e : Edge n // e.1 ⊆ K} => e.1.1) hst
  have h := Fintype.card_le_of_injective f hf
  rwa [Fintype.card_coe, card_powersetCard] at h
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor
card_constant_on_leLean 4Proved here from basic factsFormally verified
/-- **Forcing the colour of the edges inside `K`.** At most `2^{C(n,2) − C(k,2)}` colourings give
every edge inside a `k`-set `K` the colour `b`: such a colouring is determined by its values on
the remaining edges. (So the probability is at most `2^{−C(k,2)}`.) -/
theorem card_constant_on_le {n : ℕ} (K : Finset (Fin n)) (b : Bool) :
    (univ.filter (fun c : Colouring n => ∀ e : Edge n, e.1 ⊆ K → c e = b)).card
      ≤ 2 ^ (n.choose 2 - K.card.choose 2) := by
  classical
  -- restricting to the edges that are not inside `K` is injective
  let r : {c : Colouring n // ∀ e : Edge n, e.1 ⊆ K → c e = b} →
      ({e : Edge n // ¬ e.1 ⊆ K} → Bool) := fun c e => c.1 e.1
  have hr : Function.Injective r := by
    intro c d hcd
    apply Subtype.ext
    funext e
    by_cases he : e.1 ⊆ K
    · rw [c.2 e he, d.2 e he]
    · exact congrFun hcd ⟨e, he⟩
  have h1 := Fintype.card_le_of_injective r hr
  rw [Fintype.card_fun, Fintype.card_bool, Fintype.card_subtype_compl, card_edge,
    Fintype.card_subtype] at h1
  refine h1.trans (Nat.pow_le_pow_right (by norm_num) (Nat.sub_le_sub_left ?_ _))
  exact card_edges_inside K
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor
card_monochromatic_leLean 4Proved here from basic factsFormally verified
open scoped Classical in
/-- **A fixed `k`-set is monochromatic in at most `2 · 2^{C(n,2) − C(k,2)}` colourings** — all red or
all blue. In probability: `P(K monochromatic) ≤ 2^{1 − C(k,2)}`. -/
theorem card_monochromatic_le {n : ℕ} (K : Finset (Fin n)) :
    (univ.filter (fun c : Colouring n => Monochromatic c K)).card
      ≤ 2 * 2 ^ (n.choose 2 - K.card.choose 2) := by
  classical
  have hsub : univ.filter (fun c : Colouring n => Monochromatic c K) ⊆
      univ.filter (fun c : Colouring n => ∀ e : Edge n, e.1 ⊆ K → c e = true) ∪
      univ.filter (fun c : Colouring n => ∀ e : Edge n, e.1 ⊆ K → c e = false) := by
    intro c hc
    obtain ⟨b, hb⟩ := (mem_filter.mp hc).2
    cases b
    · exact mem_union_right _ (mem_filter.mpr ⟨mem_univ _, hb⟩)
    · exact mem_union_left _ (mem_filter.mpr ⟨mem_univ _, hb⟩)
  calc _ ≤ _ := card_le_card hsub
    _ ≤ _ := card_union_le _ _
    _ ≤ 2 ^ (n.choose 2 - K.card.choose 2) + 2 ^ (n.choose 2 - K.card.choose 2) :=
      add_le_add (card_constant_on_le K true) (card_constant_on_le K false)
    _ = 2 * 2 ^ (n.choose 2 - K.card.choose 2) := by ring
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor

The arithmetic of Theorem 1, and the theorem itself — R(k,k)>nR(k, k) > n whenever k≥3k \geq 3 and n2≤2kn^2 \leq 2^k:

factorial_sq_gtLean 4Proved here from basic factsFormally verified
/-- `(k!)² > 4 · 2ᵏ` for `k ≥ 3` (by induction: `36 > 32`, and each step multiplies the left side
by `(k + 1)² ≥ 16` and the right side by `2`). Equivalently `k! > 2^{1 + k/2}`. -/
theorem factorial_sq_gt {k : ℕ} (hk : 3 ≤ k) : 4 * 2 ^ k < (k.factorial) ^ 2 := by
  induction k, hk using Nat.le_induction with
  | base => decide
  | succ k hk ih =>
    rw [Nat.factorial_succ, mul_pow, pow_succ]
    have h2 : 2 ≤ (k + 1) ^ 2 := by nlinarith
    nlinarith
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor
erdos_arithmeticLean 4Proved here from basic factsFormally verified
/-- **Erdős's arithmetic**: if `k ≥ 3` and `n² ≤ 2ᵏ`, then `C(n, k) · 2^{1 − C(k,2)} < 1`, i.e.
`2 · C(n, k) < 2^{C(k,2)}`. Proof: `k! · C(n, k) ≤ nᵏ`, so
`(2 C(n,k))² · 2ᵏ = 4 C(n,k)² 2ᵏ < C(n,k)² (k!)² ≤ n^{2k} ≤ 2^{k²} = 2^{2 C(k,2)} · 2ᵏ`,
using `4 · 2ᵏ < (k!)²` and `k² = k(k − 1) + k = 2 C(k,2) + k`. -/
theorem erdos_arithmetic {n k : ℕ} (hk : 3 ≤ k) (hn : n ^ 2 ≤ 2 ^ k) :
    2 * n.choose k < 2 ^ k.choose 2 := by
  set C := n.choose k with hC
  set M := k.choose 2 with hM
  rcases Nat.eq_zero_or_pos C with h0 | hpos
  · rw [h0]; positivity
  -- `k! · C(n, k) ≤ nᵏ`
  have hfact : k.factorial * C ≤ n ^ k := by
    rw [hC, ← Nat.descFactorial_eq_factorial_mul_choose]
    exact Nat.descFactorial_le_pow n k
  -- `2 C(k, 2) + k = k²`
  have hMk : 2 * M + k = k * k := by
    have hdiv : 2 ∣ k * (k - 1) := (Nat.even_mul_pred_self k).two_dvd
    have h2M : 2 * M = k * (k - 1) := by
      rw [hM, Nat.choose_two_right, Nat.mul_div_cancel' hdiv]
    rw [h2M]
    obtain ⟨j, rfl⟩ : ∃ j, k = j + 1 := ⟨k - 1, by omega⟩
    simp only [Nat.add_sub_cancel]
    ring
  have h4 := factorial_sq_gt hk
  -- chain of inequalities, multiplied through by `2ᵏ`
  have hchain : (2 * C) ^ 2 * 2 ^ k < (2 ^ M) ^ 2 * 2 ^ k := by
    calc (2 * C) ^ 2 * 2 ^ k = C ^ 2 * (4 * 2 ^ k) := by ring
      _ < C ^ 2 * (k.factorial) ^ 2 := by
        apply Nat.mul_lt_mul_of_pos_left h4 (by positivity)
      _ = (k.factorial * C) ^ 2 := by ring
      _ ≤ (n ^ k) ^ 2 := Nat.pow_le_pow_left hfact 2
      _ = (n ^ 2) ^ k := by ring
      _ ≤ (2 ^ k) ^ k := Nat.pow_le_pow_left hn k
      _ = 2 ^ (2 * M + k) := by rw [hMk, ← pow_mul]
      _ = (2 ^ M) ^ 2 * 2 ^ k := by ring
  have hsq : (2 * C) ^ 2 < (2 ^ M) ^ 2 := Nat.lt_of_mul_lt_mul_right hchain
  exact lt_of_pow_lt_pow_left₀ 2 (by positivity) hsq
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor
erdos_ramsey_lower_boundLean 4Proved here from basic factsFormally verified
/-- **Erdős's theorem (1947): `R(k, k) > 2^{k/2}`.** If `k ≥ 3` and `n² ≤ 2ᵏ`, some red/blue
colouring of the edges of `Kₙ` has no monochromatic `Kₖ`. Proof (the lesson's, as counting): there
are `C(n, k)` sets of `k` vertices, each monochromatic in at most `2 · 2^{C(n,2) − C(k,2)}` of the
`2^{C(n,2)}` colourings, and `C(n, k) · 2 · 2^{C(n,2) − C(k,2)} < 2^{C(n,2)}` by
`erdos_arithmetic`; the union bound gives a colouring avoiding them all. The proof does not say
which colouring works. -/
theorem erdos_ramsey_lower_bound {n k : ℕ} (hk : 3 ≤ k) (hn : n ^ 2 ≤ 2 ^ k) :
    ∃ c : Colouring n, ∀ K : Finset (Fin n), K.card = k → ¬ Monochromatic c K := by
  classical
  set S := (univ : Finset (Fin n)).powersetCard k
  set B : Finset (Fin n) → Finset (Colouring n) := fun K =>
    univ.filter (fun c : Colouring n => Monochromatic c K)
  have hlt : n.choose k * (2 * 2 ^ (n.choose 2 - k.choose 2)) < 2 ^ n.choose 2 := by
    rcases le_or_gt k n with hkn | hkn
    · have hle : k.choose 2 ≤ n.choose 2 := Nat.choose_le_choose 2 hkn
      have hsplit : 2 ^ n.choose 2 = 2 ^ k.choose 2 * 2 ^ (n.choose 2 - k.choose 2) := by
        rw [← pow_add, Nat.add_sub_cancel' hle]
      rw [hsplit, ← mul_assoc]
      exact Nat.mul_lt_mul_of_pos_right (by linarith [erdos_arithmetic hk hn]) (by positivity)
    · rw [Nat.choose_eq_zero_of_lt hkn, zero_mul]
      positivity
  have hsum : ∑ K ∈ S, (B K).card < Fintype.card (Colouring n) := by
    calc ∑ K ∈ S, (B K).card ≤ ∑ _K ∈ S, 2 * 2 ^ (n.choose 2 - k.choose 2) := by
          apply sum_le_sum
          intro K hK
          have hKc : K.card = k := (mem_powersetCard.mp hK).2
          have := card_monochromatic_le K
          rwa [hKc] at this
      _ = n.choose k * (2 * 2 ^ (n.choose 2 - k.choose 2)) := by
          rw [sum_const, smul_eq_mul, card_powersetCard, card_univ, Fintype.card_fin]
      _ < 2 ^ n.choose 2 := hlt
      _ = Fintype.card (Colouring n) := by
          rw [Fintype.card_fun, Fintype.card_bool, card_edge]
  obtain ⟨c, hc⟩ := exists_avoiding S B hsum
  refine ⟨c, fun K hK hmono => hc K ?_ ?_⟩
  · exact mem_powersetCard.mpr ⟨subset_univ K, hK⟩
  · exact mem_filter.mpr ⟨mem_univ c, hmono⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor

By contrast, for tiny cases a computer can simply check an explicit colouring:

pentagon_colouringLean 4Proved here from basic factsFormally verified
/-- **An explicit colouring: `R(3, 3) > 5`.** Colour the edge `{i, j}` of `K₅` red when `i` and `j`
are neighbours on the pentagon (`j − i ≡ ±1 mod 5`) and blue otherwise. No three vertices
`a < b < c` span a monochromatic triangle: both colour classes are 5-cycles. Checked by `decide`
over all `C(5, 3) = 10` triangles. For larger `k` no explicit colouring anywhere near Erdős's
bound is known. -/
theorem pentagon_colouring :
    let red : Fin 5 → Fin 5 → Bool := fun i j => (j.val + 5 - i.val) % 5 == 1 ||
      (j.val + 5 - i.val) % 5 == 4
    ∀ a b c : Fin 5, a < b → b < c → ¬ (red a b = red b c ∧ red b c = red a c) := by
  decide
Axioms used: No axiomsformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor

Finally, the analytic inequality at the heart of the Chernoff bound (Theorem 6), from Mathlib:

cosh_le_exp_half_sqLean 4Applies a library theoremFormally verified
/-- **`cosh x ≤ e^{x²/2}`**, comparing the Taylor series term by term (`(2k)! ≥ 2ᵏ k!`). For a
uniform random sign `ε = ±1`, `E[e^{λε}] = cosh λ ≤ e^{λ²/2}`, which gives the Chernoff bound
`P(ε₁ + ⋯ + εₙ ≥ a) ≤ e^{−a²/(2n)}`. Mathlib: `Real.cosh_le_exp_half_sq`. -/
theorem cosh_le_exp_half_sq (x : ℝ) : Real.cosh x ≤ Real.exp (x ^ 2 / 2) :=
  Real.cosh_le_exp_half_sq x
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ProbabilisticMethod.leanTry it in the Lean web editor

What is and is not formalised. Proved here, completely: Erdős's theorem R(k,k)>nR(k, k) > n for n2≤2kn^2 \leq 2^k, k≥3k \geq 3 (Theorem 1), through the union bound on the uniform space of colourings, with no probability theory beyond counting; the averaging principle and Markov's inequality for counting measure; and R(3,3)>5R(3, 3) > 5 by computation. From Mathlib: finite cardinalities and binomial bounds, and cosh⁡x≤ex2/2\cosh x \leq e^{x^2/2}. Not formalised: the deletion method, Theorems 3–6 and Corollary 7 as probabilistic statements (Mathlib's measure-theoretic probability can express them, but we have not done so), and the Moser–Tardos analysis. Note that the formal proof, like the human one, does not produce a colouring: it proves an existence statement by counting.

ComputationC

Coin flips, counted

The first experiment tabulates the first-moment and deletion bounds for R(k,k)R(k, k), simulates random colourings of K6K_6 to see the guarantee P(no monochromatic K4)≥1−E[X]\mathbb{P}(\text{no monochromatic } K_4) \geq 1 - \mathbb{E}[X] in action, and verifies exhaustively that the Paley colouring of K17K_{17} has no monochromatic K4K_4.

Random colourings and Ramsey lower boundsPythonExact computationExhaustive finite checkStatistical evidenceComputationally tested
"""Random colourings and Ramsey numbers: what the first moment gives.

Colour each edge of K_n red or blue by a fair coin. The expected number of
monochromatic copies of K_k is E(n, k) = C(n, k) 2^(1 - C(k, 2)); when it is
below 1, some colouring has none, so R(k, k) > n (Erdos, 1947). The deletion
method improves this: removing one vertex from each monochromatic K_k leaves
a good colouring on at least n - E(n, k) vertices. We tabulate both bounds,
simulate random colourings of K_6 to see that the probability of having no
monochromatic K_4 really is at least 1 - E(6, 4), and check by exhaustive
search that the Paley graph on 17 vertices (edges between quadratic residue
differences mod 17) has no K_4 and no independent 4-set, an explicit
colouring proving R(4, 4) > 17 - far better than the random bound for such
small k. Exact arithmetic for the bounds, exhaustive search for Paley, and a
seeded simulation (statistical evidence) for the random colourings.
"""

import itertools
import math
import random
from fractions import Fraction

def expected_monochromatic(n, k):
    """E(n, k) = C(n, k) 2^(1 - C(k, 2)) as an exact fraction."""
    return Fraction(math.comb(n, k) * 2, 2 ** math.comb(k, 2))

def first_moment_bound(k):
    """Largest n with E(n, k) < 1, so that R(k, k) > n."""
    n = k
    while expected_monochromatic(n + 1, k) < 1:
        n += 1
    return n

def deletion_bound(k):
    """max over n of n - floor(E(n, k)): R(k, k) exceeds this number.

    Some colouring has at most floor(E) monochromatic K_k; deleting one
    vertex from each leaves at least n - floor(E) vertices and none.
    """
    best, n = 0, k
    while True:
        value = n - math.floor(expected_monochromatic(n, k))
        if value < best - 5:
            return best
        best = max(best, value)
        n += 1

def random_colouring(n, rng):
    """A dict {(i, j): bool} for i < j, each edge red with probability 1/2."""
    return {e: rng.random() < 0.5 for e in itertools.combinations(range(n), 2)}

def count_monochromatic(colouring, n, k):
    """Number of k-subsets all of whose edges have the same colour."""
    count = 0
    for subset in itertools.combinations(range(n), k):
        colours = {colouring[e] for e in itertools.combinations(subset, 2)}
        count += len(colours) == 1
    return count

def paley_colouring(q):
    """Paley colouring of K_q, q prime = 1 mod 4: red iff i - j is a square."""
    squares = {(x * x) % q for x in range(1, q)}
    return {(i, j): (j - i) % q in squares
            for i, j in itertools.combinations(range(q), 2)}

def main():
    print(" k  2^(k/2)  first moment: R(k,k) >  deletion: R(k,k) >")
    for k in range(3, 11):
        print(f"{k:>2}  {2 ** (k / 2):>7.1f}  {first_moment_bound(k):>22}"
              f"  {deletion_bound(k):>18}")
    rng = random.Random(1947)
    n, k, trials = 6, 4, 4000
    counts = [count_monochromatic(random_colouring(n, rng), n, k)
              for _ in range(trials)]
    e = expected_monochromatic(n, k)
    good = counts.count(0) / trials
    margin = 1.96 * math.sqrt(good * (1 - good) / trials)
    print(f"Random colourings of K_{n}, {trials} samples (seed 1947):")
    print(f"  mean number of monochromatic K_{k}: {sum(counts) / trials:.3f}"
          f"  (exact E = {float(e):.3f})")
    print(f"  fraction with none: {good:.3f} +- {margin:.3f}"
          f"  (guaranteed >= 1 - E = {1 - float(e):.3f})")
    paley = paley_colouring(17)
    mono = count_monochromatic(paley, 17, 4)
    print(f"Paley colouring of K_17: {mono} monochromatic K_4 among "
          f"{math.comb(17, 4)} sets,")
    print("  so R(4,4) > 17 (in fact R(4,4) = 18); the random bound gives > 6.")
    print()
    print("Epistemic status: the bounds are exact arithmetic and the Paley")
    print("check is exhaustive, so both are proofs of what they state; the")
    print("simulation is statistical evidence (95% interval shown) about one")
    print("seeded run.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The second compares Chebyshev's and Chernoff's bounds with the exact tail of a sum of random signs, and checks Corollary 7 on random set systems.

Chernoff bounds and balancing setsPythonExact computationStatistical evidenceComputationally tested
"""Concentration: Chebyshev versus Chernoff, and balancing sets.

For a sum S of n independent fair signs +-1, Chebyshev's inequality gives
P(S >= a) <= n / a^2, while the Chernoff bound gives P(S >= a) <=
exp(-a^2 / (2n)) - exponentially small. We compare both with the exact
binomial tail and with a seeded simulation for n = 100. Then we use the
Chernoff bound as the lesson does: colour n points red and blue at random;
for each of n given sets, the imbalance |chi(A)| exceeds sqrt(2 n ln 2n) with
probability below 1/n, so with positive probability no set does. For 64
random sets on 64 points we sample random colourings and record how often all
sets are within the bound and the best maximum imbalance found. Exact tails,
seeded simulation (statistical evidence).
"""

import math
import random

def exact_tail(n, a):
    """P(S >= a) for S a sum of n fair +-1 signs (S = 2H - n, H binomial)."""
    need = math.ceil((n + a) / 2)
    return sum(math.comb(n, h) for h in range(max(need, 0), n + 1)) / 2 ** n

def chebyshev_bound(n, a):
    """Chebyshev: P(S >= a) <= P(|S| >= a) <= n / a^2 (a > 0)."""
    return min(1.0, n / a ** 2)

def chernoff_bound(n, a):
    """Chernoff: P(S >= a) <= exp(-a^2 / (2n))."""
    return math.exp(-a * a / (2 * n))

def simulate_tail(n, a, trials, rng):
    """Fraction of seeded trials with S >= a, using random bit strings."""
    hits = 0
    for _ in range(trials):
        heads = bin(rng.getrandbits(n)).count("1")
        hits += 2 * heads - n >= a
    return hits / trials

def random_sets(n_points, n_sets, rng):
    """Each set contains each point independently with probability 1/2."""
    return [[i for i in range(n_points) if rng.random() < 0.5]
            for _ in range(n_sets)]

def max_imbalance(colouring, sets):
    """max over sets A of |sum of colours (+-1) of the points in A|."""
    return max(abs(sum(colouring[i] for i in a)) for a in sets)

def main():
    n = 100
    rng = random.Random(2024)
    print(f"Sum of n = {n} random signs: P(S >= a)")
    print(f"{'a':>4} {'exact':>10} {'simulated':>10} {'Chebyshev':>10} "
          f"{'Chernoff':>10}")
    for a in (10, 20, 30, 40):
        sim = simulate_tail(n, a, 20000, rng)
        print(f"{a:>4} {exact_tail(n, a):>10.2e} {sim:>10.2e} "
              f"{chebyshev_bound(n, a):>10.2e} {chernoff_bound(n, a):>10.2e}")
    points = 64
    sets = random_sets(points, points, rng)
    bound = math.sqrt(2 * points * math.log(2 * points))
    trials = 500
    maxima = sorted(max_imbalance([rng.choice((-1, 1)) for _ in range(points)],
                                  sets) for _ in range(trials))
    within = sum(m <= bound for m in maxima)
    print(f"Balancing {points} random sets on {points} points:")
    print(f"  bound sqrt(2n ln 2n) = {bound:.1f}; random colourings within "
          f"it: {within}/{trials}")
    print(f"  maximum imbalance: median {maxima[trials // 2]}, "
          f"best {maxima[0]}, worst {maxima[-1]}")
    print()
    print("Epistemic status: the tails are exact; the simulated columns are")
    print("statistical evidence from seeded runs. The bounds themselves are")
    print("theorems (Chebyshev; Chernoff via cosh x <= exp(x^2/2)).")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The third builds a random 55-CNF formula satisfying the hypothesis of the symmetric local lemma and runs the Moser–Tardos algorithm: it finds a satisfying assignment after a handful of resamplings, while the local lemma itself only guarantees that a uniformly random assignment succeeds with probability at least about 10−610^{-6}.

Moser-Tardos: the local lemma as an algorithmPythonExact computationStatistical evidenceComputationally tested
"""The algorithmic local lemma: Moser and Tardos's resampling algorithm.

A k-CNF formula has clauses of k literals; under a uniformly random
assignment each clause fails with probability p = 2^-k. If every clause
shares variables with at most d others and e p (d + 1) <= 1, the Lovasz local
lemma says the formula is satisfiable - but its proof gives no algorithm,
and the probability that a random assignment works can be exponentially
small. Moser and Tardos (2010) showed that the obvious algorithm is fast:
start at random, and while some clause is violated, resample its variables.
The expected number of resamplings is at most m / d for m clauses. We build a
random 5-CNF instance with dependency degree at most 10 (so e p (d+1) < 1),
run the algorithm from 30 seeds, check the answers, and compare the number of
resamplings with the bound m / d and with naive rejection sampling. Seeded
simulation: statistical evidence about one instance, with every output
assignment verified exactly.
"""

import math
import random

def neighbours(clauses, index, occurrences):
    """Indices of the other clauses sharing a variable with clause index."""
    out = set()
    for var, _ in clauses[index]:
        out |= occurrences[var]
    out.discard(index)
    return out

def build_instance(n_vars, n_clauses, k, max_degree, rng, max_tries=20000):
    """Random k-CNF; a clause is kept only if all dependency degrees stay <= max_degree.

    A clause is a tuple of (variable, wanted_value) pairs; it is satisfied
    when at least one variable has its wanted value.
    """
    clauses, occurrences = [], [set() for _ in range(n_vars)]
    for _ in range(max_tries):
        if len(clauses) == n_clauses:
            break
        vars_ = rng.sample(range(n_vars), k)
        clause = tuple((v, rng.random() < 0.5) for v in vars_)
        clauses.append(clause)
        new = len(clauses) - 1
        for v in vars_:
            occurrences[v].add(new)
        touched = neighbours(clauses, new, occurrences) | {new}
        if any(len(neighbours(clauses, c, occurrences)) > max_degree
               for c in touched):
            for v in vars_:
                occurrences[v].discard(new)
            clauses.pop()
    return clauses

def max_dependency_degree(clauses, n_vars):
    """The largest number of other clauses any clause shares a variable with."""
    occurrences = [set() for _ in range(n_vars)]
    for i, clause in enumerate(clauses):
        for v, _ in clause:
            occurrences[v].add(i)
    return max(len(neighbours(clauses, i, occurrences))
               for i in range(len(clauses)))

def satisfied(clause, assignment):
    """True if some literal of the clause holds."""
    return any(assignment[v] == want for v, want in clause)

def moser_tardos(clauses, n_vars, rng):
    """Resample violated clauses until none is left; return (assignment, steps)."""
    assignment = [rng.random() < 0.5 for _ in range(n_vars)]
    steps = 0
    while True:
        bad = [c for c in clauses if not satisfied(c, assignment)]
        if not bad:
            return assignment, steps
        for v, _ in rng.choice(bad):
            assignment[v] = rng.random() < 0.5
        steps += 1

def naive_successes(clauses, n_vars, tries, rng):
    """How many of `tries` uniformly random assignments satisfy every clause."""
    hits = 0
    for _ in range(tries):
        bits = rng.getrandbits(n_vars)
        hits += all(any(((bits >> v) & 1) == want for v, want in clause)
                    for clause in clauses)
    return hits

def main():
    k, d, n_vars = 5, 10, 400
    rng = random.Random(2010)
    clauses = build_instance(n_vars, 150, k, d, rng)
    m = len(clauses)
    deg = max_dependency_degree(clauses, n_vars)
    p = 2.0 ** -k
    print(f"Random {k}-CNF: {n_vars} variables, {m} clauses, "
          f"max dependency degree {deg}")
    print(f"  LLL condition e p (d+1) = {math.e * p * (deg + 1):.3f} <= 1")
    runs = [moser_tardos(clauses, n_vars, random.Random(seed))
            for seed in range(30)]
    ok = all(all(satisfied(c, a) for c in clauses) for a, _ in runs)
    steps = sorted(s for _, s in runs)
    print(f"Moser-Tardos from 30 seeds: all outputs satisfy every clause: {ok}")
    print(f"  resamplings: mean {sum(steps) / len(steps):.1f}, "
          f"max {steps[-1]}; bound on the mean m/d = {m / deg:.1f}")
    tries = 2000
    hits = naive_successes(clauses, n_vars, tries, rng)
    print(f"Naive: {hits} of {tries} uniformly random assignments satisfy "
          "the formula;")
    print(f"  the LLL only guarantees probability >= (1 - 1/(d+1))^m = "
          f"{(1 - 1 / (deg + 1)) ** m:.1e}")
    print()
    print("Epistemic status: every output assignment is verified exactly;")
    print("the step counts and the naive success rate are statistical")
    print("evidence about one seeded instance. The bound m/d on the expected")
    print("number of resamplings is Moser and Tardos's theorem.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Exercises

Exercises

1. The probabilistic method

Warm-upHuman

Colour the edges of K6K_6 red or blue by independent fair coin flips. What is the expected number of monochromatic triangles?

2. The probabilistic method

Warm-upHuman

For a random colouring of K6K_6, the expected number XX of monochromatic K4K_4's is (64)21−6=1532≈0.47\binom 64 2^{1-6} = \frac{15}{32} \approx 0.47. What can we conclude?

Choose one

3. The probabilistic method

CoreHuman

What is the largest nn for which the first-moment condition (n4) 21−(42)<1\binom n4 \, 2^{1 - \binom 42} < 1 holds? (It proves R(4,4)>nR(4, 4) > n.)

4. The probabilistic method

CoreHuman

In the proof that every graph with mm edges has a cut of size ≥m/2\ge m/2, we write X=∑eXeX = \sum_e X_e with Xe=1X_e = 1 if edge ee is cut, and conclude E[X]=m/2\mathbb{E}[X] = m/2. The XeX_e are not mutually independent (the three edges of a triangle cannot all be cut). Why is the conclusion still valid?

Choose one

5. The probabilistic method

CoreHuman

In Erdős's proof of Theorem 3, with p=nθ−1p = n^{\theta - 1} and θ<1/g\theta < 1/g, why do we delete a vertex from each short cycle instead of asking that the random graph have no short cycles at all?

Choose one

6. The probabilistic method

StretchHuman

In a 1010-CNF formula (every clause has 1010 literals on distinct variables), each clause shares variables with at most dd other clauses. What is the largest dd for which the symmetric Lovász local lemma (e p (d+1)≤1e\,p\,(d+1) \le 1) guarantees that the formula is satisfiable?

7. The probabilistic method

CoreHuman

Let SS be a sum of n=10000n = 10000 independent random signs ±1\pm 1. Which is the Chernoff bound (Theorem 6) for P(S≥400)\mathbb{P}(S \ge 400)?

Choose one

8. The probabilistic method

CoreFormal

With Colouring n the red/blue colourings of the edges of KnK_n and Monochromatic c K meaning that all edges inside the vertex set K have the same colour under c, which Lean statement says R(k,k)>nR(k, k) > n?

Choose one

9. The probabilistic method

StretchComputational

Write expected_mono(n, k) returning (nk)21−(k2)\binom nk 2^{1 - \binom k2} as an exact Fraction, and first_moment_bound(k) returning the largest n≥kn \ge k with expected_mono(n, k) < 1 (so that R(k,k)>nR(k, k) > n).

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Common misconceptionsH

Common misconceptions

Misconception

"A probabilistic existence proof tells us how to build the object efficiently." Often it does not. Erdős's proof shows that most colourings of KnK_n with n=2k/2n = 2^{k/2} have no monochromatic KkK_k, but no explicit colouring anywhere near this size is known, and checking a given colouring takes time about (nk)\binom nk. When good objects are plentiful, random sampling is a fine randomised algorithm — but it is not a construction, and verifying the output may be infeasible. Sometimes derandomisation succeeds (conditional expectations for cuts; Moser–Tardos for the local lemma), and sometimes, as for Ramsey graphs, it is a famous open problem.

Misconception

"Linearity of expectation needs independence." It does not: E[X+Y]=EX+EY\mathbb{E}[X + Y] = \mathbb{E}X + \mathbb{E}Y for any random variables with finite expectations. In the max-cut example the events "edge ee is cut" are dependent, and in Theorem 1 the events "SS is monochromatic" overlap heavily; linearity is exactly what lets us ignore these dependencies. Independence is needed for variances of sums and for multiplying probabilities.

Misconception

"If E[X]→∞\mathbb{E}[X] \to \infty then X>0X > 0 with high probability." Not without concentration: if X=n2X = n^2 with probability 1/n1/n and 00 otherwise, then EX=n→∞\mathbb{E}X = n \to \infty but P(X=0)→1\mathbb{P}(X = 0) \to 1. The second-moment method (Theorem 4) supplies the missing condition Var⁡X=o((EX)2)\operatorname{Var}X = o\big((\mathbb{E}X)^2\big). Conversely, E[X]<1\mathbb{E}[X] < 1 shows P(X=0)>0\mathbb{P}(X = 0) > 0 but need not show that it is close to 11.

Misconception

"Probabilistic proofs are heuristic, or only true 'with high probability'." The conclusions are ordinary, certain theorems — "there exists a colouring with no monochromatic KkK_k" — proved by computing probabilities on a precisely defined space. On finite spaces they are counting arguments, as the Lean proof shows. (Heuristic probabilistic models, such as Cramér's model of the primes, are a different thing and must be labelled as such.)

ViewpointsH

Viewpoints

Combinatorics— Weighted counting and double counting

Every argument on a finite uniform space is double counting: "E[X]=∑SP(S bad)\mathbb{E}[X] = \sum_S \mathbb{P}(S \text{ bad})" is the identity ∑colourings#{bad S}=∑S#{colourings making S bad}\sum_{\text{colourings}}\#\{\text{bad } S\} = \sum_S \#\{\text{colourings making } S \text{ bad}\}, and Theorem 1 says the right-hand side is less than the number of colourings. Non-uniform distributions such as G(n,p)G(n, p) are weighted counts, and the weights are a tuning parameter: Theorem 3 works only because p=nθ−1p = n^{\theta - 1} balances short cycles against independent sets. The method interacts with extremal combinatorics everywhere: the Kővári–Sós–Turán bounds for bipartite Turán numbers are matched (for some graphs) by random algebraic constructions, the semi-random method of Rödl ("nibble") gives near-perfect packings and designs, and Kim (1995) used it to determine R(3,t)R(3, t) up to a constant factor, R(3,t)≍t2/log⁡tR(3, t) \asymp t^2/\log t (upper bound by Ajtai, Komlós and Szemerédi, 1980). See extremal and additive combinatorics.

Probability— Random structures as the subject

What began as a proof technique became a field: the study of typical properties of random graphs, random matrices and random formulas. Thresholds (Theorem 4) are a general phenomenon — every monotone graph property has a threshold (Bollobás and Thomason, 1987), and the "expectation threshold" conjecture of Kahn and Kalai was proved by Park and Pham (2022). Concentration inequalities (Chernoff, Azuma, Talagrand) show that complicated functions of many independent variables — the chromatic number of G(n,12)G(n, \frac12), the length of the longest increasing subsequence — are sharply concentrated. The phase transition of G(n,c/n)G(n, c/n) at c=1c = 1 resembles percolation in statistical physics (see random structures and stochastic processes).

Computation— Randomness, derandomisation and pseudorandomness

In computer science the probabilistic method is everywhere: random algorithms (randomised rounding of linear programs, Raghavan and Thompson, 1987; primality testing; hashing), and the question of when randomness can be removed. Conditional expectations with pessimistic estimators (Raghavan, 1988) derandomise many Chernoff-bound arguments; Moser and Tardos derandomised the local lemma in the sense of efficient randomised algorithms, and later work made it deterministic in many cases. The harder goal — explicit objects as good as random ones — connects to complexity theory: explicit Ramsey graphs are closely related to randomness extractors, and expander graphs and error-correcting codes with random-like properties now have explicit constructions. Whether every efficient randomised algorithm can be derandomised (P = BPP) is open, though widely believed (see computational complexity).

Geometry— Random projections and high-dimensional geometry

The Johnson–Lindenstrauss lemma (1984): any NN points in a Euclidean space can be mapped into Rk\R^k with k=O(ε−2log⁡N)k = O(\varepsilon^{-2}\log N) so that all pairwise distances change by a factor at most 1±ε1 \pm \varepsilon. The proof is the probabilistic method: a random linear projection works with positive probability, because the length of a projected vector is sharply concentrated (a Chernoff-type bound for sums of squared Gaussians) and there are only (N2)\binom N2 distances to control. More generally, concentration of measure on high-dimensional spheres (Lévy; Milman) says that a Lipschitz function is almost constant on most of the sphere, which gives Dvoretzky's theorem — every high-dimensional convex body has almost-spherical sections of dimension about log⁡n\log n — by choosing a random subspace. In high dimensions, random choices are the source of most good geometric configurations.

Logic— Zero–one laws

For a property expressible in first-order logic of graphs (quantifiers over vertices, adjacency and equality), the probability that G(n,12)G(n, \frac12) has the property tends to 00 or 11 (Glebskii, Kogan, Liogon'kii and Talanov, 1969; Fagin, 1976). The proof is model-theoretic: the "extension axioms" — for all disjoint finite sets U,WU, W there is a vertex adjacent to all of UU and none of WW — each hold with high probability by a first-moment computation, and together they axiomatise a complete theory, that of the countable random graph (Rado graph). So "having a triangle" has limiting probability 11, while non-first-order properties such as "having an even number of edges" can have other limits (12\frac12). See model theory.

History & global context

History and global context

  • Tibor Szele (1943) used random tournaments to show that some tournament has at least n!/2n−1n!/2^{n-1} Hamiltonian paths. Claude Shannon's random coding argument (1948) proved the existence of codes achieving channel capacity by averaging over random codes — a cornerstone of information theory and an early masterpiece of the method.
  • Paul Erdős (1947) proved R(k,k)>2k/2R(k, k) > 2^{k/2}, and (1959) the existence of graphs of large girth and chromatic number; with Alfréd Rényi (1959–60) he founded the theory of random graphs. Erdős's many problems, often with cash prizes, kept the method at the centre of combinatorics.
  • Herman Chernoff (1952) introduced the exponential-moment bounds now named after him (related bounds go back to Bernstein); Wassily Hoeffding (1963) gave the general bounded-variable form. László Lovász and Erdős (1975) proved the local lemma, published in a paper on hypergraph colouring; Joel Spencer (1975) applied it to Ramsey numbers and (1985) proved that six standard deviations suffice for discrepancy.
  • Noga Alon and Spencer's The Probabilistic Method (1992) made the subject a standard graduate course. Jeong Han Kim (1995) determined R(3,t)R(3, t) up to a constant factor with the semi-random method; Robin Moser (2009) and Moser and Gábor Tardos (2010) made the local lemma algorithmic; Nikhil Bansal (2010) did the same for Spencer's discrepancy theorem.
  • On Ramsey numbers: Greenwood and Gleason (1955) found R(4,4)=18R(4, 4) = 18; Geoffrey Exoo (1989) showed R(5,5)≥43R(5, 5) \geq 43; Vigleik Angeltveit and Brendan McKay (2024) showed R(5,5)≤46R(5, 5) \leq 46 with large computations; Marcelo Campos, Simon Griffiths, Robert Morris and Julian Sahasrabudhe (2023) gave the first exponential improvement of the Erdős–Szekeres upper bound.
Further reading

Further reading

  • Noga Alon and Joel H. Spencer, The Probabilistic Method (1992; 4th ed. 2016) — the standard text, with Erdős's theorems, the local lemma, concentration, random graphs and derandomisation.
  • Joel Spencer, Ten Lectures on the Probabilistic Method (1987; 2nd ed. 1994) — short, sparkling lectures.
  • Michael Molloy and Bruce Reed, Graph Colouring and the Probabilistic Method (2002) — the local lemma and concentration in action.
  • Béla Bollobás, Random Graphs (1985; 2nd ed. 2001), and Svante Janson, Tomasz Łuczak and Andrzej Ruciński, Random Graphs (2000) — thresholds, phase transitions and the giant component.
  • Michael Mitzenmacher and Eli Upfal, Probability and Computing (2005) — the method from the algorithmic side, including Chernoff bounds and the Moser–Tardos algorithm (2nd ed., 2017).