# Happy ending problem

In mathematics, the "happy ending problem" (so named by Paul Erdős because it led to the marriage of George Szekeres and Esther Klein) is the following statement:
Theorem — any set of five points in the plane in general position has a subset of four points that form the vertices of a convex quadrilateral.
This was one of the original results that led to the development of Ramsey theory.
The happy ending theorem can be proven by a simple case analysis: if four or more points are vertices of the convex hull, any four such points can be chosen. If on the other hand, the convex hull has the form of a triangle with two points inside it, the two inner points and one of the triangle sides can be chosen. See Peterson (2000) for an illustrated explanation of this proof, and Morris & Soltan (2000) for a more detailed survey of the problem.
The Erdős–Szekeres conjecture states precisely a more general relationship between the number of points in a general-position point set and its largest subset forming a convex polygon, namely that the smallest number of points for which any general position arrangement contains a convex subset of $n$ points is $2^{n-2}+1$. It remains unproven, but less precise bounds are known.

## Larger polygons

Erdős & Szekeres (1935) proved the following generalisation:
Theorem — for any positive integer N, any sufficiently large finite set of points in the plane in general position has a subset of N points that form the vertices of a convex polygon.
The proof appeared in the same paper that proves the Erdős–Szekeres theorem on monotonic subsequences in sequences of numbers.
Let f(N) denote the minimum M for which any set of M points in general position must contain a convex N-gon. It is known that
* f(3) = 3, trivially.
* f(4) = 5.
* f(5) = 9. A set of eight points with no convex pentagon is shown in the illustration, demonstrating that f(5) > 8; the more difficult part of the proof is to show that every set of nine points in general position contains the vertices of a convex pentagon.
* f(6) = 17.
* The value of f(N) is unknown for all N > 6. By the result of Erdős & Szekeres (1935), f(N) is known to be finite for all finite N.
On the basis of the known values of f(N) for N = 3, 4 and 5, Erdős and Szekeres conjectured in their original paper that
$f(N)=1+2^{N-2}\quad {\text{for all }}N\geq 3.$ They proved later, by constructing explicit examples, that $f(N)\geq 1+2^{N-2}.$ In 2016 Andrew Suk showed that for N ≥ 7 $f(N)\leq 2^{N+o(N)}.$
Suk actually proves, for N sufficiently large,
$f(N)\leq 2^{N+6N^{2/3}logN}.$
This was subsequently improved to:
$f(N)\leq 2^{N+O({\sqrt {NlogN}})}.$

## Empty convex polygons

There is also the question of whether any sufficiently large set of points in general position has an "empty" convex quadrilateral, pentagon, etc., that is, one that contains no other input point. The original solution to the happy ending problem can be adapted to show that any five points in general position have an empty convex quadrilateral, as shown in the illustration, and any ten points in general position have an empty convex pentagon. However, there exist arbitrarily large sets of points in general position that contain no empty convex heptagon.
For a long time the question of the existence of empty hexagons remained open, but Nicolás (2007) and Gerken (2008) proved that every sufficiently large point set in general position contains a convex empty hexagon. More specifically, Gerken showed that the number of points needed is no more than f(9) for the same function f defined above, while Nicolás showed that the number of points needed is no more than f(25). Valtr (2008) supplies a simplification of Gerken's proof that however requires more points, f(15) instead of f(9). At least 30 points are needed; there exists a set of 29 points in general position with no empty convex hexagon. The question was finally answered by Heule & Scheucher (2024), who showed, using a SAT solving approach, that indeed every set of 30 points in general position contains an empty hexagon.

## Related problems

The problem of finding sets of n points minimizing the number of convex quadrilaterals is equivalent to minimizing the crossing number in a straight-line drawing of a complete graph. The number of quadrilaterals must be proportional to the fourth power of n, but the precise constant is not known.
It is straightforward to show that, in higher-dimensional Euclidean spaces, sufficiently large sets of points will have a subset of k points that forms the vertices of a convex polytope, for any k greater than the dimension: this follows immediately from existence of convex k-gons in sufficiently large planar point sets, by projecting the higher-dimensional point set into an arbitrary two-dimensional subspace. However, the number of points necessary to find k points in convex position may be smaller in higher dimensions than it is in the plane, and it is possible to find subsets that are more highly constrained. In particular, in d dimensions, every d + 3 points in general position have a subset of d + 2 points that form the vertices of a cyclic polytope. More generally, for every d and k > d there exists a number m(d, k) such that every set of m(d, k) points in general position has a subset of k points that form the vertices of a neighborly polytope.