In mathematics, a real-valued function is called convex if the line segment between any two distinct points on the graph of the function lies above or on the graph of the function between the two points. Equivalently, a function is convex if its epigraph (the set of points on or above the graph of the function) is a convex set. In simple terms, a convex function graph is shaped like a cup (or a straight line like a linear function), while a concave function's graph is shaped like a cap .
A twice-differentiable function of a single variable is convex if and only if its second derivative is nonnegative on its entire domain. Well-known examples of convex functions of a single variable include a linear function (where is a real number), a quadratic function ( as a nonnegative real number) and an exponential function ( as a nonnegative real number).