Ideally we want our cost/loss function to be convex(concave).
First we give the definition of a convex set: A set C in Rn is said to be convex if, for all x and y in C and all t∈(0,1) , the point (1−t)x+ty also belongs to C. Geometrically this means that every point on the line segment connecting x and y is in C as discussed below.
The convex subsets of R are the intervals of R. Examples of convex sets of R2 are the regular polygons (triangles, rectangles, pentagons, etc...).