A convex function is one in which a line drawn between any two points on the graph lies on the graph or above it. There is only one requirement.
A non-convex function is one in which a line drawn between any two points on the graph may cross additional points. It was described as “wavy.”
When a cost function is non-convex, it has a higher chance of finding local minima rather than the global minimum, which is usually undesirable in machine learning models from an optimization standpoint.