Erdős–Szekeres theorem

A path of four upward-sloping edges in a set of 17 points. By the Erdős–Szekeres theorem, every set of 17 points has a path of this length that slopes either upward or downward. The 16-point subset with the central point removed has no such path.

In mathematics, the Erdős–Szekeres theorem asserts that, given and , any sequence of distinct real numbers with length at least contains a monotonically increasing subsequence of length r or a monotonically decreasing subsequence of length s. The proof appeared in the same 1935 paper that mentions the Happy Ending problem.

It is a finitary result that makes precise one of the corollaries of Ramsey's theorem. While Ramsey's theorem makes it easy to prove that every infinite sequence of distinct real numbers contains a monotonically increasing infinite subsequence or a monotonically decreasing infinite subsequence, the result proved by Paul Erdős and George Szekeres goes further.