The curiosity came from SVM. Explained nicely by Steven

Convex Function: a real-valued function is called convex if the line segment between any two points on the graph of the function lies above the graph between the two points.

If you draw a line between any two points, it never dips below the graph itself

flow 1
flow 2

Why that matters for optimization: if a function is convex, it has at most one local minimum, and that local minimum is automatically the global minimum. There’s no way to get “stuck” somewhere worse, because there’s nowhere worse that looks like a minimum — the whole landscape slopes toward the single bottom.