In 1935, Hungarian mathematicians Paul Erdős and George Szekeres proved a celebrated theorem, which is now a classic, on relations between lengths of a sequence and its increasing (decreasing) subsequence [1
Theorem 1. (Erdős–Szekeres) Suppose
and is a sequence of real numbers. Then this sequence contains a monotonic increasing (decreasing) subsequence of terms or a monotonic decreasing (increasing) subsequence of terms.
More than 85 years have passed since then, and a whole subarea of combinatorics has grown up from the Erdős–Szekeres theorem. Even today we cannot fully appreciate the significance of this theorem, see, for instance, [2
The main goal of this paper is to describe the complete family of constraints on the lengths of a sequence, its longest increasing subsequence, and its longest decreasing subsequence.
Theorem 2. There exists a sequence T of length containing a longest increasing subsequence of length and a longest decreasing subsequence of length if and only if the numbers x, y and n satisfy the following conditions: Proof.
If either or the claim is evident.
In what follows, , and .
Necessity of the condition (1) immediately follows from the theorem of Erdős–Szekeres. Assume that the condition (1) is not satisfied, i.e., , then, according to the Erdős–Szekeres theorem, the sequence T of length n contains a monotone increasing subsequence of the length or a monotone decreasing subsequence of the length , which contradicts the hypothesis of the theorem. The violation of the condition (2) makes impossible the existence of two subsequences with specified lengths, one of which increases, while the other decreases. In fact, these two subsequences can have no more than one element in common; that is, the sum of their lengths should not exceed .
Sufficiency. Assume that and , and build a sequence T of length n, such that . This sequence is built according to the following scheme. We take a sequence of n natural numbers and divide it into x groups, in such a way that and satisfies the following conditions:
The numbers in each group are arranged in decreasing order.
All the numbers of a subsequent group are greater than all the numbers of a preceding group.
The first group consists of y elements: , which is possible by the condition .
We divide the remaining elements into groups as follows. Let and . Note that and . The first r groups represent decreasing subsequences of the length :
The last groups represent decreasing subsequences of length p. (If , then all decreasing subsequences have the length p):
Before passing to the proof of the sufficiency, we prove the following.
At the partition of elements into groups satisfying Conditions 1–4, the number of elements in each group does not exceed y.
It is given that
in accordance with the condition
If , then all groups are of the same length p and .
If , then taking into account that , and the fact that p and y are positive integers, we conclude with , while all the groups are of length p or . □
By the above construction and Claim 1, the longest decreasing subsequence in T is the first group and thus has length y, while each longest increasing subsequence is obtained by choosing exactly one element from each of x groups, giving length x. □
Example 1. Consider , and note that the conditions (1) and (2) are satisfied and and . By the construction given in the proof,
Clearly, the longest decreasing sequence of T is and has length , and the longest increasing subsequences each have length .
There are other methods of building sequences satisfying the conditions (1) and (2). For instance, by choosing the last group to be the longest decreasing subsequence rather than the first, or, say, by first creating the group consisting of x increasing integers , and then adding increasing groups of nearly equal size so that all the numbers in each group is smaller than the numbers in any previous group.