Exercise 1809Combinatorics › Pigeonhole principleOlympiadAdded 3 Nov 2026
Increasing or decreasing subsequence
#pigeonhole#Erdős–Szekeres#subsequence
Statement
Show that any sequence of distinct real numbers contains an increasing subsequence of length or a decreasing subsequence of length .
Hint
Assign to each element the pair where inc is the length of the longest increasing subsequence ending there, dec similarly for decreasing.
Show solutionHide solution
Solution
Pairs. For each element , let be the length of the longest increasing subsequence ending at , and similarly for decreasing.
Distinctness. If and , then . If , then . So all pairs are distinct.
Pigeonhole. Each coordinate is at most if no inc or dec subsequence of length exists. So at most distinct pairs. But there are elements. Contradiction.
Conclusion. Either an increasing or a decreasing subsequence of length exists. (Erdős–Szekeres theorem.)