Finding Optimal Value of State 
and Lagrangian Multiplier
Author's Data: Housam Binous
Department of Chemical Engineering
National Institute of Applied Sciences and Technology
Tunis, TUNISIA
Email: binoushousam@yahoo.com

The solution to the present problem was 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((Subscript[x, 1]), (Subscript[x, 2]), (Subscript[x, 3])) = ((Subscript[x, 1])^2) + ((Subscript[x, 2])^2) + ((Subscript[x, 3])^2) when it lies on the intersection of the surfaces defined by:
(Subscript[x, 3]) = (Subscript[x, 1]) (Subscript[x, 2]) + 4 and (Subscript[x, 1]) + (Subscript[x, 2]) + (Subscript[x, 3]) = 1

fnc1 = x1^2 + x2^2 + x3^2

eqn1 = x1 x2 + 4 - x3

eqn2 = x1 + x2 + x3 - 1

The Lagrangian is L((Subscript[x, 1]), (Subscript[x, 2]), (Subscript[x, 3]),(Subscript[λ, 1]), (Subscript[λ, 2]))

L[x1_, x2_, x3_, λ1_, λ2_] := 
      fnc1 + λ1 eqn1 + λ2 eqn2

The two extremums are given below. We get the same results as those given by Minimize. In addition, we obtain the value of the Lagrangian multipliers: (Subscript[λ, 1]) = 2 and (Subscript[λ, 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}]

sol1 = sol[[1]]

sol2 = sol[[2]]

Minimize[{fnc1, eqn1 == 0, eqn2 == 0, 
        x1 ≥ 0}, {x1, x2, x3}]

Minimize[{fnc1, eqn1 == 0, eqn2 == 0, 
        x1 ≤ 0}, {x1, x2, x3}]

fnc1 /. sol1

fnc1 /. sol2