**Ramsey theory**, named after the British mathematician and philosopher Frank P. Ramsey, is a branch of mathematics that focuses on the appearance of order in a substructure given a structure of a known size. Problems in Ramsey theory typically ask a question of the form: "how big must some structure be to guarantee that a particular property holds?" More specifically, Ron Graham described Ramsey theory as a "branch of combinatorics".^{[1]}

A typical result in Ramsey theory starts with some mathematical structure that is then cut into pieces. How big must the original structure be in order to ensure that at least one of the pieces has a given interesting property? This idea can be defined as partition regularity.

For example, consider a complete graph of order *n*; that is, there are *n* vertices and each vertex is connected to every other vertex by an edge. A complete graph of order 3 is called a triangle. Now colour each edge either red or blue. How large must *n* be in order to ensure that there is either a blue triangle or a red triangle? It turns out that the answer is 6. See the article on Ramsey's theorem for a rigorous proof.

Another way to express this result is as follows: at any party with at least six people, there are three people who are all either mutual acquaintances (each one knows the other two) or mutual strangers (none of them knows either of the other two). See theorem on friends and strangers.

This also is a special case of Ramsey's theorem, which says that for any given integer *c*, any given integers *n*_{1},...,*n*_{c}, there is a number, *R*(*n*_{1},...,*n*_{c}), such that if the edges of a complete graph of order *R*(*n*_{1},...,*n*_{c}) are coloured with *c* different colours, then for some *i* between 1 and *c*, it must contain a complete subgraph of order *n _{i}* whose edges are all colour

Two key theorems of Ramsey theory are:

- Van der Waerden's theorem: For any given
*c*and*n*, there is a number*V*, such that if*V*consecutive numbers are coloured with*c*different colours, then it must contain an arithmetic progression of length*n*whose elements are all the same colour. - Hales–Jewett theorem: For any given
*n*and*c*, there is a number*H*such that if the cells of an*H*-dimensional*n*×*n*×*n*×...×*n*cube are coloured with*c*colours, there must be one row, column, etc. of length*n*all of whose cells are the same colour. That is: a multi-player*n*-in-a-row tic-tac-toe cannot end in a draw, no matter how large*n*is, and no matter how many people are playing, if you play on a board with sufficiently many dimensions. The Hales–Jewett theorem implies Van der Waerden's theorem.

A theorem similar to van der Waerden's theorem is *Schur's theorem*: for any given *c* there is a number *N* such that if the numbers 1, 2, ..., *N* are coloured with *c* different colours, then there must be a pair of integers *x*, *y* such that *x*, *y*, and *x*+*y* are all the same colour. Many generalizations of this theorem exist, including Rado's theorem, Rado–Folkman–Sanders theorem, Hindman's theorem, and the Milliken–Taylor theorem. A classic reference for these and many other results in Ramsey theory is Graham, Rothschild, Spencer and Solymosi, updated and expanded in 2015 to its first new edition in 25 years.^{[2]}

Results in Ramsey theory typically have two primary characteristics. Firstly, they are non-constructive: they may show that some structure exists, but they give no process for finding this structure (other than brute-force search). For instance, the pigeonhole principle is of this form. Secondly, while Ramsey theory results do say that sufficiently large objects must necessarily contain a given structure, often the proof of these results requires these objects to be enormously large – bounds that grow exponentially, or even as fast as the Ackermann function are not uncommon. In some small niche cases, upper and lower bounds are improved, but not in general. In many cases these bounds are artifacts of the proof, and it is not known whether they can be substantially improved. In other cases it is known that any bound must be extraordinarily large, sometimes even greater than any primitive recursive function; see the Paris–Harrington theorem for an example. Graham's number, one of the largest numbers ever used in serious mathematical proof, is an upper bound for a problem related to Ramsey theory. Another large example is the Boolean Pythagorean triples problem.^{[3]}

Theorems in Ramsey theory are generally one of the following two types. Many such theorems, which are modeled after Ramsey's theorem itself, assert that in every partition of a large structured object, one of the classes necessarily contains a large structured subobject, but give no information about which class this is. In other cases, the reason behind a *Ramsey-type* result is that the largest partition class always contains the desired substructure. The results of this latter kind are called either *density results* or *Turán-type result*, after Turán's theorem. Notable examples include Szemerédi's theorem, which is such a strengthening of van der Waerden's theorem, and the density version of the Hales-Jewett theorem.^{[4]}