Theory of Optimization-2
Theory of Optimization-2
SUBMITTED TO:-
Mam Hira Khalid
SUBMITTED BY:-
Group 8
Anam Shehnaz (08)
Aresha Abid (13)
Ifra Safdar (27)
Momina javed (50)
Nasira Batool (51)
Tehreem Fatima (60)
Zunaira Ilyas (65)
COURSE TITLE:-
Theory of Optimization
COURSE CODE:-
MTH - 465
TOPIC:-
Lagrange Multiplier
DEPARTMENT:-
BS Mathematics
SECTION:-
8th ( MA )
For case of only one constraint with two variables, consider the
optimization problem
And ∇ L(x,y, λ ) = 0
⇒ ∇ x , yf(x,y) = λ ∇ x, y g(x,y)
and g(x,y) = 0
Question 1:-
Solution:-
f(x,y) = x +¿ y
g(x,y) = x 2 +¿ y −¿
2
1
Lagrangian function is
L(x,y, λ ) = x +¿ y – λ ¿ +¿ y 2−¿ 1)
∂L ∂L ∂L
∂x
= 1 – 2 λx , ∂y
= 1 – 2 λy , ∂λ
= – ¿ +¿ y −¿
2
1)
Now ,
= 0 ⇒ ⇒ x=
∂L 1
∂x 1 – 2 λx = 0 2λ ……(1 ¿
= 0 ⇒ ⇒ y=
∂L 1
∂y 1 – 2 λy = 0 2λ ……(2 ¿
∂L
∂y
= 0⇒ 2 2
x +¿ y −¿ 1 = 0 ….(3)
1 1
4λ
2 + 4λ
2 =1
= 0 ⇒ 2 −4 λ2 = 0
2
1+ 1−4 λ
2
4λ
⇒ λ = ± √2
1 1
λ =
2
2
⇒ x = √2 , y = √2
+1 2 2
When λ = √2
⇒ x =−¿ √2 , y =−¿ √2
−1 2 2
When λ = √ 2
( √2 , √2 , √2 ) and (−¿ √2 , 2√ , √ 2 )
2 2 1 2 − 2 −1
Now f ( √2 , √2 ) = √2 + √2 = √ 2
2 2 2 2
f (−¿ √2 , 2√ ) = 2√ − √2 =−√ 2
2 − 2 − 2 2
at point (−¿ √2 , 2√ ).
2 − 2
Question 2:-
Solution:-
f(x,y) = x 2 y
g(x,y) = x 2 +¿ 2
y −¿ 3
Lagrangian function is
∂L ∂L ∂L
∂x
= 2xy – 2 λx , ∂y
= x 2 – 2 λy , ∂λ
= – ¿ +¿ 2
y −¿ 3)
Now ,
= 0 ⇒ 2xy – 2 λx = 0
∂L
∂x ……(1 ¿
= 0 ⇒
∂L
∂y
2
x – 2 λy =0 ……(2 ¿
∂L
∂y
= 0⇒ 2 2
x +¿ y −¿ 3 = 0 ….(3)
⇒ x = 0 , y – λ=0 ⇒ x = 0, y = λ
Put x = 0 in (2)
0 – 2 λy = 0 ⇒ y = 0 or λ=0
Put x = 0 in (3)
Put y = λ in (2)
2
x – 2 λ( λ) =0 ⇒ 2
x =2 λ
2
⇒ x = √2 λ
+( λ )2 = 3 ⇒
2
(√ 2 λ) 3λ
2
=3
⇒ λ
2
=1 ⇒ λ=± 1
Now
f (0,√ 3 ¿= ¿ =0
f (0,−√ 3 ¿= ¿ ) = 0
f (√ 2 ,1 , ¿= ¿ = 2
f (−√ 2 ,1 , ¿= ¿ = 2
g (x,y) = 3 x 2+ y 2−¿ 6
Lagrangeian function is
L(x,y, λ ) = xy – λ ¿ +¿ y 2−¿ 6)
∂L ∂L ∂L
∂x
= y – 6 λx , ∂y
= x – 2 λy , ∂λ
= – ¿ +¿ 2
y −¿ 6)
Now ,
= 0 ⇒ y – 6 λx = 0
∂L
∂x ……(1 ¿
= 0 ⇒
∂L
∂y
x – 2 λy =0 ……(2 ¿
∂L
∂y
= 0⇒ 2 2
3 x +¿ y −¿ 6 = 0 ….(3)
From (1) y ¿ 6 λx
put y ¿ 6 λx in (2)
x – 2 λ ¿) =0 ⇒ 2
x−12 λ x=0
⇒ x (1−12 λ )=0
2
⇒ x=0 , 1−12 λ =0
2
⇒ ⇒ λ2 =
1
x=0 , 1=12 λ
2
12
⇒
1 1
λ = √12 = 2 √3
put y ¿ 6 λx in (3)
2 2
3 x +¿ (6 λx ) −¿ 6=0
2
3 x +36 λ x
2 2
=6
1
Putting λ
2
= 12
=6 ⇒
1 2
3 x +36 (
2
12
)x 2
3 x +¿ 3 x
2
=6
⇒ 6 x =6
2
⇒ 2
x =1 ⇒ x=± 1
When ¿ 1 , λ = 2 √3 ⇒
1 1 3
y=6.
2 √3
(1) = √3
When ¿−1 , λ = 2 √3 ⇒
1 1 −3
y=6. (−1) = √3
2 √3
f (0,0) = 0
3 3 3
f (1, √3 ¿=¿ (1 ¿( √3 )=¿ √3
−3 −3 3
f (−1, √ 3 ¿=¿ (−1 ¿( √ 3 )=¿ √3
3
The constraint has saddle point at (0,0) and local maxima √3 at both
3 −3
(1 , ) and (−1, ¿
√3 √3
Question 4:-
Maximize the function f(x, y) = xy subject to the constraint
x + y = 10.
Lagrangian Function is
L(x, y, λ) = xy – λ(x + y – 10)
Partial Derivatives
∂L/∂x = y – λ
∂L/∂y = x – λ
∂L/∂λ = -(x + y – 10)
System of Equations
Y – λ = 0 … (1)
X – λ = 0 … (2)
X + y – 10 = 0 … (3)
Solve the System
X + x = 10 ⇒ 2x = 10 ⇒ x = 5 ⇒ y = 5
Value of λ
λ = x = 5 or λ = y = 5
Maximum Value
F(x, y) = xy = 5 × 5 = 25
Thus , Maximum value is 25 at point (5, 5)
Where f (x₁, x₂, x₃, …, xn) is deal only for máximum . If our question
demand is in minimum. Then we convert it into minimization
problem to maximization problem.
After this, we use following steps:
1.Write the Lagrangian expression.
L(x₁, x₂, …, xn, λᵢ) = f(x₁, x₂, …, xn) – Σᵢn₌₁ λᵢgᵢ(x₁, x₂, …, xn)
2.After this, we find partial derivatives
λ₁,λ₂, …, λn
4.Write the stationary points in the sense of x₁, x₂, …, xn and λ₁, λ₂,
…, λn
i.e. (x₁, x₂, …, xn, λ₁, λ₂, …, λn)
5.After this, we putting theStationary points in given function.
We observe that our given function is local maxima or
local minima or saddle points.
Question 1:-
Maximize f(x, y, z) = xyz2 subject to x + y + z = 6 and x + y = 4.
Solution :-
f(x, y, z) = xyz2
g1 (x, y, z) = x + y+ z - 6
g2 (x, y, z) = x + y - 4
Step 1: Form the Lagrangian function
L(x, y, z, λ1, λ2) = f(x, y, z) - λ1g1 (x, y, z) – λ2 g2 (x, y, z)
L(x, y, z, λ1, λ2) = xyz2 – λ1(x + y + z – 6) – λ2(x + y – 4)
Step 2: Find the partial derivatives
∂L/∂x = yz2 – λ1 – λ2 = 0 ……………….. (1)
∂L/∂y = xz2 – λ1 – λ2 = 0 ……………….… (2)
∂L/∂z = 2xyz – λ1 = 0 …………………….. (3)
∂L/∂λ1 = x + y + z – 6 = 0 …………………. (4)
∂L/∂λ2 = x + y – 4 = 0 ….…………………..(5)
Step 3: Solve the system of equations
From (5), we get x + y = 4.
Substituting x + y = 4 into (4), we get:
4+z=6 ⇒ z=2
From (1) and (2), we get:
yz2 – λ1 – λ2 = 0
xz2 – λ1 – λ2 = 0
Subtracting the two equations, we get:
yz2 – xz2 = 0
z2(y – x) = 0
Since z = 2, we get:
y– x = 0 ⇒ y=x
Substituting y = x into x + y = 4, we get:
x + x = 4 ⇒ 2x = 4 ⇒ x = 2
and y= 2
Step 4: Find λ1 and λ2
From (3), we get:
2xyz = λ1 ⇒ λ1 = 2(2)(2)(2) = 16
From (1), we get:
yz2 = λ1 + λ2
(2)(2)2= 16 + λ2
8 = 16 + λ 2 ⇒ λ 2=−8
1 – 3 – λ2 = 0 ⇒ λ2 = -2
4y – 3 – λ2 = 0
4y – 3 + 2 = 0
4y = 1 ⇒ y = ¼
From (5), we get x + y = 3.
x+ ¼ = 3
x = 11/4
From (4), we get x + y + z = 5.
11/4 + ¼ + z = 5
12/4 + z = 5
3+z=5⇒ z=2
Required stationary points are (11/4, ¼ , 2, 3, -2).
Step 4: Find the maximum value
Now that we have the values of x, y, and z, we can find the maximum
value of f(x, y, z):
F(x, y, z) = x + 2y2 + 3z
= 11/4 + 2(1/4)2 + 3(2)
= 11/4 + 2(1/16) + 6
= 11/4 + 1/8 + 6
= 22/8 + 1/8 + 48/8
= 71/8
The maximum value of f(x, y, z) is 71/8 = 8.875.
Question 3:-
Maximize f(x, y, z) = 3x + y + 2z subject to x + y + z = 4 and
x + z = 3.
Solution :-
f(x, y, z) = 3x + y + 2z
g1 (x, y, z) = x + y + z -4
g2 (x, y, z ) = x + z -3
Step 1: Form the Lagrangeian function
L(x, y, z, λ1, λ2) = f(x, y, z) - λ1 g1 (x, y, z) – λ2 g2 (x, y, z)
L(x, y, z, λ1, λ2) = 3x + y + 2z – λ1(x + y + z – 4) – λ2(x + z – 3)
Step 2: Find the partial derivatives
∂L/∂x = 3 – λ1 – λ2 = 0 ………….. (1)
∂L/∂y = 1 – λ1 = 0 ………………… (2)
∂L/∂z = 2 – λ1 – λ2 = 0 …………… (3)
∂L/∂λ1 = x + y + z – 4 = 0 … ………..(4)
∂L/∂λ2 = x + z – 3 = 0 ………………. (5)
Step 3: Solve the system of equations
From (2), we get. λ 1 = 1.
Substituting λ1 into (1) and (3), we get:
3 – 1 – λ2 = 0 ⇒ λ2 = 2
2 – 1 – λ2 = 0 ⇒ λ2 = 1
However, λ2 has two different values, which indicates an
inconsistency.
From (5), we get z = 3 – x.
Substituting z into (4), we get:
x+y+3–x=4
y=1
Now, substituting y into (4), we get:
x+1+z=4 ⇒ x +z=3
This is consistent with (5). Let’s solve for x and z.
From (5), we get z = 3 – x.
Let’s choose x = 1
Then z = 2
Step 4: Verify the solution
x+ y + z = 1 + 1 + 2 = 4 (satisfies the constraint)
x + z = 1 + 2 = 3 (satisfies the constraint)
Step 5: Find the maximum value
Now that we have the values of x, y, and z, we can find the maximum
value of f(x, y, z):
F(x, y, z) = 3x + y + 2z
= 3(1) + 1 + 2(2)
=3+1+4 =8
The maximum value of f (x, y, z) is 8.
Question 4:-
Maximize the function
f(x, y) = sin(x) + cos(y)
subject to the constraints
x + y = π/2
x−y=0
Solution:-
Step 1: Lagrangian Function
Let
∂L/∂λ₂ = x − y = 0 ...(4)
√2/2 − λ₁ − λ₂ − √2/2 − λ₁ + λ₂ = 0
⇒ −2λ₁ = 0 ⇒ λ₁ = 0
Solution:-
Step 1: Lagrangian Function
∂L/∂λ₁ = x + y − 1 = 0 ...(3)
∂L/∂λ₂ = x − y = 0 ...(4)
Step 3: Solve the System
From (4): x = y
Substitute into (3):
x + x = 1 ⇒ 2x = 1 ⇒ x = 2 , y =
1 1
2
1
( 12 , 12 )
1
Thus , the maximum value is 2 ·e 2 at the point
Practice Questions
Single Constraints problems
1. Find the maximum and minimum of f(x, y) = xy subject to
4x² + 9y² = 36.
2. Maximize f(x, y, z) = x + y + z subject to x² + y² + z² = 1.
3. Maximize f(x, y) = ln(x) + ln(y)
Subject to: x + y = 10
4. Minimize f(x, y) = sin(x) + cos(y)
Subject to: x² + y² = 1
5. Maximize f(x, y) = eˣ + eʸ
Subject to: x + 2y = 5
.
Multiple Constraints problems
6. Maximize f(x, y, z) = x·y·z
Subject to x+y+z=6 and x² + y² + z² = 14
7.Minimize f(x, y) = x² + 4y²
Subject to x+y=3 and x − 2y = 1
REFERENCES
https://youtu.be/RYOBs5kKndE?si=h1GD73Z3F3oXhBlC
https://youtu.be/9Q9HzpsH2pQ?si=5LZeuGjDARn85H03
https://youtu.be/20DgYM5UYFY?si=vprXC7Ix0OQVlBWh
https://youtu.be/iPxF9N-QVz4?si=u_17Nuqt-rneOQYo
https://www.mathcity.org/_media/notes/theory-of-optimization-
muzammil-tanveer.pdf