347. KKT Conditions

Conditions that a solution must satisfy in order to be optimal for a nonlinear optimization problem

Conditions are necessary for optimality, and sufficient if:

347.1. Setup

min𝑥∈ℝ𝑛𝑓(𝑥)𝑠.𝑡.𝑔𝑖(𝑥)≤0∀𝑖=1,…,𝑚ℎ𝑗(𝑥)=0∀𝑗=1,…,𝑝

347.2. KKT Multipliers

We introduce:

The Lagrangian is:

ℒ︀(𝑥,𝜆,𝜇)=𝑓(𝑥)+∑𝑖=1𝑚𝜆𝑖𝑔𝑖(𝑥)+∑𝑗=1𝑝𝜇𝑗ℎ𝑗(𝑥)

For 𝑛 variables and 𝑚 constrains:

347.3. KKT Conditions

At local optimum 𝑥∗ there exists multipliers (𝜆∗,𝜇∗) such that:

  1. Stationarity

Minimization:

∇𝑓(𝑥∗)+∑𝑖=1𝑚𝜆𝑖∗∇𝑔𝑖(𝑥∗)+∑𝑗=1𝑝𝜇𝑗∗∇ℎ𝑗(𝑥∗)=0

Stationarity is like a generalized version of “set the derivative to zero”, but accounting for the constraints

  1. Primal feasibility
𝑔𝑖(𝑥∗)≤0ℎ𝑗(𝑥∗)=0

The solution must satisfy all the original constraints — it must lie inside the feasible region

  1. Dual Feasibility
𝜆𝑖≥0∀𝑖
  1. Complementary Slackness
𝜆𝑖𝑔𝑖(𝑥∗)=0∀𝑖

Complementary slackness only applies to inequalities

Inactive (non-binding) constraint

𝑔𝑖(𝑥∗)<0⇒𝜆𝑖∗=0

Active (binding) constraint

𝑔𝑖(𝑥∗)=0⇒𝜆𝑖∗≥0
Example
min𝑥12+𝑥22𝑠.𝑡.𝑥122−𝑥2≤2

Step 1. Standardize constraints

Constraints already in the form 𝑔(𝑥)≤0 for minimization

Sign convention 𝜆≥0

Step 2. Formulate Lagrangian

ℒ︀(𝑥1,𝑥2,𝜆)=𝑥12+𝑥22+𝜆(𝑥122−𝑥2−2)

Step 3. Stationarity

∇𝑥ℒ︀=[𝜕ℒ︀𝜕𝑥1𝜕ℒ︀𝜕𝑥2]=[2𝑥1+𝜆𝑥12𝑥2−𝜆]=0

Solve for 𝑥1:

2𝑥1+𝜆𝑥1=0𝑥1(2+𝜆)=0𝑥1(2+𝜆)=02+𝜆𝑥1=0

Solve for 𝑥2

2𝑥2−𝜆=0𝑥2=𝜆2

Candidate point:

(𝑥1,𝑥2)=(0,𝜆2)

Step 4. Primal Feasibility

Constraint:

𝑔(𝑥1,𝑥2)=𝑥122−𝑥2−2≤0

Substitute 𝑥1=0 and 𝑥2=𝜆2

022−𝜆2−2≤0−𝜆2−2≤0−𝜆2≤2𝜆≥−4

Step 5. Dual Feasibility

𝜆≥0

Step 6. Complementary Slackness

Constraint:

𝑔(𝑥1,𝑥2)=𝑥122−𝑥2−2≤0

Condition:

𝜆⋅𝑔(𝑥∗)=0

Candidate point:

(𝑥1,𝑥2)=(0,𝜆2)

Evaluate 𝑔(𝑥∗):

𝜆⋅𝑔(𝑥∗)=𝜆(𝑥122−𝑥2−2)=0

Substitute 𝑥1=0 and 𝑥2=𝜆2

𝜆(022−𝜆2−2)=0𝜆(−𝜆2−2)=0

Solve:

𝜆(−𝜆2−2)=0⇒𝜆=0or𝜆=−4

But because of Dual Feasibility 𝜆≥0, so 𝜆=0

