Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

KKT Conditions for Inequality Constrained Optimization

Hello! Welcome to our next lesson.

In our last session, we formulated optimization problems with inequality constraints and introduced the critical concepts of active/inactive constraints and complementary slackness. We concluded by transforming the constrained problem into an equivalent unconstrained min-max problem using the Lagrangian:

This formulation was a crucial theoretical step, creating a unified structure that doesn't depend on knowing which constraints are active beforehand.

Today, we will build directly on that foundation. Our goal is to derive the Karush-Kuhn-Tucker (KKT) conditions as necessary conditions for optimality. These conditions are the cornerstone of nonlinear optimization and are used extensively in machine learning to characterize the solutions to problems ranging from Support Vector Machines to regularized regression. By the end of this lesson, you will understand the complete set of conditions that a potential optimal solution must satisfy.

1. The Primal and Dual Problems

The min-max formulation we ended with is known as the primal problem. Let's denote its optimal value as :

Now, consider what happens if we swap the order of minimization and maximization. This gives us the dual problem, with an optimal value we'll call :

A fundamental result in optimization is the max-min inequality, which states that for any function of two variables, the "max-min" is always less than or equal to the "min-max." Therefore, we have:

This relationship is known as weak duality. The difference, , is called the duality gap.

2. Strong Duality: The Key to the Derivation

