Discrete Mathematics and Combinatorics
Ramsey Theory and Why Complete Disorder Is Impossible
See why any large enough structure must contain order, from the six-person party puzzle to Ramsey numbers that nobody knows yet.
Key takeaways
- Ramsey theory shows that sufficiently large structures must contain a smaller, completely uniform substructure, no matter how they are colored or arranged.
- Any red and blue coloring of the connections among six points contains a one-color triangle, while five points can avoid it.
- The Ramsey number R(s, t) is the smallest number of points that forces a red group of size s or a blue group of size t.
- Only a handful of Ramsey numbers are known exactly, and even R(5, 5) has been pinned down only to a narrow range.
- Random colorings show that Ramsey numbers grow exponentially, although the exact growth rate remains an open question.
Ramsey theory says that complete disorder cannot exist in a large enough system. However you arrange things, once there are enough of them, some orderly pattern of the size you asked for has to appear. You get to choose how the pieces are labeled, but you do not get to avoid every pattern.
The classic case is a party. Among any six people, there are always three who all know each other or three who are all strangers to each other. This is true for every possible guest list. The proof fits in a paragraph, yet slightly bigger versions of the same question are beyond what anyone can currently answer.
The party problem
Draw six dots, one per guest, and connect every pair with a line. That makes 15 lines. Color a line red if the two people know each other and blue if they are strangers. The claim is that you will always find a triangle with all three sides the same color.
Here is the argument. Pick any one person and call her Vera. She has five lines going out, each red or blue. Five lines split between two colors means at least three share a color, which is the pigeonhole principle at work. Say three of them are red and lead to Ana, Ben and Cal.
Now look at the three lines among Ana, Ben and Cal. If even one of them is red, say the line from Ana to Ben, then Vera, Ana and Ben form a red triangle. If none of them is red, all three are blue, and Ana, Ben and Cal form a blue triangle. Either way you are done. If Vera's three matching lines were blue instead, swap the color names.
Why five is not enough
To show that six is the true threshold, you need one coloring of five points with no one-color triangle. Place the five points at the corners of a pentagon. Color the five outer edges red and the five diagonals blue.
The red lines form a single loop of length five, so no three of them close into a triangle. The blue diagonals trace a five-pointed star, which is also a single loop of length five. Neither color contains a triangle.
Both halves matter. A forcing argument shows that six points are enough, and a counterexample shows that five are not. Together they establish an exact value.
Ramsey numbers
The general question replaces triangles with larger groups. The Ramsey number R(s, t) is the smallest number n such that every red and blue coloring of all the lines among n points contains either s points joined entirely in red or t points joined entirely in blue. The party problem says R(3, 3) = 6.
In graph theory language, a set of points with every pair joined is called a clique. If you are new to the vocabulary, graph theory through familiar networks introduces vertices and edges.
Frank Ramsey, a British mathematician and philosopher, proved around 1930 that R(s, t) always exists. His interest was a question in logic. The theorem guarantees a finite threshold for any sizes you name, and for any fixed number of colors.
A few values are known exactly:
| Ramsey number | Value | Meaning |
|---|---|---|
| R(3, 3) | 6 | 6 points force a one-color triangle |
| R(3, 4) | 9 | 9 points force a red triangle or a blue group of 4 |
| R(3, 5) | 14 | 14 points force a red triangle or a blue group of 5 |
| R(4, 4) | 18 | 18 points force a one-color group of 4 |
| R(4, 5) | 25 | 25 points force a red 4 or a blue 5 |
| R(3, 3, 3) | 17 | with three colors, 17 points force a one-color triangle |
Why they are so hard to compute
You might expect a computer to settle R(5, 5) by trying every coloring. The number of colorings makes that hopeless. It has been known for decades that R(5, 5) is at least 43, and upper bounds sit in the high 40s. Checking all colorings of 43 points would mean handling 903 lines, each with two choices, for 2⁹⁰³ possibilities. That is a number with more than 270 digits.
Clever pruning and symmetry cut the work enormously, which is how the bounds have slowly tightened. Still, the gap has not closed as of the mid-2020s. For R(6, 6) the known range is much wider.
A useful general upper bound comes from the same reasoning as the party proof:
R(s, t) ≤ R(s − 1, t) + R(s, t − 1) (split one point's lines by color)
R(4, 4) ≤ R(3, 4) + R(4, 3) = 9 + 9 = 18 For R(4, 4) the bound turns out to be exact, because there is a coloring of 17 points with no one-color group of four. In larger cases the recursion usually overshoots.
Lower bounds from random colorings
How do you show that some coloring avoids large one-color groups when you cannot draw one? In 1947 Paul Erdős gave an answer that changed combinatorics. Color every line by a fair coin flip and ask how many one-color groups of size k you expect to see.
A particular set of k points has k(k − 1)/2 lines. The chance that they all match is 2 times (1/2) raised to that power. Multiply by the number of possible sets of k points. If the result is less than 1, then some coloring must have no one-color group at all, because otherwise every coloring would have at least one and the average could not drop below 1.
Working this out shows that R(k, k) is larger than about 2 raised to the power k/2 for k ≥ 3. The proof tells you good colorings exist without showing you one, an idea developed further in the probabilistic method.
From the other side, the recursion above gives R(k, k) ≤ 4ᵏ roughly. For many decades the base 4 resisted improvement. In 2023 a team of four mathematicians (Campos, Griffiths, Morris and Sahasrabudhe) announced a proof that it can be replaced by a number slightly below 4, which was widely seen as a major advance. The true growth rate between √2 and that upper base is still unknown.
Order beyond graphs
The same theme shows up across mathematics, which is why the subject is called a theory and not a single puzzle.
- Number sequences. Van der Waerden's theorem says that if you color enough consecutive whole numbers with a fixed number of colors, some color contains an evenly spaced run of the length you asked for. With two colors and runs of length 3, the numbers 1 through 9 are enough. The numbers 1 through 8 are not: color them red, red, blue, blue, red, red, blue, blue.
- Sums. Schur's theorem says that any finite coloring of a long enough stretch of positive integers contains a one-color solution of x + y = z.
- Orderings. The Erdős–Szekeres theorem says that any list of 10 different numbers contains 4 that rise or 4 that fall, reading left to right.
- Geometry. Any five points in the plane, with no three on a line, include four that form a convex quadrilateral.
Several of these connect to additive combinatorics, which studies the structure hiding inside sets of integers.
Common misconceptions
"Ramsey theory says patterns in random data are meaningful." It says close to the opposite. Large data sets must contain some striking patterns, so finding one is not by itself evidence of any cause. You need to ask how many places you looked.
"The forced pattern is large." It is usually tiny compared with the system. Guaranteeing a one-color group of size k takes a number of points that grows exponentially in k.
"Ramsey's theorem tells you where the pattern is." It guarantees existence. Finding the group in a particular large network can be computationally expensive.
"Unknown values mean the theory is vague." Each Ramsey number is a definite whole number. We simply do not know which one it is.
Common questions
Does knowing someone have to be mutual?
In the model, yes: each pair gets exactly one color. If relationships can run one way, you need directed graphs, and the questions and answers change.
Why does Ramsey theory matter to computer science?
Ramsey-type arguments help prove that certain problems need a minimum amount of memory or communication. The hunt for explicit colorings that behave as well as random ones is also tied to the study of randomness in computation.
Can I try this myself?
Yes. Take two colored pens, draw six dots, join all pairs and try to avoid a one-color triangle. You will be forced into one no later than the last line. Then try the same on five dots and look for the pentagon pattern. For a related family of forced-structure questions, see how many edges force a triangle.