Constraint is non-binding at optimum:

  • 𝜆=0

  • 𝑔(𝑥∗)<0

𝑔(𝑥∗)=𝑥122−𝑥2−2≤0022−𝜆2−2≤0022−02−2≤0−2≤0

Step 7. Solve for Optimum

(𝑥1,𝑥2)=(0,𝜆2)=(0,02)=(0,0)

Step 8. Check Convexity

Example
min𝑥12+𝑥22𝑠.𝑡.𝑥122−𝑥2≤−1

Step 1. Standardize constraints

Constraints already in the form 𝑔(𝑥)≤0 for minimization

Sign convention 𝜆≥0

Step 2. Formulate Lagrangian

ℒ︀(𝑥1,𝑥2,𝜆)=𝑥12+𝑥22+𝜆(𝑥122−𝑥2+1)

Step 3. Stationarity

∇𝑥ℒ︀=[𝜕ℒ︀𝜕𝑥1𝜕ℒ︀𝜕𝑥2]=[2𝑥1+𝜆𝑥12𝑥2−𝜆]

Solve for 𝑥1:

2𝑥1+𝜆𝑥1=0𝑥1(2+𝜆)=0𝑥1=02+𝜆𝑥1=0

Solve for 𝑥2:

2𝑥2−𝜆=02𝑥2=𝜆𝑥2=𝜆2

Candidate point:

(𝑥1,𝑥2)=(0,𝜆2)

Step 4. Primal Feasibility

Constraint:

𝑔(𝑥1,𝑥2)=𝑥122−𝑥2+1≤0

Substitute 𝑥1=0 and 𝑥2=𝜆2:

𝑥122−𝑥2+1≤0022−𝜆2+1≤0−𝜆2+1≤0−𝜆2≤−1𝜆≥2

Step 5. Dual Feasibility

𝜆≥0

Step 6. Complementary Slackness

Constraint:

𝑔(𝑥1,𝑥2)=𝑥122−𝑥2+1≤0

Condition:

𝜆⋅𝑔(𝑥∗)=0

Candidate point:

(𝑥1,𝑥2)=(0,𝜆2)

Evaluate 𝑔(𝑥∗):

𝜆⋅𝑔(𝑥∗)=𝜆(𝑥122−𝑥2+1)=0

Substitute 𝑥1=0 and 𝑥2=𝜆2

𝜆(022−𝜆2+1)=0𝜆(−𝜆2+1)=0

Solve:

𝜆(−𝜆2+1)=0⇒𝜆=0or𝜆=2

But because of Primal Feasibility, if 𝜆=0, (𝑥1,𝑥2)=(0,0) and 𝑔(0,0)=1≰0, thus 𝜆=2

Constraint is binding at optimum:

  • 𝜆=2

  • 𝑔(𝑥∗)=0

𝑔(𝑥∗)=𝑥122−𝑥2+1=0022−𝜆2+1=0022−22+1=00=0

Step 7. Solve for Optimum

(𝑥1,𝑥2)=(0,𝜆2)=(0,22)=(0,1)

Step 8. Check Convexity

347.4. Calculating Lagrangian Multipliers

To find the multipliers (𝜆∗,𝜇∗) and the optimal point 𝑥∗, solve the KKT system of equations:

