Convex optimization studies problems whose objective and feasible set are both convex (
f(θx1+(1−θ)x2)≤θf(x1)+(1−θ)f(x2) for all
θ∈[0,1], so any local optimum is global). A constrained problem
minxf(x) s.t.
hi(x)=0, gj(x)≤0 is converted to unconstrained form via the Lagrangian
L(x,λ,μ)=f(x)+∑iλihi(x)+∑jμjgj(x), where inequality multipliers must satisfy
μj≥0 (dual feasibility) so that violations are penalized rather than rewarded. The KKT conditions — necessary, and sufficient under convexity + Slater's condition — are: ① stationarity
∇xL=∇f+∑iλi∇hi+∑jμj∇gj=0; ② primal feasibility
hi(x)=0, gj(x)≤0; ③ dual feasibility
μj≥0; ④ complementary slackness
μjgj(x)=0. Intuition: an inactive constraint (
gj<0, solution strictly inside the feasible set) forces
μj=0, while
μj>0 means the constraint is active (
gj=0) and pins the solution to the boundary.