Welcome back! Over the last few lessons, we have thoroughly explored the Pigeonhole Principle. You've mastered the basic and generalized forms and applied them to guarantee outcomes in various scenarios, including some clever applications in number theory.
Today, we'll use the Pigeonhole Principle to prove one of the most elegant and surprising results in combinatorics: the Erdős-Szekeres Theorem. This theorem reveals a remarkable truth about sequences: no matter how disordered a sequence of numbers might appear, if it's long enough, it must contain a highly ordered subsequence. This lesson will guide you through the beautiful proof of this theorem, which is a classic example of the kind of powerful, non-obvious argument that is a cornerstone of Olympiad-level mathematics.
Our learning outcome for this session is to prove the Erdős-Szekeres theorem on the existence of monotonic subsequences.
What is a Monotonic Subsequence?
Before we state the theorem, let's be precise about our terms. A sequence is an ordered list of numbers. A subsequence is formed by deleting zero or more elements from the original sequence, while keeping the remaining elements in their original relative order.
A sequence is called monotonic if it is either non-decreasing (always going up or staying the same) or non-increasing (always going down or staying the same). The Erdős-Szekeres theorem is usually stated for distinct numbers, so we'll focus on strictly increasing or strictly decreasing subsequences.

Let's watch a short video segment that defines these terms with clear examples.
CO5 The Erdos-Szekeres Theorem
This video from Shahriar Shahriari introduces the concepts we'll need for the theorem.
Please watch from the beginning of the definitions at this segment to understand the difference between increasing, non-decreasing, decreasing, and non-increasing. Then, continue watching from the next segment, where he demonstrates how to find monotonic subsequences within a jumbled sequence.
The Erdős-Szekeres Theorem
With those definitions in hand, we can now state the theorem.
The Erdős-Szekeres Theorem (1935): Any sequence of distinct real numbers contains a monotonic subsequence of length at least .
This means that for any positive integer , if you give me a sequence of different numbers, I can always find either an increasing subsequence of length or a decreasing subsequence of length .
For example, if , the theorem states that any sequence of distinct numbers must contain either an increasing or a decreasing subsequence of length . This is a powerful guarantee of structure within randomness.
Proving the Theorem
The proof is a masterpiece of applying the Pigeonhole Principle. The main difficulty in many PHP proofs is not the principle itself, but cleverly defining the pigeons and pigeonholes.
Let's walk through the argument, which is one of the most famous in combinatorics. The core idea is to associate a special label with every element in our sequence. This label will capture information about the subsequences that end at that element.
The following reading from Yunian Pan's blog presents this proof with exceptional clarity. We will work through its logic here, and then you can read it to solidify your understanding.
Erdos-Szekeres Theorem | union's blog
This blog post provides a beautifully simple proof of the theorem. We will follow its logic step-by-step.
First, read the statement of the Monotone sequence theorem. Then, carefully study the section titled A Simple Proof. Focus on understanding how the labels (a_k, b_k) are defined and why they must all be unique.
Let's break down the proof from the reading.
1. The Setup:
We start with a sequence of distinct real numbers: .
2. The Clever Labeling (Defining the Pigeons):
For each element in the sequence (where goes from 1 to ), we assign a pair of integers as a label: .
- is the length of the longest increasing subsequence that ends with .
- is the length of the longest decreasing subsequence that ends with .
At a minimum, any element by itself forms a subsequence of length 1, so and .
3. The Crucial Insight: All Labels are Unique
This is the heart of the argument. Let's take any two elements from the sequence, say and , where . Because the numbers are distinct, there are only two possibilities for their values:
- Case 1: . We can take the longest increasing subsequence ending at (which has length ) and append to it. This creates a new increasing subsequence ending at with length . The longest one ending at must be at least this long. So, . This directly implies that .
- Case 2: . By the same logic, we can take the longest decreasing subsequence ending at (length ) and append . This gives a decreasing subsequence ending at of length . Therefore, , which implies .
In either case, the label cannot be the same as the label . Since this is true for any pair , all labels must be unique. These unique labels are our pigeons.
4. The Contradiction (Defining the Pigeonholes):
Let's assume, for the sake of contradiction, that the theorem is false. This means there is no monotonic subsequence of length .
What does this assumption imply about our labels?
- If there's no increasing subsequence of length , then the length of any increasing subsequence must be at most . So, for all , .
- Similarly, if there's no decreasing subsequence of length , then for all , .
This assumption severely restricts the possible labels we can have. The first number in the pair, , can only be one of values . The second number, , can also only be one of values. This gives a total of possible unique pairs . These possible pairs are our pigeonholes.
5. Applying the Pigeonhole Principle:
Here's the contradiction:
- We have pigeons (the labels for each element, which we proved are all unique).
- We have only pigeonholes (the possible label values under our assumption).
By the Pigeonhole Principle, it's impossible to fit unique items into slots. Our assumption must have been wrong.
Therefore, there must be at least one monotonic subsequence of length or greater. This completes the proof.
Is the Theorem "Best Possible"?
The theorem guarantees a result for a sequence of length . Could we do it with just numbers? The answer is no. To show this, we need to construct a counterexample: a sequence of length that has no monotonic subsequence of length .
Consider this construction for (a sequence of length ):
Now, arrange these numbers in decreasing blocks:
- Longest increasing subsequence: To make an increasing subsequence, you can pick at most one number from each block. Since there are only blocks, the longest increasing subsequence has length at most 3.
- Longest decreasing subsequence: To make a decreasing subsequence, you must stay within a single block. Each block has length , so the longest decreasing subsequence has length at most 3.
In this sequence of 9 numbers, no monotonic subsequence has length 4. This demonstrates that the bound is "tight" or "best possible."
You can see a more general visualization of this counterexample at the end of the Shahriari video.
CO5 The Erdos-Szekeres Theorem
The end of the video explains why the theorem is "best possible."
Watch the final segment from this timestamp to see the construction of a sequence of length n² that defeats the n+1 length condition.
Reflection
The primary goal of this lesson was to understand and internalize the proof. To ensure the concepts have settled, consider these questions:
- A Generalization: The theorem we proved is a special case of a more general result: a sequence of distinct real numbers has an increasing subsequence of length or a decreasing subsequence of length . How would you adapt the proof we just saw to prove this? (Hint: Think about the pigeonholes. What would their dimensions be?)
- The Role of "Distinct": Our proof relied on the numbers being distinct to ensure that if , then either or . What happens if numbers can be repeated? The theorem still holds if we look for a non-decreasing subsequence of length or a non-increasing subsequence of length . How would the inequalities in the proof change to accommodate this?
Conclusion
Today, we've reached a high point in our study of the Pigeonhole Principle by proving the celebrated Erdős-Szekeres theorem. This result beautifully illustrates the power of combinatorial arguments to find order in chaos.
Key Takeaways:
- The Erdős-Szekeres Theorem guarantees that any sequence of distinct numbers contains a monotonic subsequence of length at least .
- The proof is a classic application of the Pigeonhole Principle, using a clever labeling scheme.
- The core strategy was to assign a pair-label to each element , representing the lengths of the longest increasing and decreasing subsequences ending at that element.
- By showing all labels are unique (pigeons) and that a contradiction implies only possible labels exist (pigeonholes), the theorem is proved.
- The bound of is tight; it is possible to construct a sequence of length with no monotonic subsequence of length .
This concludes our module on the Pigeonhole Principle. You've seen how a surprisingly simple idea can lead to profound and powerful results.
In our next module, we will explore another fundamental tool in combinatorics: The Principle of Inclusion-Exclusion. This principle provides a systematic way to count the elements in the union of several sets, carefully correcting for overcounting, and it is essential for solving a wide range of complex counting problems.