Lagrange multiplier is the preferred method for solving constrained optimization problems, since it
handles non-linear constraints and problems involving more than two variables.
To optimize an objective function f(x, y) subject to a constraint φ(x, y) = M we work as follows:
Step 1
Define a new function
g(x, y, λ) = f(x, y) + λ(M – φ(x, y))
Step 2
Solve the simultaneous equations
∂g
=0
∂x
∂g
=0
∂y
∂g
=0
∂λ
For the three unknowns x, y, λ.
In step 1 we combine the objective function and constraint into a single function. To do this we first
rearrange the constraint as
M – φ(x, y)
And multiply by the scalar (number) λ(the Greek letter “lambda”. This scalar is called the Lagrange
multiplier. Finally, we add on the objective function to produce the new function
g(x, y, λ) = f(x, y) + λ(M – φ(x, y))
This is called the Lagrangian function. The right hand side involves the three letters x, y and λ, so g is a
function of three variables.
In step 2 we work out the three first order partial derivatives
∂g ∂g ∂g
, ,
∂x ∂y ∂λ
And equate these to zero to produce a system of 3 simultaneous equation for the three unknowns x, y
and λ. The point (x, y) is then the optimal solution of the constrained problem. The problem λ can also be
given a meaning.
Practice problem
1. Use Lagrange multipliers to optimize
2x² - xy
Subject to
X + y = 12
Step 1
f(x, y) = 2x² - xy
φ(x, y) = X + y
M = 12
So the Lagrangian function is given by
g(x, y, λ) = 2x² - xy + λ(12 – x – y)
Step 2
Working out the three partial derivatives of g gives
∂g
= 4x – y – λ = 0
∂x
∂g
= -x – λ = 0
∂y
∂g
= 12 – x – y = 0
∂λ
That is
4x – y – λ = 0
-x – λ = 0
x + y = 12
4x – y – λ = 0
-4x - 4λ = 0
-y - 5λ = 0
4x – y – λ = 0
4x +4y = 48
5y – λ = -48
-y - 5λ = 0
5y - λ = -48
5y + 25λ = 0
5y – λ = -48
24λ = -48
λ= -2
-5y + 2 = -48
5y - 2= 48
5y = 50
Y = 10
-x – y = -12
-x = - 12 + 10
X=2
The optimal solution is therefore (2, 10) and the corresponding value of the objective function
2x² - xy = 2(2)² - (2)(10) = 8 – 20 = -12
Given an objective function
f(x, y)
and constraint
φ(x, y) = M
the value of λ gives the approximate change in the optimal value of f due to 1 unit increase in M.
Practice problem
2. A consumers utility function is given by
U(x1, x2) = 2x1x2 + 3x1
Where x1 and x2 denote the number of items of two goods G1 and G2 that are bought. Each item costs $
1 for G1 and $2 for G2. Use Lagrange multipliers to find the maximum value of U if the consumers
income is $83. Estimate the new optimal utility if the consumers income rises by $1.
The mathematical problem is to maximize the objective function
U(x1, x2) = 2x1x2 + 3x1
Subject to the constraint
X1 + 2x2 = 83
Step 1
The Lagrangian function is
2x1x2 + 3x1 + λ(83 – x1 – 2x2)
Step 2
The simultaneous equations
∂g ∂g ∂g
= 0, =0 , =0
∂x 1 ∂x 2 ∂λ
Are
2x2 + 3 – λ = 0
2x1 - 2λ = 0
83 – x1 – 2x2 = 0
2x2 – λ = -3
2x1 - 2λ = 0
X1 + 2x2 = 83
X1 = 83 – 2x2
2x2 – λ = -3
2(83 – 2x2) - 2λ = 0
2x2 – λ = -3
166 – 4x2 - 2λ = 0
4x2 - 2λ = -6
4x2 + 2λ = 166
4λ = 172
Λ = 43
2x2 – 43 = -3
2x2 = -3 + 43 = 40
X2 = 20
X1 + 2(20) = 83
X1 = 83 – 40 = 43
U(x1, x2) = 2(43)(20) + 3(43) = 1720 + 129 = 1849
If the consumers income rises by 1$, then the new optimal utility is
U(x1, x2) + λ = 1849 + 43 = 1892
Practice problem
3. Use Lagrange multipliers to find expressions for x1 and x2 which maximize the utility function
U = x1 ¹/² + x2¹/²
Subject to the general budgetary constraint
P1x1 + P2x2 = M
Step 1
The Lagrangian function is
G(x, y, λ) = x1 ¹/² + x2¹/² + λ(M – P1x1 – P2x2)
Step 2
The simultaneous equations
∂g ∂g ∂g
= 0, =0 , =0
∂x 1 ∂x 2 ∂λ
Are
1/2x1¯¹/² - λP1 = 0
1/2x2¯¹/² - λP2 = 0
M – P1x1 – P2x2 = 0
1/2x1¯¹/² - λP1 = 0
1/2x2¯¹/² - λP2 = 0
P1x1 + P2x2 = M
P1x1 = M – P2x2
M −P 2 x 2
X1 =
P1
1/2x1¯¹/² - λP1 = 0
1/2x2¯¹/² - λP2 = 0
M −P2 x 2
1/2 ( ) ¯¹/² - λP1 = 0
P1
?????
Exercise 5.6
1. Use Lagrange multipliers to find the maximum value of
z= x + 2xy
subject to the constraint
x + 2y = 5
Step 1
f(x, y) = x + 2xy
φ(x, y) = x + 2y
M=5
So the Lagrangian function is given by
g(x, y, λ) = x + 2xy + λ(5 – x – 2y)
Step 2
Working out the three partial derivatives of g gives
∂g
= 1 + 2y – λ = 0
∂x
∂g
= 2x - 2λ = 0
∂y
∂g
= 5 – x – 2y = 0
∂λ
That is
λ = 1 + 2y (1)
x=λ (2)
X + 2y = 5 (3)
From equation 1 and 2, we get:
X = 1 + 2y (4)
Substituting equation 4 into equation 3:
1 + 2y + 2y = 5
4y = 4
Y=1
Substituting y= 1 into equation 1 and 2 gives:
λ = 1 + 2(1) = 3
x = 1 + 2(1) = 3
The optimal solution is therefore (3, 1) and the maximum value of the function
3 + 2(3)(1) = 3 + 6 = 9
2.(a) Use Lagrange multipliers to find the maximum value of
Z= 4xy
Subject to the constraint
X + 2y = 40
State the associated values of x, y and λ.
(b) Repeat part (a) when the constraint is changed to
X + 2y = 41
(c) Verify that the value of the Lagrange multiplier in part (a) is approximately the same as the change in
the optimal value of z when the right hand side of the constraint is increased by one unit.
Step 1
f(x, y) = 4xy
φ(x, y) = x + 2y
M =40
So the Lagrangian function is given by
g(x, y, λ) = 4xy + λ(40 – x – 2y)
Step 2
Working out the three partial derivatives of g gives
∂g
= 4y – λ = 0
∂x
∂g
= 4x - 2λ = 0
∂y
∂g
= 40 – x – 2y = 0
∂λ
That is
λ = 4y (1)
λ = 2x (2)
X + 2y = 40 (3)
From equation 1 and 2 we get:
4y = 2x ; 2y = x (4)
Substituting equation 4 into equation 3 gives:
2y + 2y = 40
4y = 40
Y = 10
Substituting y = 10 into equation 1 and 2 gives:
λ =4(10) = 40
2x = 40; x = 20
The optimal solution is therefore (20, 10) and the maximum value of the function:
Z = 4(20)(10) = 800
(b)
Step 1
f(x, y) = 4xy
φ(x, y) = x + 2y
M =41
So the Lagrangian function is given by
g(x, y, λ) = 4xy + λ(41 – x – 2y)
Step 2
Working out the three partial derivatives of g gives
∂g
= 4y – λ = 0
∂x
∂g
= 4x - 2λ = 0
∂y
∂g
= 41 – x – 2y = 0
∂λ
That is
λ = 4y (1)
λ = 2x (2)
X + 2y = 41 (3)
From equation 1 and 2 we get:
4y = 2x ; 2y = x (4)
Substituting equation 4 into equation 3 gives:
2y + 2y = 41
4y = 41
Y = 10.25
Substituting y = 10.25 into equation 1 and 2 gives:
λ =4(10.25) = 41
2x = 41; x = 20.5
The optimal solution is therefore (20.5, 10.25) and the maximum value of the function:
Z = 4(20.5)(10.25) = 840.5
(c) Zmax = 840.5 – 800 = 40.5 ≈ λ = 40
3. A firms production function is given by
Q = KL
Unit capital and labour costs are $2 and $1 respectively. Find the maximum level of output if the total
cost of capital and labour is $6.
2K + L = 6
Step 1
The Lagrangian function is
G(K, L, λ) = KL + λ(6 – 2K – L)
Step 2
The simultaneous equations
∂g
= L – 2λ = 0
∂K
∂g
= K-λ=0
∂L
∂g
= 6 – 2K – L = 0
∂λ
L – 2λ = 0 (1)
K-λ=0 (2)
2K + L = 6 (3)
From equation 1 and 2 we get:
L = 2λ and λ = K → K = ½ L (4)
Substituting equation 4 into equation 3 gives:
2( ½ L) + L = 6
2L = 6
L=3
Substituting L =3 into equation 1 and 2 gives:
2λ = 3
Λ = 1.5
K = 1.5
The optimal solution is therefore (1.5, 3) and the maximum value of the function
Q = KL = 3(1.5) = 4.5
4. A monopolistic producer of two goods, G1 and G2, has a total cost function
TC = 5Q1 + 10Q2 = 100
Where Q1 and Q2 denote the quantities of G1 and G2 respectively. If P1 and P2 denote the
corresponding prices then the demand equations are
P1 = 50 – Q1 – Q2
P2 = 100 – Q1 – 4Q2
Find the maximum profit if the firms total costs are fixed at $100. Estimate the new optimal profit if total
costs rise to $101.
� = TR – TC
TR1 = Q1(50 – Q1 – Q2) = 50Q1 – Q1² - Q1Q2
TR2 = Q2(100 – Q1 – 4Q2) = 100Q2 – Q1Q2 – 4Q2²
TR = TR1 + TR2 = 50Q1 – Q1² - Q1Q2 + 100Q2 – Q1Q2 – 4Q2² = 50Q1 – Q1² - 2Q1Q2 + 100Q2 – 4Q2²
� = 50Q1 – Q1² - 2Q1Q2 + 100Q2 – 4Q2² - 5Q1 - 10Q2 = 45Q1 – Q1² - 2Q1Q2 + 90Q2 – 4Q²
The constraint is
5Q1 + 10Q2 = 100
Step 1
The Lagrangian function is
G(Q1, Q2, λ) = 45Q1 – Q1² - 2Q1Q2 + 90Q2 – 4Q2² + λ( 100 – 5Q1 – 10Q2)
Step 2
The simultaneous equations
∂g
= 45 – 2Q1 – 2Q2 - 5λ = 0
∂Q 1
∂g
= -2Q1 + 90 – 8Q2 - 10λ = 0
∂Q 2
∂g
= 100 – 5Q1 – 10Q2= 0
∂λ
λ = 9 – 0.4Q1 – 0.4Q2 (1)
λ = 9 – 0.2Q1 – 0.8Q2 (2)
5Q1 + 10Q2 = 100 (3)
From equation 1 and 2 we get:
9 – 0.4Q1 – 0.4Q2 = 9 – 0.2Q1 – 0.8Q2
-0.2Q1 + 0.4Q2 = 0
0.2Q1 = 0.4Q2
Q1 = 2Q2 (4)
Substituting equation 4 into equation 3 gives:
5(2Q2) + 10Q2 = 100
10Q2 + 10Q2 = 100
20Q2 = 100
Q2 = 5
Substituting Q2 = 5 into equation 4 gives:
Q1 = 2(5) = 10
Substituting Q1 = 10 and Q2 = 5 into equation 1 gives:
λ = 9 – 0.4(10) – 0.4(5) = 9 – 4 – 2 = 3
� = 45(10) – (10)² - 2(10)(5) + 90(5) – 4(5)² = 450 – 100 – 100 + 450 – 100 = 600
�max = λ * ∆M = 3 * 1 = 3
Maximum profit increases to 603 since Lagrange multiplier is 3:
600 + 3 = 603