Question: what is the difference between a convex function and non-convex?
Answer: A convex function: given any two points on the curve there will be no intersection with any other points, for non convex function there will be at least one intersection. In terms of cost function with a convex type you are always guaranteed to have a global minimum, whilst for a non convex only local minima.