## A recap of the Lagrangian method

If you remember how to solve an optimization problem using Lagrange multipliers, you can skip this section. Suppose you have an optimization problem

Then you first construct the **Lagrangian**:

where each is called a **Lagrange multiplier.** Then, you set all partial derivatives to 0:

Only when there exists some values for each satisfying all the above equations, will there exist some solution for .

## Primal problems and duality

Let’s consider a slightly more difficult problem. Suppose our optimization problem is

The Lagrangian for this problem is similar:

This is where it gets interesting. Let’s define a problem:

To understand why this problem is interesting, we need to consider yet *another* problem:

It turns out that this problem is actually equal to our original problem of minimizing (at the beginning of this topic). To see why, suppose that some (which violates a condition of our original problem). Because the optimizer wants to maximize , it could simply set to . Similarly, suppose we have a violation of the second condition, i.e., for some , . Then the optimizer could set the corresponding to either or depending on the sign of . Therefore, if the constraints are satisfied, then , otherwise . Thus, to minimize , the optimizer had better find values of such that the constraints are satisfied.

The subscript in the above discussion is due to the fact that the original problem above is called a **primal problem**. Now for every primal problem, there is a corresponding **dual problem**. The dual problem is the below.

This really is the same problem, with the max and min parts swapped. However, this swap does make a difference. It turns out that for any function to be optimized,

Why are we bothering with primal and dual problems in the first place? For some cases, the dual problem is easier to optimize than the primal problem, so the solution to the primal problem involves finding the dual, and then solving that problem. Obviously, this procedure will only work in the cases where the equality above holds true. Let’s look at the conditions for this.

Suppose that and all the are convex functions, and that all are *affine* (). Further, assume that all the are *strictly feasible*–this means that there exists some such that all the (the strict word here means that all the conditions are satisfied with inequality; there’s no equality in this condition).

Under these conditions, the value of the dual problem will be equal to the value of the primal problem. Further, there will exist such that satisfies the primal problem, satisfy the dual problem, and a set of conditions, called the **Karush-Kuhn-Tucker (KKT) conditions, **will be satisfied. The converse of this statement is also true. There are five conditions, but only three interest us:

Observe that if in the last condition, only the inequality holds, then all of must be 0 to satisfy the first condition.

Let’s now use this knowledge to pose the dual of our problem.