# Why do we need Complementary Slackness Condition for Karush-Kuhn-Tucker Conditions

Complementary slackness condition (CSC) state that $$\lambda_j[g_j(x) − c_j] = 0 \hspace{5pt} \text{for} \hspace{5pt} j = 1, ..., m.$$ Therefore, every constraint either needs to be an equality constraint ($$\lambda_j=0$$) or we need to have an active constraint ($$g_j(x) − c_j = 0$$). What if we have a passive constraint? Why would that prevent us from finding the optimum point? In that case, couldn't we just ignore that constraint and find the optimum without it because it doesn't affect our optimal point? If yes, wouldn't that make CSC irrelevant?

• Why should $\lambda_j=0$ correspond to an "equality constraint"? Jan 30 at 21:07
• So if $\lambda_j=0$, then we can say that the constraint $j$ has no effect on the quantity optimized, correct? In that case, constraint $j$ would be a passive constraint, correct? Still, then CSC simply means that 'constraint must be passive or active' which makes no difference. What is the case where CSC wouldn't be satisfied then? Feel free to write it as an answer, I will mark it as a solution.
– cc88
Jan 30 at 21:46
• Hi: I vaguely remember there being a theorem which says that optimality has to occur at an extreme point. Extreme points I think are defined as points where the constraints are active. This would explain why you need complementary slackness. Jan 31 at 3:01
• The matter is that you don't know in advance if a constraint (in a feasible point) is active or not. If you know in advance that a constraint is not binding, you could ignore it. Jan 31 at 14:23
• What do you mean by a "passive" constraint? A non-binding one? Or something else? Feb 2 at 2:14

Solving a non-linear programming (with inequality constraints) is about trial and error. You don't know a priori if a constraint is active. You consider all the possible cases satisfying your constraints and see if they optimize your objective function (maximize the utility function, for instance) .

Also $$\lambda_j =0$$ is not an equality constraint, it is just the multiplier attached to your constraint. You have a single distinct multiplier per each constraint.$$\lambda_j =0$$ if your constraint is NOT active. On the other hand, $$\lambda_j >0$$ if your constraint is active

The simplest example you can consider is:

Say you want to max. $$U=xy$$ , $$s.t.$$

$$i)x+y\le 100$$

$$ii) x,y \ge0$$

You build up the Lagrangian:

$$L(x,y,\lambda)=xy+ \lambda(100-x-y)$$

KT conditions:

i) $$\frac{\partial L}{\partial x}=y-\lambda \le 0$$ ; $$x\ge 0$$

Note that one between the partial derivative and $$x$$ must be zero. This is called complementary slackness and can be summarized as $$x \frac{\partial L}{\partial x}=0$$

ii) $$\frac{\partial L}{\partial y}=x-\lambda \le 0$$ ; $$y\ge 0$$,

which can be summarized as $$y \frac{\partial L}{\partial y}=0$$

iii) $$\frac{\partial L}{\partial \lambda}=100-x-y \ge 0$$ ; $$\lambda \ge 0$$,

which can be summerized as $$\lambda \frac{\partial L}{\partial \lambda}=0$$, and this is exactly the CSC you wrote in your question.

As I said, you don't know a priori which constraint is binding. You must consider all the possible cases satisfying your constraint and see if these maximize the utility function. In our example, it does not make sense to assume that $$x$$ or $$y$$ are zero, because o.w. $$U(x,y)=0$$. It does make sense to assume that $$\frac{\partial L}{\partial x}=\frac{\partial L}{\partial y}=0$$, from complementary slackness. Thus, since $$\frac{\partial L}{\partial x}=\frac{\partial L}{\partial y}$$, then, you get $$y -\lambda = x - \lambda$$, which means $$x=y$$, and since your wealth is $$100$$, you realize that $$x=y=50$$

• +1 Good example to illustrate KKT and CS conditions. However I suggest that your reference to "assumptions" could be misleading. It would be more accurate to say that you consider the possible cases identified via the conditions and choose the case which yields the highest value of $U$? For example the condition $x \frac{\partial L}{\partial x}=0$ leads to the possible case $x=0$ but you reject that case because it implies $U=0$. Feb 1 at 20:31
• Thanks for the advice, you are right !
– Tony
Feb 1 at 22:02
• +1 I get the logic, but why "one between the partial derivative and x must be zero"? Also, in iii) did you mean $\frac{\partial L}{\partial \lambda}=100-x-y \leq 0$
– cc88
Feb 2 at 2:09
• Because you are maximising the lagrangian function. A necessary condition to find an optimum is that its first derivative must yield zero. If this corresponds to an interior point, then $x>0$. You could also find a situation where the first derivative is zero at the boundary, where $x=0$. Finally, it might be that the first derivative yields zero for negative values of $x$. You rule out this situation and pick a point where the first derivative is negative but $x$ is zero. About point iii), I restated that $x$ plus $y$ can’t exceed total wealth(in the example prices are 1)
– Tony
Feb 2 at 9:01

Opportunity given, there can be cases where we have both $$\lambda_j=0$$ and $$g_j(x^*) = c_j$$. This happens when the unconstrained optimum $$x^*_u$$ equals the constrained one. In such a case, while the constraint is satisfied with equality at the optimum, it is not really binding, in the sense that it does not affect the solution.

• Why wouldn't we be able to have $\lambda > 0$ and $g_j(x) > 0$? Why would that be a problem?
– cc88
Feb 2 at 2:56
• @cc88 Assume, towards a contradiction, that $x^*$ is the optimal value and that $\lambda^*_j >0$ and $g_j(x^*) > c_j$. This $x^*$ maximizes the Lagrangian. Does it maximize the objective function? Feb 3 at 1:37