A convex function “only curves upwards.” To check whether a function is convex, use the following procedure:
Draw the graph of the function.
Select any two points in the graph.
Draw a line segment connecting the two points.
See whether this line segment is ever lower than the graph.
If the line segment is ever lower than the graph, the function is not convex. The function graphed above is not convex, as can be seen by looking at the red part of the line segment. On the other hand, if the line segment never goes below the graph (no matter which two initial points you selected), then the function is convex.
Equivalently, a function is convex if its convex set.is a