A set is convex if it keeps every segment between its points
Pick any two points in a convex set and the straight segment joining them never leaves it. A solid cube passes that test, while anything hollow or dented, such as a crescent, fails. The smallest convex set wrapping a given shape is its convex hull, and convex functions are those whose epigraph is convex.
Formally, in a vector or affine space over the reals or any ordered field, a set is convex when every blend (1 − t)x + ty with t between 0 and 1 stays inside for any members x and y. Affine transformations preserve the property, and in a topological vector space it forces the set to be path-connected. A set is strictly convex when every point strictly between two members sits in the interior, and a closed convex set meets that stronger condition exactly when each boundary point is extreme.
On the real line the convex sets are just points and intervals. In the plane, solid triangles, solid regular polygons and their intersections qualify; in space, the Platonic and Archimedean solids do, while the star-shaped Kepler–Poinsot polyhedra do not. Most authorities reject calling a non-convex set concave, though the word survives for polygons, and the complement of a convex set is sometimes termed reverse convex in optimisation.
Intersections of any number of convex sets remain convex, and so do the empty set and the whole space. Unions are trickier: two convex sets can combine into a non-convex one, and the union stays convex only if the sets form a nested chain. Closed convex sets are exactly the intersections of closed half-spaces, a fact proved with the supporting hyperplane theorem, itself a special case of the Hahn–Banach theorem. The Krein–Milman theorem adds that in a locally convex space any compact convex set can be rebuilt as the closure of the hull of its extreme points.
The hull can be built from weighted averages: mixing finitely many points with nonnegative weights summing to one gives a convex combination, and the hull is the set of all such mixes. A bounded convex polytope is the hull of finitely many points. Convex analysis studies these sets and functions, and convex minimisation seeks the lowest value of a convex function over a convex set.
Source: Convex set