Finding Optimal Value of State and Lagrangian Multiplier​
​Authors: Housam Binous and Ahmed Bellagi

This problem is derived by M. N. Bandyopadhyay, Control Engineering: Theory and Practice, Prentice Hall India, New Delhi, 2004, page 390.
We look for the extremum of f(
x
1
,
x
2
,
x
3
) =
2
x
1
+
2
x
2
+
2
x
3
when it lies on the intersection of the surfaces defined by:​
x
3
=
x
1
x
2
+4
and
x
1
+
x
2
+
x
3
=1
fnc1=x1^2+x2^2+x3^2
2
x1
+
2
x2
+
2
x3
eqn1=x1x2+4-x3
4+x1x2-x3
eqn2=x1+x2+x3-1
-1+x1+x2+x3
The Lagrangian is L(
x
1
,
x
2
,
x
3
,
λ
1
,
λ
2
)
L[x1_,x2_,x3_,λ1_,λ2_]:=fnc1+λ1eqn1+λ2eqn2
The two extrema are given below. We get the same results as those given by Minimize. In addition, we obtain the value of the Lagrangian multipliers:
λ
1
=2and
λ
2
=0
.
sol=Solve[{D[L[x1,x2,x3,λ1,λ2],{x1,1}]0,​​D[L[x1,x2,x3,λ1,λ2],{x2,1}]0,​​D[L[x1,x2,x3,λ1,λ2],{x3,1}]0,​​D[L[x1,x2,x3,λ1,λ2],{λ1,1}]0,​​D[L[x1,x2,x3,λ1,λ2],{λ2,1}]0},{x1,x2,x3,λ1,λ2},Reals]
x1-
3
,x2
3
,x31,λ12,λ20,x1
3
,x2-
3
,x31,λ12,λ20
sol1=sol[[1]]
x1-
3
,x2
3
,x31,λ12,λ20
sol2=sol[[2]]
x1
3
,x2-
3
,x31,λ12,λ20
Minimize[{fnc1,eqn10,eqn20,x1≥0},{x1,x2,x3}]
7,x1
3
,x2-
3
,x31
Minimize[{fnc1,eqn10,eqn20,x1≤0},{x1,x2,x3}]
7,x1-
3
,x2
3
,x31
fnc1/.sol1
7
fnc1/.sol2
7