No history yet

Convex Optimization Basics

The Shape of the Problem

Optimization is all about finding the best possible solution to a problem. This often means finding the lowest point in a mathematical landscape, like a hiker trying to find the bottom of a valley. But not all valleys are created equal. Some are simple bowls, while others are full of smaller dips and hills. This is where the idea of convexity comes in.

A shape is convex if you can pick any two points inside it and the straight line connecting them stays completely within the shape. Think of a circle or a square. No matter which two points you choose, the line between them never leaves the shape.

Lesson image

Now, consider a star shape or a crescent moon. You can easily find two points where the line connecting them passes through empty space outside the shape. These are non-convex.

This simple geometric idea is the foundation for understanding convex optimization.

Convex Functions

Just like we have convex shapes, we also have convex functions. A function is convex if its graph is bowl-shaped. More formally, if you pick any two points on the graph of the function and draw a straight line between them, that line segment will always lie above or on the function's curve. It never dips below.

The classic example of a convex function is f(x)=x2f(x) = x^2, which forms a perfect parabola. In contrast, a function like f(x)=sin(x)f(x) = \sin(x) is non-convex because it has multiple peaks and valleys.

This property can be expressed mathematically. For any two points xx and yy and any value λ\lambda between 0 and 1, a function ff is convex if:

f(λx+(1λ)y)λf(x)+(1λ)f(y)f(\lambda x + (1-\lambda)y) \le \lambda f(x) + (1-\lambda)f(y)

This formula might look complex, but it's just a precise way of stating the "line-above-the-curve" rule. The left side represents a point on the function's curve, and the right side represents a point on the straight line segment connecting two other points on the curve.

Lesson image

Why Convexity Matters

So why is this distinction so important in optimization? It comes down to one crucial property: simplicity.

When you're trying to find the minimum value of a function, a convex function makes your job easy. Because it's a single bowl, it has only one bottom. This means any local minimum—a point that's lower than its immediate neighbors—is also the global minimum, the lowest point across the entire function. There are no other valleys to get stuck in.

For a convex function, if you find a valley, you've found the valley.

Imagine you're blindfolded on a hilly landscape and your task is to find the lowest point. If the landscape is non-convex (full of many hills and valleys), you might find a small dip and think you're at the bottom. But you could be in a small crater on the side of a huge mountain, far from the true lowest point.

If the landscape is convex (a single, giant bowl), your task is simple. Just keep walking downhill. Any step you take that goes down is a step in the right direction. Eventually, you are guaranteed to reach the one and only bottom.

This reliability is why convex optimization is so powerful. When a problem can be framed in a convex way, we can use efficient and dependable algorithms to find the single best solution. It transforms a potentially messy search into a straightforward descent.

Quiz Questions 1/5

Which of the following best describes a convex shape?

Quiz Questions 2/5

In the context of optimization, what is the main advantage of a problem being convex?

Understanding these core concepts—convex sets, convex functions, and why their structure is so useful—provides a solid base for tackling more complex optimization challenges.