**Ramsey's theorem** is a mathematical theorem in Ramsey theory. It states for any pair of positive integers (*r*,*s*) there exists an integer *R*(*r*,*s*) such that for any complete graph on *R*(*r*,*s*) vertices whose edges are coloured red or blue, there exists either a monochromatic complete subgraph on *r* vertices which is entirely blue or a monochromatic complete subgraph on *s* vertices which is entirely red.

An extension of this theorem applies to any finite number of colours, rather than just two. More precisely, the theorem states that for any given number of colors *c*, and any given integers *n*_{1},...,*n _{c}*, there is a number,

Suppose the edges of a complete graph on 6 vertices are coloured red and blue. Pick a vertex *v*. There are 5 edges incident to *v* and so (by the pigeonhole principle) at least 3 of them must be the same colour. Without losing generality we can assume at least 3 of these edges, connecting to vertices *r*, *s* and *t*, are blue. (If not, exchange red and blue in what follows.) If any of the edges (*r*, *s*), (*r*, *t*), (*s*, *t*) are also blue then we have an entirely blue triangle. If not, then those three edges are all red and we have with an entirely red triangle. Since this argument works for any colouring *any* *K*_{6} contains a monchromatic *K*_{3} and therefore that *R*(3,3;2) ≤ 6.

An alternate proof works by double counting. It goes as follows. Count the number of ordered triples of vertices *x*, *y*, *z* such that the edge (*xy*) is red and the edge (*yz*) is blue. Firstly, any given vertex will be the middle of either 0×5=0, 1×4=4 or 2×3=6 such triples. Therefore there are at most 6×6=36 such triples. Secondly, for any non-monochromatic triangle (**xyz**), there exists precisely two such triples. Therefore there are at most 18 non-monochromatic triangles. Therefore there are at least 2 monochromatic triangles.

Conversely, it is possible to 2-colour a *K*_{5} without creating any monochromatic *K*_{3}, showing that *R*(3,3;2) > 5. The unique coloring is:

Thus *R*(3,3;2) = 6

We prove the theorem for the 2 colour case, by induction on *r*+*s*.
It is clear from the pigeonhole principle that for all *n*, *R*(*n*,1) = *R*(1,*n*) = *n*. This starts the induction.
We prove that *R*(*r*,*s*) exists by finding an explicit bound for it. By the inductive hypothesis *R*(*r*−1,*s*) and *R*(*r*,*s*−1) exist.

__Claim: R(r,s) ≤ R(r−1,s) + R(r,s−1):__
Consider a complete graph on

Now either |*M*| ≥ *R*(*r* −1,*s*) or |*N*| ≥ *R*(*r*,*s* −1), again by the pigeonhole principle.
In the former case if *M* has a red *K _{s}* then so does the original graph and we are finished. Otherwise

Thus the claim is true and we have completed the proof for 2 colours. We now prove the result for the general case of *c* colours. The proof is again by induction, this time on the number of colours *c*. We have the result for *c*=1 (trivially) and for *c*=2 (above). Now let *c*>2.

__Claim: R(n_{1},...,n_{c};c) ≤ R(n_{1},...,n_{c−2},R(n_{c-1},n_{c};2);c−1)__

Proof: The right-hand side of the inequality exists by inductive hypothesis. Consider a graph on this many vertices and colour it with *c* colours. Now 'go colour-blind' and pretend that *c*−1 and *c* are the same colour. Thus the graph is now (*c*−1)-coloured. By the inductive hypothesis, it contains either a *K _{ni}* monochromatically coloured with colour

A further result, also commonly called *Ramsey's theorem*, applies to infinite graphs. In a context where finite graphs are also being discussed it is often called the "Infinite Ramsey theorem". As intuition provided by the pictoral representation of a graph is diminished when moving from finite to infinite graphs, theorems in this area are usually phrased in set-theoretic terminology.

The theorem: Let *X* be some countably infinite set and colour the elements of *X ^{(n)}* (the subsets of

Proof: The proof is given for *c*=2. It is easy to prove the theorem for an arbitrary number of colours using a 'colour-blindness' argument as above. The proof is by induction on 'n', the size of the subsets. For *n*=1,the statement is equivalent to saying that if you split an infinite set into two sets, one of them is infinite. This is evident. Assuming the theorem is true for *n*≤*r*, we prove it for *n*=*r+1*. Given a 2-colouring of the (*r*+1)-element subsets of infinite set *X*, choose element a_{0} of *X* (note that in the statement of the theorem we insisted that *X* was *countably* infinite, if *X* were a general infinite set we would require the axiom of choice to make this choice) and let *Y* = *X*\\*a*_{0}. We then induce a 2-colouring of the *r*-element subsets of *Y*, by just adding *a*_{0} to each *r*-element subset (to get an (*r*+1)-element subset of *X*. By the induction hypothesis, there exists an infinite subset *Y*_{1} within *Y* such that every *r*-element subset of *Y* is coloured the same colour in the induced colouring. Therefore we have chosen an element *a*_{0} and a subset *Y*_{1} such that every (*r*+1)-element subset of *X* consisting of *a*_{0} and *r* elements of *Y*_{1} has the same colour. Continuing in this we can choose *a*_{1} from *Y*_{1} and subset *Y*_{2} of *Y*_{1} with the same properties. We end with a sequence {*a*_{0},*a*_{1},*a*_{2},...} such that the colour of each (*r*+1)-element subset (*a*_{i(1)},*a*_{i(2)},...,*a*_{i(r+1)}) with *i*(1)<*i*(2)<...<*i*(*r*+1) depends only on the value of *i*(1). Further, there are infinitely many values of *i*(*n*) such that this colour will be the same. Take these *a*_{i(n)}'s to get the desired monochromatic set.

Standard compactness arguments show that the infinite version of the theorem implies the finite version.

*Could give an inline version here?*