A convex function is a continuous function whose value at the midpoint of every interval in its domain does not exceed the arithmetic mean of its values at the ends of the interval.
More generally, a function is convex on an interval
if for any two points
and
in
and any
where
,
(Rudin 1976, p. 101; cf. Gradshteyn and Ryzhik 2000, p. 1132).
If
has a second derivative in
, then a necessary and sufficient condition for it to be convex on that interval
is that the second derivative
for all
in
.
If the inequality above is strict for all and
, then
is called strictly convex.
Examples of convex functions include for
or even
,
for
, and
for all
. If the sign of the inequality is reversed, the function is
called concave.