with f,g1,…,gm:Rn→R continuously differentiable. Write g=(g1,…,gm):Rn→Rm and its Jacobian ∇g(x)=[∇g1(x)∣⋯∣∇gm(x)]∈Rn×m.
For x feasible, the active constraints are the ones on the boundary,
Ax={i:gi(x)=0}
Road to Fritz John
Let x be feasible and a local min of (P).
There is no d∈Rn that is a descent direction for f and all active gi. Otherwise, for all small enough α>0, gi(x+αd)<gi(x)=0 for i∈Ax and, by continuity, gi(x+αd)<0 for i∈/Ax, so x+αd is feasible with f(x+αd)<f(x), a contradiction.
Equivalently, there is no d with JTd<0, where the rows of JT are ∇f(x)T and ∇gi(x)T for i∈Ax.
Setting the multipliers of inactive constraints to 0, there is a nonzero (β,λ)≥0, β∈R, λ∈Rm, with β∇f(x)+∇g(x)λ=0 and λi=0 whenever gi(x)=0.
The last condition is λigi(x)=0 for all i. Since λi≥0 and gi(x)≤0, every term λigi(x)≤0, so it is equivalent to ∑iλigi(x)=λTg(x)=0 (complementary slackness, λ≥0 and g(x)≤0 are orthogonal).
Fritz John Conditions
If x is feasible and a local min of (P), there are β∈R, λ∈Rm with
β∇f(x)+∇g(x)λ=0,λTg(x)=0,[βλ]≥0, nonzero
or, β∇f(x)+∑i=1mλi∇gi(x)=0, λigi(x)=0 for all i, β,λi≥0 not all zero.
KKT Conditions
If x is feasible, a local min of (P), and satisfies the constraint qualification that {∇gi(x)}i∈Ax are linearly independent, then there is λ∈Rm with
∇f(x)+∇g(x)λ=0,λTg(x)=0,λ≥0
Proof Take (β,λ) from Fritz John. If β=0, then ∑i∈Axλi∇gi(x)=0 with the λi not all zero, a nontrivial linear combination of the active gradients giving 0, which contradicts independence. So β>0, and scaling (β,λ) by 1/β gives β=1, after which nonzero is automatic.
So under the constraint qualification, a point that is not a KKT point is not a local min.
Checking a point For a candidate x^, check feasibility and that the gradients of the active constraints are linearly independent. Inactive constraints have λi=0 by complementary slackness, so solve the linear system ∇f(x^)+∑i∈Ax^λi∇gi(x^)=0 and check λ≥0.
Sufficiency
Convex programs Let S⊆Rn be nonempty, open and convex, and f,g1,…,gm:S→R continuously differentiable and convex. If xˉ∈S is a KKT point of
minf(x)s.t.gi(x)≤0,i=1,…,m,x∈S
i.e. gi(xˉ)≤0, ∇f(xˉ)+∑iλi∇gi(xˉ)=0, λigi(xˉ)=0, λi≥0, then xˉ is a global min. No constraint qualification is needed.
Local version Let S be nonempty and open and f,gi twice continuously differentiable. If xˉ is a KKT point with ∇2f(xˉ) PD and ∇2gi(xˉ) PD for all i∈Axˉ, then xˉ is a local min.
Proof By continuity of the gi and of the eigenvalues of the Hessians, and since S is open, there is ε>0 with Nε(xˉ)⊆S such that on Nε(xˉ)
gi(x)<0 for i∈/Axˉ,
∇2gi(x) is PSD for i∈Axˉ,
∇2f(x) is PSD.
Consider
(P′)minf(x)s.t.gi(x)≤0,i∈Axˉ,x∈Nε(xˉ)
Nε(xˉ) is open and convex, and f and the active gi are convex on it, so (P′) is a convex program. xˉ is a KKT point of (P), with inactive multipliers 0, so it is a KKT point of (P′) and hence a global min of (P′). Within Nε(xˉ) the feasible sets of (P) and (P′) agree, so xˉ is a local min of (P).
Equality Constraints
With equality constraints hj(x)=0, j=1,…,ℓ, stationarity becomes
∇f(x)+i=1∑mλi∇gi(x)+j=1∑ℓμj∇hj(x)=0
with λigi(x)=0, λ≥0, and μ free in sign.
Equality constrained QP
min21xTQx+cTx+ds.t.Ax=b
with Q∈Rn×n PD, A∈Rm×n. This is always convex. With ∇f(x)=Qx+c,
Qx+c+ATμ=0,Ax=b⟺[QAAT0][xμ]=[−cb]
and the KKT matrix is invertible if A has full row rank.
KKT for Linear Programs
(LP)mincTxs.t.Ax≥b,x≥0(DP)maxbTys.t.ATy≤c,y≥0
Rewrite the constraints as g(x)≤0,
[b−Ax−x]≤0⟺[−A−I]x+[b0]≤0
so ∇f=c and ∇g=[−AT∣−I]. With multipliers λ=(y,z), x is a KKT point iff