Five coplanar points have a subset forming a convex quadrilateral
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:
 ;templatestyles src="Math_theorem/styles.css" / ;
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 for an illustrated explanation of this proof, and 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 formula_1 points is formula_2. It remains unproven, but less precise bounds are known.
Larger polygons.
 proved the following generalisation:
 ;templatestyles src="Math_theorem/styles.css" / ;
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
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 
formula_3
They proved later, by constructing explicit examples, that
formula_4
In 2016 Andrew Suk showed that for "N" ≥ 7
formula_5
Suk actually proves, for N sufficiently large, 
formula_6
This was subsequently improved to:
formula_7
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 and 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). 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 , 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.
Notes.
 ;templatestyles src="Reflist/styles.css" / ;
References.
 ;templatestyles src="Refbegin/styles.css" / ;