What is the difference between convex and non-convex cost functions?

src: wiki

Convex and non-convex functions are two types of mathematical functions that behave differently with respect to their curvature.

A function is said to be convex if any line segment connecting two points on the graph of the function lies entirely above the graph. In other words, a function is convex if it always bends upward.