{∇𝑥ℒ︀(𝑥,𝜆,𝜇)=0𝑔𝑖(𝑥)≤0∀𝑖=1,…,𝑚ℎ𝑗(𝑥)=0∀𝑖=1,…,𝑝𝜆𝑖≥0∀𝑖=1,…,𝑚𝜆𝑖𝑔𝑖(𝑥)=0∀𝑖=1,…,𝑚
Example

Retailer Maximizing Profit under a Capacity Constraint

A retailer sells product 1 and 2 with quantities 𝑞1 and 𝑞2. For product 𝑖 the market-clearing prices are:

𝑝𝑖=𝑎𝑖−𝑏𝑖𝑞𝑖𝑖=1,2

Where 𝑎𝑖,𝑏𝑖>0.

The retailer maximizes total profit subject to a capacity constraint:

𝑞1+𝑞2≤𝐾𝑞1,𝑞2≥0
  1. Formulation
max𝑞1,𝑞2≥0𝑞1(𝑎1−𝑏1𝑞1)⏞𝑝1+𝑞2(𝑎2−𝑏2𝑞2)⏞𝑝2𝑠.𝑡.𝑞1+𝑞2≤𝐾

The objective is concave because

−∇2𝑓(𝑞1,𝑞2)=[2𝑏1002𝑏2]

is positive semi-definite.

The unconstrained FOC solution is:

𝑞1=𝑎12𝑏1,𝑞2=𝑎22𝑏2

If 𝑞1+𝑞2≤𝐾, this solution is feasible.

  1. Lagrangian

Introduce KKT multiplier 𝜆≥0 for the inequality constraint:

ℒ︀(𝑞1,𝑞2,𝜆)=𝑞1(𝑎1−𝑏1𝑞1)+𝑞2(𝑎2−𝑏2𝑞2)⏞𝑓+𝜆(𝐾−𝑞1−𝑞2)⏞𝑏−𝑔
  1. KKT Conditions

1. Stationarity

𝜕𝜕𝑞1ℒ︀=𝑎1−2𝑏1𝑞1−𝜆=0𝜕𝜕𝑞2ℒ︀=𝑎2−2𝑏2𝑞2−𝜆=0

2. Primal Feasibility

𝑞1+𝑞2≤𝐾𝑞1,𝑞2≥0

3. Dual Feasibility

𝜆≥0

4. Complementary Slackness

𝜆(𝐾−𝑞1−𝑞2)=0
  1. Solving KKT system

Case 1: Unconstrained (𝜆=0)

max𝑞1,𝑞2≥0𝑓(𝑞1,𝑞2)=𝑞1(𝑎1−𝑏1𝑞1)+𝑞2(𝑎2−𝑏2𝑞2)𝑓(𝑞1,𝑞2)=𝑎1𝑞1−𝑏1𝑞12+𝑎2𝑞2−𝑏2𝑞22

First-Order Condition

𝜕𝑓𝜕𝑞1=𝑎1−2𝑏1𝑞1𝜕𝑓𝜕𝑞2=𝑎2−2𝑏2𝑞2

Set derivatives to 0 (stationarity)

𝑎1−2𝑏1𝑞1=0⇒𝑞1∗=𝑎12𝑏1𝑎2−2𝑏2𝑞2=0⇒𝑞2∗=𝑎22𝑏2

Unconstrained Solution:

𝑞1∗=𝑎12𝑏1𝑞2∗=𝑎22𝑏2

The second derivative check confirms it’s a maximum because:

𝜕2𝑓𝜕𝑞12=−2𝑏1<0𝜕2𝑓𝜕𝑞22=−2𝑏2<0

Feasible if

𝑎12𝑏1+𝑎22𝑏2≤𝐾

Case 2: Binding Constraint (𝜆>0)

We now include the capacity constraint:

𝑞1+𝑞2=𝐾

If it binds (active) then

𝑞1+𝑞2=𝐾

Lagrangian

ℒ︀(𝑞1,𝑞2,𝜆)=𝑞1(𝑎1−𝑏1𝑞1)+𝑞2(𝑎2−𝑏2𝑞2)⏞𝑓(𝑞1,𝑞2)+𝜆(𝐾−𝑞1−𝑞2)⏞𝑏−𝑔(𝑞1,𝑞2)

First-Order Condition

𝜕ℒ︀𝜕𝑞1=𝑎1−2𝑏1𝑞1−𝜆𝜕ℒ︀𝜕𝑞2=𝑎2−2𝑏2𝑞2−𝜆𝜕ℒ︀𝜕𝜆=𝐾−𝑞1−𝑞2

Set derivatives to 0 (stationarity)

𝑎1−2𝑏1𝑞1−𝜆=0𝑎2−2𝑏2𝑞2−𝜆=0𝐾−𝑞1−𝑞2=0

When we take the derivative of the Lagrangian with respect to the multiplier 𝜆 we recover the constraint itself.

Solve system of equations

{𝑎1−2𝑏1𝑞1−𝜆=0𝑎2−2𝑏2𝑞2−𝜆=0𝑞1+𝑞2=𝐾

Solution:

𝑞1=2𝑏2𝐾+𝑎1−𝑎22(𝑏1+𝑏2)𝑞2=2𝑏1𝐾+𝑎2−𝑎12(𝑏1+𝑏2)

Feasible if

𝑎12𝑏1+𝑎22𝑏2>𝐾
  1. Optimal Solution
(𝑞1∗,𝑞2∗)={(𝑎12𝑏1,𝑎22𝑏2)if𝑎12𝑏1+𝑎22𝑏2≤𝐾(2𝑏2𝐾+𝑎1−𝑎22(𝑏1+𝑏2),2𝑏1𝐾+𝑎2−𝑎12(𝑏1+𝑏2))otherwise

Intuition:

  • If capacity 𝐾 is large enough, the retailer produces unconstrained quantities.
  • If 𝐾 is tight, the total production hits the limit, and the optimal quantities are shared according to the relative parameters 𝑎𝑖,𝑏𝑖
Example
max𝑓(𝑥)=𝑥1−𝑥2𝑠.𝑡.𝑔1(𝑥)=𝑥12+𝑥22≤4𝑔2(𝑥)=−𝑥12−(𝑥2+2)2≤−4

This NLP is nonconvex

1️⃣ Lagrangian

Introduce multipliers 𝜆1,𝜆2≥0 for the inequalities. The Lagrangian is

ℒ︀(𝑥1,𝑥2,𝜆)=𝑥1−𝑥2⏞𝑓+𝜆1(4−𝑥12−𝑥22)⏞𝑔1+𝜆2(−4+𝑥12+(𝑥2+2)2)⏞𝑔2

The solution 𝑥̄ is a local maximum only if there exists 𝜆 such that

2️⃣ KKT Conditions

  1. Primal feasibility
𝑥12+𝑥22≤4(PF-1)−𝑥12−(𝑥2+2)2≤−4(PF-2)
  1. Dual Feasibility
𝜆1≥0(DFS-1)𝜆2≥0(DFS-2)
  1. Stationarity
𝜕ℒ︀𝜕𝑥1=1−2(𝜆1−𝜆2)𝑥1=0(DFF-1)𝜕ℒ︀𝜕𝑥2=−1−2(𝜆1−𝜆2)𝑥2+4𝜆2=0(DFF-2)
  1. Complimentary Slackness
𝜆1(4−𝑥12−𝑥22)=0(CS-1)𝜆2(−4+𝑥12+(𝑥2+2)2)=0(CS-2)

3️⃣ Examine all 4 cases for (𝜆1,𝜆2)

Case 1. (𝜆1>0,𝜆2>0)

Step 1: Complementary Slackness

Since both multipliers are positive, the corresponding constraints must be active:

𝑥12+𝑥22=4(CS-1)𝑥12+(𝑥2+2)2=4(CS-2)

Solve this system → two candidate points:

(𝑥1,𝑥2)=(3,−1)and(−3,−1)

Step 2: Primal Feasibility

  1. For (3,−1)
𝑥12+𝑥22=32+(−1)2≤4(PF-1)−𝑥12−(𝑥2+2)2=−(3)2−(−1+2)2≤−4(PF-2)
  1. For (−3,−1)
𝑥12+𝑥22=(−3)2+(−1)2≤4(PF-1)−𝑥12−(𝑥2+2)2=−(−3)2−(−1+2)2≤−4(PF-2)

✅ Both satisfy primal feasibility.

Step 3: Stationarity / First-order conditions (DFF)

Plug each candidate point into the gradient equations and solve the system:

1−2(𝜆1−𝜆2)𝑥1=0(DFF-1)−1−2(𝜆1−𝜆2)𝑥2+4𝜆2=0(DFF-2)

For (3,−1):

1−2(𝜆1−𝜆2)(3)=0−1−2(𝜆1−𝜆2)(−1)+4𝜆2=0

Solving the system we get:

𝜆1=14+143𝜆2=14−143

✅ Both 𝜆1,𝜆2≥0 → dual feasibility satisfied.

For (−3,−1):

1−2(𝜆1−𝜆2)(−3)=0⟹𝜆1−𝜆2=−123−1−2(𝜆1−𝜆2)(−1)+4𝜆2=0⟹𝜆2=14+143

Solving the system we get:

𝜆1=14−143𝜆2=14+143

✅ Both 𝜆1,𝜆2≥0 → dual feasibility satisfied.

✅ Both (3,−1) and (−3,−1) satisfy dual feasibility → both are KKT points.

Case 2. (𝜆1>0,𝜆2=0)

Step 1. Assumptions (Activity / Inactivity)

  • Constraint 1: Active (𝑥12+𝑥22=4)

  • Constraint 2: Inactive (𝑥12+(𝑥2+2)2=4)

Step 2. Stationarity Condition

The Lagragian:

ℒ︀(𝑥1,𝑥2,𝜆1,𝜆2)=(𝑥1−𝑥2)+𝜆1(4−𝑥12−𝑥22)+𝜆2(−4+𝑥12+(𝑥2+2)2)

Compute the gradients with respect to 𝑥1 and 𝑥2:

{𝜕ℒ︀𝜕𝑥1=1−2𝜆1𝑥1+2𝜆2𝑥1=0𝜕ℒ︀𝜕𝑥2=−1−2𝜆1𝑥2+2𝜆2(𝑥2+2)=0

Since 𝜆2=0, the equations simplify to:

{1−2𝜆1𝑥1=0−1−2𝜆1𝑥2=0

Simplify:

{𝑥1=12𝜆1𝑥2=−12𝜆1⇒𝑥1=−𝑥2

Step 3. Substitute into Active Constraint

Using 𝑥12+𝑥22=4 and 𝑥2=−𝑥1:

𝑥12+(−𝑥1)2=2𝑥12=4⇒𝑥12=2⇒𝑥1=±2,𝑥2=∓2

Two candidate solutions 𝑥1 and 𝑥2:

(−2,2)and(2,−2)

Step 4. Solve for 𝜆1 and enforce 𝜆1>0

1+2𝜆1𝑥1=0⇒𝜆1=−12𝑥1

Substitute (𝑥1,𝑥2) into the stationarity condition:

1+2𝜆1𝑥1
  • For (𝑥1,𝑥2)=(2,−2):
𝜆1=122>0→✅Valid(𝜆1≥0)
  • For (𝑥1,𝑥2)=(−2,2):
𝜆1=12(−2)>0→❌Reject(violates𝜆1≥0)

So, the surviving candidate is:

(𝑥1,𝑥2)=(2,−2),𝜆1=122,𝜆2=0

Step 5. Check the (inactive) constraint 2 for primal feasibility

Constraint 2:

𝑔2(𝑥)=−𝑥12−(𝑥2+2)2+4≤0

Plug 𝑥1=2 and 𝑥2=−2:

𝑔2(𝑥)=−(2)2−(−2+2)2+4>0

❌ This violates the inequality 𝑔2(𝑥)≤0

❌ (𝑥1,𝑥2)=(2,−2) is rejected because it violates the inequality 𝑔2(𝑥)≤0

❌ (𝑥1,𝑥2)=(−2,2) is rejected because it gives 𝜆<0

Case 3. (𝜆1=0,𝜆2>0)

Step 1. Assumptions (Activity / Inactivity)

  • Constraint 1: Inactive (𝑥12+𝑥22=4)

  • Constraint 2: Active (𝑥12+(𝑥2+2)2=4)

Step 2. Stationarity Condition

The Lagragian:

ℒ︀(𝑥1,𝑥2,𝜆1,𝜆2)=(𝑥1−𝑥2)+𝜆1(4−𝑥12−𝑥22)+𝜆2(−4+𝑥12+(𝑥2+2)2)

Compute the gradients with respect to 𝑥1 and 𝑥2:

{𝜕ℒ︀𝜕𝑥1=1−2𝜆1𝑥1+2𝜆2𝑥1=0𝜕ℒ︀𝜕𝑥2=−1−2𝜆1𝑥2+2𝜆2(𝑥2+2)=0

Since 𝜆1=0, the equations simplify to:

{1+2𝜆2𝑥1=0−1+2𝜆2(𝑥2+2)=0

Simplify:

{𝑥1=−12𝜆2𝑥2=12𝜆2−2⇒𝑥1=−𝑥2

Step 3. Substitute into Active Constraint

𝑥12+(𝑥2+2)2=4

Substituting 𝑥1 and 𝑥2:

(−12𝜆2)2+(12𝜆2−2+2)2=4⇒𝜆2=±122

Two candidate solutions 𝑥1 and 𝑥2:

(−2,2−2)and(2,−2−2)

Substitute (𝑥1,𝑥2) into the stationarity condition:

−1+2𝜆2(𝑥2+2)
  • For (𝑥1,𝑥2)=(2,−2−2):
𝜆2=−122<0→❌Reject(violates𝜆1≥0)
  • For (𝑥1,𝑥2)=(−2,2−2):
𝜆2=122>0→✅Valid(𝜆1≥0)

So, the surviving candidate is:

(𝑥1,𝑥2)=(−2,2−2),𝜆1=0,𝜆2=122

Step 5. Check the (inactive) constraint 1 for primal feasibility

Constraint 1:

𝑔1(𝑥)=𝑥12+𝑥22≤4

Plug 𝑥1=−2 and 𝑥2=2−2:

𝑔1(𝑥)=−(2)2−(2−2)2+4≤0

✅ Satisfies primal feasibility. Constraint 1 is inactive (strict inequality), as required.

✅ (𝑥1,𝑥2)=(−2,2−2) is a valid KKT point under this assumption.

❌ (𝑥1,𝑥2)=(2,−2−2) is rejected because it gives 𝜆<0

Case 4. (𝜆1=0,𝜆2=0)

Step 1. Assumptions (Activity / Inactivity)

  • Both multipliers are zero: 𝜆1=0,𝜆2=0
  • No constraints are forced to be active by complementary slackness

Step 2. Stationarity Condition

With 𝜆1=0 and 𝜆2=0, the stationarity equations simplify to:

{1−2(𝜆1−𝜆2)𝑥1=1=0−1−2(𝜆1−𝜆2)𝑥2+4𝜆2=−1=0

Step 3. Stationary Check

Both equations 1=0 and −1=0 are impossible

No solution exists under this assumption

❌ No KKT points exist

4️⃣ Summary

  • 𝜆1>0 and 𝜆2>0:

    • (3,−1)
    • (−3,1)
  • 𝜆1=0 and 𝜆2>0:

    • (−2,2−2)

These are the only candidates for local maxima (and thus global maxima)

Necessary, but not sufficient for non-convex NLPs

347.5. Sensitivity Analysis and Shadow Prices

Lagrange multipliers measure how senitive the objective function is to changes in the constraints

347.5.1. Shadow Prices

The shadow price of a constraint is the value of the corresponding Lagrange multiplier at the optimal solution:

ShadowPrice𝑖=𝜆𝑖∗

It measures how much the objective function would improve if the constraint were relaxed by one unit. For example:

𝑥1+𝑥2≤12→𝑥1+𝑥2≤13

The corresponding shadow price tells us the change in the optimal objective due to this relaxation. The magnitude of the Lagrange multiplier reflects the influence of its associated constraint on the optimal solution.

Constraint StatusShadow Price (𝜆∗)Impact on Objective
Binding / Active𝑔𝑖(𝑥∗)=0𝜆∗>0Relaxing improves objective
Inactive / Slack𝑔𝑖(𝑥∗)<0𝜆∗=0Relaxing has no effect
Example

Primal NLP

𝑧∗=max𝑥∈ℝ𝑛{𝑓(𝑥)|𝑔𝑖(𝑥)≤𝑏𝑖∀𝑖=1,…,𝑚}

Lagrange Dual Program

𝑤∗=min𝜆≥0𝑧𝐿(𝜆)=min𝜆≥0{max𝑥∈ℝ𝑛𝑓(𝑥)+∑𝑖=1𝑚𝜆𝑖[𝑏𝑖−𝑔𝑖(𝑥)]}

Convexity

The Lagrange Dual Program function 𝑧𝐿(𝜆) is always convex over 𝜆∈[0,∞)𝑛

Weak Duality

𝑤∗≥𝑧∗∀𝜆≥0

Strong Duality

𝑤∗=𝑧∗ is the primal NLP is a “regular” convex program

Example
𝑧∗=max𝑥1+𝑥2𝑠.𝑡.𝑥12+𝑥22≤8𝑥2≤6

Optimal solution

𝑥∗=(2,2)𝑧∗=4

Lagragian relaxation

𝑤∗=min𝜆1≥0,𝜆2≥0𝑧𝐿(𝜆)=min𝜆1≥0,𝜆2≥0max𝑥∈ℝ2ℒ︀(𝑥|𝜆)

Where

ℒ︀(𝑥|𝜆)=𝑥1+𝑥2+𝜆1(8−𝑥12+𝑥22)+𝜆2(6−𝑥2)

To solve the Lagrange dual program:

max𝑥∈ℝ2ℒ︀(𝑥|𝜆)max𝑥∈ℝ2{𝑥1+𝑥2+𝜆1(8−𝑥12−𝑥22)+𝜆2(6−𝑥2)}

First-order condition:

𝑥1=12𝜆1and𝑥2=1−𝜆22𝜆1

Plugging into ℒ︀(𝑥|𝜆):

𝑧𝐿(𝜆)=max𝑥∈ℝ2ℒ︀(𝑥|𝜆)=1+(1−𝜆2)24𝜆1+8𝜆1+6𝜆2

The Lagrangian dual program is to look for 𝜆1≥0 and 𝜆2≥0 to minimize 𝑧𝐿(𝜆)

The Lagrange dual program:

min𝜆1≥0,𝜆2≥01+(1−𝜆2)24𝜆1+8𝜆1+6𝜆2

𝑧𝐿(𝜆) is convex over (0,∞)2:

∇𝑧𝐿(𝜆)=[−1+(1−𝜆2)24𝜆12+8−1−𝜆22𝜆1+6],∇2𝑧𝐿(𝜆)=[1+(1−𝜆2)22𝜆121−𝜆22𝜆121−𝜆22𝜆1212𝜆1]

Since:

1+(1−𝜆2)22𝜆12>0 and det(∇2𝑧𝐿(𝜆))=12𝜆1>0, 𝑧𝐿(𝜆) is convex

To solve

min𝜆1≥0,𝜆2≥01+(1−𝜆2)24𝜆1+8𝜆1+6𝜆2

Apply KKT conditions

𝜆1 cannot be binding (𝜆1=0), because division by 0, so ignore it

Let 𝜇≥0 be the Lagrange multiplier for 𝜆2≥0, the Lagrange is

1+(1−𝜆2)24𝜆1+8𝜆1+6𝜆2−𝜇𝜆2

The KKT condition requires an optional solution to satisfy (FOC)

−1+(1−𝜆2)24𝜆12+8=0,−1−𝜆22𝜆1+6−𝜇=0,𝜇𝜆=0
  • Suppose 𝜇>0

    • Implies 𝜆2=0

    • −1+(1−𝜆2)24𝜆12+8=0 requires 𝜆1=14

    • −1−𝜆22𝜆1+6−𝜇=0 requires 𝜇=4, which is feasible

  • Suppose 𝜇=0

    • −1+(1−𝜆2)24𝜆12+8=0 requires 𝜆2=1−12𝜆1

    • Plugging into −1+(1−𝜆2)24𝜆12+8=0 results on 1+112𝜆12 which is impossible

  • The only KKT point is (𝜆1,𝜆2)=(14,0)

  • Plugging into 𝑧𝐿(𝜆) gives us 𝑤∗=4 which exactly equals 𝑧∗

So strong duality holds, 𝑤∗=𝑧∗

347.6. Lagrange Duality and LP Duality

LP duality is a special case of Lagrange Duality

For a general LP

max𝑐𝑇𝑥𝑠.𝑡.𝐴𝑥=𝑏𝑥≥0

Where 𝐴∈ℝ𝑚×𝑛 (𝑚 constraints and 𝑛 variables)

Let 𝜆∈ℝ𝑚 be the Lagrange multipliers, the Lagrange relaxation is

𝑧∗(𝜆)=max𝑥≥0𝑐𝑇𝑥+𝜆𝑇(𝑏−𝐴𝑥)=𝐴𝑇𝑏+max𝑥≥0(𝑐𝑇−𝜆𝑇𝐴)𝑥

Because of equality constraint, 𝜆 is unrestricted in sign

Lagrange dual program

min𝜆𝑧𝐿(𝜆)=min𝜆{𝜆𝑇𝑏+max𝑥≥0(𝑐𝑇−𝜆𝑇𝐴)𝑥}

Search for 𝜆 that minimizes 𝑧𝐿(𝜆)

Dual program is only meaningful if 𝑐𝑇≤𝜆𝑇𝐴, because if (𝑐𝑇)𝑖>(𝜆𝑇𝐴)𝑖 for any 𝑖, max𝑥≥0(𝑐𝑇−𝜆𝑇𝐴)𝑥 will be unbounded because we can increase 𝑥𝑖 to ∞

Thus, no choice of 𝜆 that violates 𝑐𝑇≤𝜆𝑇𝐴 may be optimal to the Lagrange dual program

The Lagrange dual program

min𝜆𝑧∗(𝜆)=min𝜆𝑖𝑐𝑇≤𝜆𝑇𝐴{𝜆𝑇𝑏+max𝑥≥0(𝑐𝑇−𝜆𝑇𝐴)𝑥}

If 𝜆 satisfies 𝑐𝑇≤𝜆𝑇𝐴 thenwe know max𝑥≥0(𝑐𝑇−𝜆𝑇𝐴)𝑥=0

The Lagrange dual program becomes

min𝜆urs𝜆𝑇𝑏𝑠.𝑡.𝜆𝑇𝐴≥𝑐𝑇

Which is exactly the dual LP of

max𝑥≥0𝑐𝑇𝑥𝑠.𝑡.𝐴𝑥=𝑏
Example
min(𝑥1−4)2+(𝑥2−2)2𝑠.𝑡.2𝑥1+𝑥2≤6
  1. What are the leading principle minors of the Hessian matrix of the objective function?
∇𝑓(𝑥1,𝑥2)=[2(𝑥1−4)2(𝑥2−2)]∇2𝑓(𝑥1,𝑥2)=[2002]

2 and 4 ✅

ℒ︀(𝑥1,𝑥2|𝜆)=(𝑥1−4)2+(𝑥2−2)2+𝜆(6−2𝑥2−2)

𝜆≤0 ✅

  1. According to the FOC of the Lagragian, what is a necessary condition for an optimal solution

Case 1. 𝜆>0

Constraint active: 2𝑥2−2≤6

FOC (gradient w.r.t. 𝑥1 and 𝑥2):

∇ℒ︀(𝑥1,𝑥2|𝜆)=[2(𝑥1−4)2(𝑥2−2)−2𝜆]2(𝑥1−4)=0𝑥1=42(𝑥2−2)−2𝜆=02𝑥2−4−2𝜆=0𝑥2=2𝜆+42𝑥2=𝜆+2𝑥1=4𝑥2=𝜆+2

Substitute into active constraint

6−2𝑥2−2=04−2𝑥2=04−2(𝜆+2)=04−2𝜆+4=02𝜆=0𝜆=0−2𝜆=0

Find 𝜆:

𝜆=0

Which violates 𝜆>0

Case 2. 𝜆=0

𝑥1=4𝑥2=𝜆+2𝑥2=0+2(𝑥1,𝑥2)=(4,2)

𝑥1−2𝑥2=0 ✅

Case 2. 𝜆=0

  1. What is a local optimal solution to the nonlinear program?

(𝑥1,𝑥2)=(125,65) ✅

For a linear program, linear programming duality and Lagrange duality is equivalent (i.e., the dual programs obtained through the two ways are identical). ✅

For an unconstrained nonlinear program, the KKT condition is equivalent to the first-order condition. ✅

For an unconstrained nonlinear program, the KKT condition is necessary and sufficient. ✅