For many optimization problems of interest—specifically, for convex problems that satisfy certain regularity conditions (which we'll touch on later)—the duality gap is zero. This remarkable property is called strong duality:

Assuming strong duality holds for our problem, we can equate the optimal values of the primal and dual problems. This equality is the key that unlocks the KKT conditions.

The following video continues the derivation we started in the last lesson. It formally introduces the primal and dual problems, the duality gap, and the assumption of strong duality, which sets the stage for the final derivation.

Deriving the KKT conditions for Inequality-Constrained Optimization | Introduction to Duality

This video from 'Machine Learning & Simulation' will walk you through the concepts of duality and strong duality, which are essential for the derivation.

Please watch from 09:01 to 22:02. The first part (until 17:41) explains the transformation from the min-max problem to the primal-dual formulation and introduces the duality gap. The second part (from 17:41 onwards) explains the condition of strong duality and sets up the chain of equalities that we will use to derive the KKT conditions.

3. Deriving the KKT Conditions

Let's assume strong duality holds and that is a primal optimal solution (our solution to the original problem) and is a dual optimal solution.

From the video and our setup, we can establish a chain of relationships:

  1. is the optimal value of our original problem, which under strong duality is equal to and .
  2. The dual optimal value is obtained by evaluating the dual function at . The dual function itself, , is defined as the minimum of the Lagrangian over .
  3. Since the unconstrained minimum of must be less than or equal to the value of the function at any specific point, it must be less than or equal to its value at our solution .
  4. By definition of the Lagrangian, . Since is a feasible solution, we know . Since we also require , the sum must be less than or equal to zero. This gives us:

Now, let's put it all together:

This chain of inequalities starts and ends with . This forces the inequalities in the middle to become equalities, which gives us two crucial results:

Result 1: Complementary Slackness
From , we get:

Since each term is a product of a non-negative number () and a non-positive number (), each term is non-positive. The only way for a sum of non-positive terms to be zero is if every term is individually zero. Thus:

This is the complementary slackness condition we anticipated in the last lesson.

Result 2: Stationarity
From , we see that is an unconstrained minimizer of the function . In your multivariate calculus studies, you learned that a necessary condition for a point to be an unconstrained minimizer of a differentiable function is that the gradient at that point is zero.

This is the stationarity condition. It generalizes the gradient alignment idea from Lagrange multipliers.

This final part of the video puts these pieces together to state the full KKT conditions.

Deriving the KKT conditions for Inequality-Constrained Optimization | Introduction to Duality

This segment completes the derivation, showing how the two key results we just discussed (complementary slackness and stationarity) emerge.

Watch from 22:02 to 26:59. This is the core of the lesson. Follow along as the video formally derives and lists the four KKT conditions based on the strong duality assumption.

4. The Complete KKT Conditions

Let's consolidate what we've derived into a single, formal set of conditions. For a general optimization problem with both equality constraints and inequality constraints , if is a local optimum and a "constraint qualification" (a regularity condition) holds, then there must exist multipliers and such that the following four conditions are satisfied:

  1. Stationarity:
  2. Primal Feasibility:

  3. Dual Feasibility:

    (Note that the Lagrange multipliers for the equality constraints are unrestricted in sign).
  4. Complementary Slackness:
Karush-Kuhn-Tucker Conditions Document Page
A summary of the Karush-Kuhn-Tucker (KKT) conditions. These four conditions (Stationarity, Primal Feasibility, Dual Feasibility, and Complementary Slackness) are the necessary requirements for a point to be an optimal solution in a constrained nonlinear optimization problem.
Test your understanding!

Suppose you solve an optimization problem and find that for a particular inequality constraint , the optimal solution yields . What can you immediately conclude about its corresponding KKT multiplier ? Why?

Show answer

You can immediately conclude that . This is a direct consequence of the complementary slackness condition, . Since , the multiplier must be zero to satisfy the condition. This makes intuitive sense: the constraint is inactive (not on the boundary), so it does not contribute to the gradient sum in the stationarity condition.

For a formal, consolidated statement of the theorem guaranteeing these conditions, the following resource is excellent.

Lecture 16. Karush-Kuhn-Tucker Conditions

This document provides a formal, academic statement of the KKT conditions and the theorem that guarantees their necessity.

Please read section 16.2. Focus on the main theorem box titled 'Theorem (Karush-Kuhn-Tucker conditions)'. This section formally lists the four conditions we have derived in a rigorous mathematical context.

Given your interest in rigorous proofs, you might also appreciate an alternative method for proving the non-negativity of the multipliers (), which uses proof by contradiction.

Lecture 16. Karush-Kuhn-Tucker Conditions

The derivation from duality is elegant. For a different and more classical approach, this resource provides a rigorous proof by contradiction for why the inequality multipliers must be non-negative. This is a great example of the level of mathematical argument common in optimization theory.

In section 16.3, focus on the subsection titled 'Proof of \mu_j^* \ge 0 for all j \in J(x^*)'. You don't need to memorize every step, but try to follow the logical structure: assume a multiplier is negative, and show how this allows you to find a better feasible point, which contradicts the assumption that you were at an optimum.

5. A Note on Constraint Qualifications

We have mentioned that the KKT conditions are necessary for an optimum, provided the problem is "well-behaved." This regularity is formally captured by constraint qualifications. These are mathematical conditions on the constraint functions that prevent pathological cases where the geometry of the feasible set boundary is degenerate.

For instance, if the gradients of the active constraints are not linearly independent (a condition called LICQ), the KKT conditions might fail to hold at a valid minimum. For the important class of convex optimization problems, a much simpler condition known as Slater's condition is often sufficient. It essentially requires that there exists at least one point that is strictly feasible.

You do not need to master these qualifications now, but it is important to know that they are a required assumption for the KKT theorem to hold.

Conclusion

Today, we successfully navigated one of the central derivations in optimization theory. Starting from the min-max formulation of an inequality-constrained problem, we used the powerful concept of duality to derive the complete set of Karush-Kuhn-Tucker (KKT) conditions.

Key Takeaways:

  • The concepts of primal and dual problems and the assumption of strong duality () are the foundation for the derivation.
  • By equating the primal and dual optimal values, we force a chain of inequalities to hold with equality, which in turn yields two of the main KKT conditions: stationarity and complementary slackness.
  • The complete KKT conditions consist of four parts: Stationarity, Primal Feasibility, Dual Feasibility, and Complementary Slackness.
  • These conditions are necessary for a point to be a local optimum, provided a constraint qualification holds.

Preview of the Next Lesson:
We have now concluded our intensive study of calculus-based optimization theory. We have built a strong foundation, moving from gradients and Hessians to Lagrange multipliers and now the KKT conditions. This completes the fifth module of our course. In our next lesson, we will pivot to a new and equally fundamental area of mathematics for machine learning: Probability Theory. We will start from the ground up, defining probability spaces, sample spaces, and the axioms that govern the entire field.

Can't find a good explanation? Sign up and we'll make it for you

Sign up