On this page
Write any ten different numbers in any order. However hard you try, four of them will rise from left to right, or four will fall. The proof needs only careful counting and the pigeonhole principle.
What does the Erdős–Szekeres theorem say?
Paul Erdős and George Szekeres proved it in A combinatorial problem in geometry, Compositio Mathematica volume 2 (1935), pages 463–470. In its general form, as stated on the Erdős–Szekeres theorem page, any sequence of distinct real numbers of length at least (r − 1)(s − 1) + 1 contains an increasing subsequence of length r or a decreasing subsequence of length s.
Put r = s = n + 1 and the length becomes n² + 1. So:
5 distinct numbers always contain a monotone subsequence of 3 (n = 2).
10 distinct numbers always contain one of 4 (n = 3).
101 distinct numbers always contain one of 11 (n = 10).
A subsequence keeps the original order but may skip entries. In 5, 3, 8, 1, 9 the numbers 3, 8, 9 form an increasing subsequence even though they are not side by side. Below, "run" means such a subsequence, not a block of neighbours.
How does the pigeonhole proof work?
The standard short proof is the one-page argument in A. Seidenberg's A simple proof of a theorem of Erdős and Szekeres, Journal of the London Mathematical Society (1959). Give every number in the sequence a label (I, D):
I = length of the longest increasing subsequence that ends at this number.
D = length of the longest decreasing subsequence that ends at this number.
Now take any two positions, an earlier one j and a later one k. If the number at j is smaller, you can extend the best increasing run ending at j by the number at k, so I at k is bigger. If it is larger, the same happens to D. Either way, no two numbers share a label.
Suppose no monotone subsequence reaches n + 1. Then I and D each lie between 1 and n, which allows only n × n = n² different labels. But there are n² + 1 numbers, each with its own label. The pigeonhole principle says that is impossible, so some I or D must be at least n + 1.
What does the proof look like on ten numbers?
Take 5, 3, 8, 1, 9, 4, 7, 2, 10, 6. Working left to right, the labels are:
5: (1, 1)
3: (1, 2)
8: (2, 1)
1: (1, 3)
9: (3, 1)
4: (2, 2)
7: (3, 2)
2: (2, 3)
10: (4, 1)
6: (3, 3)
All ten labels differ, and only nine fit inside a 3 × 3 grid. The one that falls outside, (4, 1) at the number 10, points straight to an increasing run of four: 1, 4, 7, 10.
Why can't you do better than n² + 1?
Because there is a sequence of length n² with no monotone run of n + 1. For n = 3, split 1 to 9 into three blocks and write each block backwards: 3, 2, 1, 6, 5, 4, 9, 8, 7.
Any decreasing subsequence must stay inside one block, so it has at most 3 numbers.
Any increasing subsequence can take at most one number from each block, so it also has at most 3.
The same recipe, n reversed blocks of n numbers, works for every n, so n² + 1 is the exact threshold.
What is patience sorting and how does it connect?
David Aldous and Persi Diaconis describe a one-person card game, patience sorting, in their survey Longest increasing subsequences: from patience sorting to the Baik-Deift-Johansson theorem (Bulletin of the AMS, 1999). The patience sorting page records that Colin Mallows named it and that the number of piles equals the length of a longest increasing subsequence.
The rule: deal the numbers one by one; put each on the leftmost pile whose top is larger; if there is none, start a new pile on the right. With our ten numbers you get four piles: 5, 3, 1 / 8, 4, 2 / 9, 7, 6 / 10. Four piles, and indeed the longest increasing run has length four.
This gives a second proof. Every pile, read in the order dealt, is decreasing. If the longest increasing run has at most n numbers, there are at most n piles, and n² + 1 cards in n piles means one pile holds at least n + 1. That pile is your decreasing run.
The same pigeonhole idea drives why six people always contain three friends or three strangers, and the combinatorics guide for Class 11 Applied Maths covers the counting underneath. For another ordered list, see Farey sequences and mediants.
When you are ready to try one alone, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer, and the Fermi Concept Library gives every concept in mathematics its own lesson.



