Professional Documents
Culture Documents
Chapter - 10 - (Un) Constrained - Optimization - LMS - Answers
Chapter - 10 - (Un) Constrained - Optimization - LMS - Answers
Chapter - 10 - (Un) Constrained - Optimization - LMS - Answers
(UN)CONSTRAINED
OPTIMIZATION
Alexandra Kis
December 2020
OUTLINE
This chapter
1. Unconstrained optimization of a
function of two variables
2. Constrained optimization
i. The substitution method
ii. The Lagrange’s method
TIMELINE
𝑦 𝑦
𝑓(𝑥)
𝑓(𝑥)
𝑥 𝑥
UNCONSTRAINED OPTIMIZATION
With
Minimum point onlyMaximum
one point
𝑑𝑓 𝑥
𝑑𝑥
= 0 and
𝑑2 𝑓 𝑥
𝑑𝑥 2
variable!!
>0
𝑑𝑓 𝑥
𝑑𝑥
= 0 and
𝑑2 𝑓 𝑥
<0
𝑑𝑥 2
𝑦 𝑦
What
𝑓(𝑥)
about a
function with 2 𝑓(𝑥)
variables?
𝑥 𝑥
UNCONSTRAINED OPTIMIZATION
UNCONSTRAINED OPTIMIZATION
𝑧
𝑦 𝑧
𝜕𝑧
=0
𝑥 𝑑𝑥
𝑥
UNCONSTRAINED OPTIMIZATION
𝑧
𝑦 𝑧
𝜕𝑧
=0
𝑥 𝑑𝑥
𝑥
𝑧
𝜕𝑧
=0
𝑑𝑦
𝑦
UNCONSTRAINED OPTIMIZATION
CRITICAL POINT(S)
𝑦 𝑓(𝑥)
𝑥
UNCONSTRAINED OPTIMIZATION
Hessian matrix: 𝐻=
UNCONSTRAINED OPTIMIZATION
2
𝜕 𝑓 𝜕2𝑓
= 𝑓𝑥𝑥 = 𝑓𝑥𝑦
𝜕𝑥 2 𝜕𝑥𝜕𝑦
𝐻=
𝜕2𝑓 𝜕2𝑓
= 𝑓𝑦𝑥 2
= 𝑓𝑦𝑦
𝜕𝑦𝜕𝑥 𝜕𝑦
𝜀 = det 𝐻 =
Note: 𝜀 is a Greek letter called “epsilon”
UNCONSTRAINED OPTIMIZATION
2
𝜕 𝑓 𝜕2𝑓
= 𝑓𝑥𝑥 = 𝑓𝑥𝑦
𝜕𝑥 2 𝜕𝑥𝜕𝑦
𝐻=
𝜕2𝑓 𝜕2𝑓
= 𝑓𝑦𝑥 2
= 𝑓𝑦𝑦
𝜕𝑦𝜕𝑥 𝜕𝑦
2
𝜕 𝑓 𝜕2𝑓
= 𝑓𝑥𝑥 = 𝑓𝑥𝑦
𝜕𝑥 2 𝜕𝑥𝜕𝑦
𝐻=
𝜕2𝑓 𝜕2𝑓
= 𝑓𝑦𝑥 2
= 𝑓𝑦𝑦
𝜕𝑦𝜕𝑥 𝜕𝑦
𝑓𝑥𝑦 = 𝑓𝑦𝑥
2
𝑓 𝑓 −𝑓
𝜀 = det 𝐻 = 𝑥𝑥 𝑦𝑦 𝑥𝑦
UNCONSTRAINED OPTIMIZATION
CRITICAL POINT(S) +
With 2 variables
With 1 variable
𝑑2 𝑓 𝑥 𝑓𝑥𝑥 > 0 → minimum
> 0 → minimum
𝑑𝑥 2
𝜀>0
𝑑2 𝑓 𝑥
< 0 → maximum 𝑓𝑥𝑥 < 0 → maximum
𝑑𝑥 2
𝑑2 𝑓 𝑥
= 0 → inflexion 𝜀 < 0 → saddle point
𝑑𝑥 2
𝜀 = 0 → no information
UNCONSTRAINED OPTIMIZATION
UNCONSTRAINED OPTIMIZATION
Hessian matrix
Matrix of the second-order partial derivatives.
With 𝑓(𝑥, 𝑦):
𝜕2𝑓 𝜕2𝑓
𝜕𝑥 2 𝜕𝑥𝜕𝑦 𝑓𝑥𝑥 𝑓𝑥𝑦
𝐻= =
𝜕2𝑓 𝜕2𝑓 𝑓𝑦𝑥 𝑓𝑦𝑦
𝜕𝑦𝜕𝑥 𝜕𝑦 2
UNCONSTRAINED OPTIMIZATION
2
𝜀 = det 𝐻 = 𝑓𝑥𝑥 𝑓𝑦𝑦 − 𝑓𝑥𝑦
UNCONSTRAINED OPTIMIZATION
Example 1:
Find and classify the stationary point(s) of the following function:
𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥 + 𝑥𝑦 2
𝑓𝑥 = 3𝑥 2 − 3 + 𝑦 2 = 0
𝑓𝑦 = 2𝑥𝑦 = 0 Either 𝑥 = 0 or 𝑦 = 0
UNCONSTRAINED OPTIMIZATION
Example 1:
Find and classify the stationary point(s) of the following function:
𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥 + 𝑥𝑦 2
𝑓𝑥 = 3𝑥 2 − 3 + 𝑦 2 = 0
𝑓𝑦 = 2𝑥𝑦 = 0 Either 𝑥 = 0 or 𝑦 = 0
Example 1:
Find and classify the stationary point(s) of the following function:
𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥 + 𝑥𝑦 2
𝑓𝑥 = 3𝑥 2 − 3 + 𝑦 2 = 0
𝑓𝑦 = 2𝑥𝑦 = 0 Either 𝑥 = 0 or 𝑦 = 0
Example 1:
Find and classify the stationary point(s) of the following function:
𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥 + 𝑥𝑦 2
𝑓𝑥 = 3𝑥 2 − 3 + 𝑦 2
𝑓𝑦 = 2𝑥𝑦
UNCONSTRAINED OPTIMIZATION
Example 1:
Find and classify the stationary point(s) of the following function:
𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥 + 𝑥𝑦 2
𝑓𝑥𝑥 = 6𝑥
𝑓𝑥 = 3𝑥 2 −3 + 𝑦2
𝑓𝑦 = 2𝑥𝑦
UNCONSTRAINED OPTIMIZATION
Example 1:
Find and classify the stationary point(s) of the following function:
𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥 + 𝑥𝑦 2
𝑓𝑥𝑥 = 6𝑥
𝑓𝑥 = 3𝑥 2 −3 + 𝑦2
𝑓𝑦𝑦 = 2𝑥
𝑓𝑦 = 2𝑥𝑦
UNCONSTRAINED OPTIMIZATION
Example 1:
Find and classify the stationary point(s) of the following function:
𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥 + 𝑥𝑦 2
𝑓𝑥𝑥 = 6𝑥
𝑓𝑥 = 3𝑥 2 −3 + 𝑦2
𝑓𝑦𝑦 = 2𝑥
𝑓𝑦 = 2𝑥𝑦
𝑓𝑥𝑦 = 𝑓𝑦𝑥 = 2𝑦
UNCONSTRAINED OPTIMIZATION
Example 1:
Find and classify the stationary point(s) of the following function:
𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥 + 𝑥𝑦 2
𝑓𝑥𝑥 = 6𝑥
𝑓𝑥 = 3𝑥 2 −3 + 𝑦2
𝑓𝑦𝑦 = 2𝑥
𝑓𝑦 = 2𝑥𝑦
𝑓𝑥𝑦 = 𝑓𝑦𝑥 = 2𝑦
6𝑥 2𝑦
𝐻= 𝜀 = det 𝐻 = 6𝑥 ∗ 2𝑥 − 2𝑦 ∗ 2𝑦 = 12𝑥 2 − 4𝑦 2
2𝑦 2𝑥
UNCONSTRAINED OPTIMIZATION
Example 1:
Find and classify the stationary point(s) of the following function:
𝑓 𝑥, 𝑦 = 𝑥 3 − 3𝑥 + 𝑥𝑦 2
2 methods
Example 2:
You want to maximize your consumption under your budget constraint:
max 𝐶 𝑄1 , 𝑄2 = 𝑄1 𝑄2
Subject to 2𝑄1 + 𝑄2 = 100
THE SUBSTITUTION METHOD
Example 2:
You want to maximize your consumption under your budget constraint:
max 𝐶 𝑄1 , 𝑄2 = 𝑄1 𝑄2 Function to optimize
Subject to 2𝑄1 + 𝑄2 = 100 Constraint
𝑄2 = 100 − 2𝑄1
THE SUBSTITUTION METHOD
Example 2:
You want to maximize your consumption under your budget constraint:
max 𝐶 𝑄1 , 𝑄2 = 𝑄1 𝑄2
Subject to 2𝑄1 + 𝑄2 = 100
𝐶 = 𝑄1 𝑄2 = 𝑄1 (100 − 2𝑄1 )
Example 2:
You want to maximize your consumption under your budget constraint:
max 𝐶 𝑄1 , 𝑄2 = 𝑄1 𝑄2
Subject to 2𝑄1 + 𝑄2 = 100
𝑑𝐶
𝐶= 100𝑄1 − 2𝑄12 = 100 − 4𝑄1 = 0
𝑑𝑄1
THE SUBSTITUTION METHOD
Example 2:
You want to maximize your consumption under your budget constraint:
max 𝐶 𝑄1 , 𝑄2 = 𝑄1 𝑄2
Subject to 2𝑄1 + 𝑄2 = 100
𝑑𝐶
= 100 − 4𝑄1 = 0 𝑄1 = 25
𝑑𝑄1
THE SUBSTITUTION METHOD
Example 2:
You want to maximize your consumption under your budget constraint:
max 𝐶 𝑄1 , 𝑄2 = 𝑄1 𝑄2
Subject to 2𝑄1 + 𝑄2 = 100
5. Check it is a maximum.
𝑑𝐶
= 100 − 4𝑄1 = 0 𝑄1 = 25
𝑑𝑄1
𝑑2 𝐶
2 = −4 < 0 → 𝑚𝑎𝑥
𝑑𝑄1
THE SUBSTITUTION METHOD
Example 2:
You want to maximize your consumption under your budget constraint:
max 𝐶 𝑄1 , 𝑄2 = 𝑄1 𝑄2
Subject to 2𝑄1 + 𝑄2 = 100
𝑄2 = 100 − 2𝑄1 𝑄1 = 25 𝑄2 = 50
The Lagrange’s
method
THE LAGRANGE’S METHOD
Example 2 (bis):
You want to maximize your consumption under your budget constraint:
max 𝐶 𝑄1 , 𝑄2 = 𝑄1 𝑄2
Subject to 2𝑄1 + 𝑄2 = 100 2𝑄1 + 𝑄2 − 100 = 0
Exercise 1:
A firm sells two goods 𝐺1 and 𝐺2 at $1000
and $800, respectively. The total cost of
producing these two goods is given by
𝐶 = 2𝑄12 + 2𝑄1 𝑄2 + 𝑄22
Where 𝑄1 and 𝑄2 denotes the output
levels of 𝐺1 and 𝐺2 , respectively. Find the
maximum profit and the values of 𝑄1 and
𝑄2 at which this is achieved.
EXERCISES
Exercise 1:
A firm sells two goods 𝐺1 and 𝐺2 at $1000 and $800, respectively. The total
cost of producing these two goods is given by
𝐶 = 2𝑄12 + 2𝑄1 𝑄2 + 𝑄22
Where 𝑄1 and 𝑄2 denotes the output levels of 𝐺1 and 𝐺2 , respectively. Find the
maximum profit and the values of 𝑄1 and 𝑄2 at which this is achieved.
𝑅 = 𝑃1 𝑄1 + 𝑃2 𝑄2 = 1000𝑄1 + 800𝑄2
𝜕𝜋
= 1000 − 4𝑄1 − 2𝑄2 = 0
𝜕𝑄1
200 − 2𝑄1 = 0 𝑄1 = 100
𝜕𝜋
= 800 − 2𝑄1 − 2𝑄2 = 0
𝜕𝑄2
𝑄2 = 300
EXERCISES
𝜋11 = −4
−4 −2
𝜋22 = −2 𝐻= 𝜀=4
−2 −2
𝜋12 = 𝜋21 = −2
𝑄1 = 100
and 𝜀 = 4 and 𝜋11 = −4 𝜀 > 0, 𝜋11 < 0 → maximum
𝑄2 = 300
EXERCISES
𝜋 100, 300 = 1000 ∗ 100 + 800 ∗ 300 − 2 ∗ 1002 − 2 ∗ 100 ∗ 300 − 3002
= $170 000
EXERCISES
Exercise 2:
A firm produced two goods A and B. The
weekly cost of producing 𝑥 items of A and 𝑦
items of B is
𝐶 = 0.2𝑥 2 + 0.05𝑦 2 + 0.1𝑥𝑦 + 2𝑥 + 5𝑦 + 1000
a) State the minimum value of cost in the
case when there are no constraints.
b) Find the minimum value of cost when the
firm is committed to producing 500 goods
of either type in total.
EXERCISES
Exercise 2:
A firm produced two goods A and B. The weekly cost of producing 𝑥 items of A
and 𝑦 items of B is
𝐶 = 0.2𝑥 2 + 0.05𝑦 2 + 0.1𝑥𝑦 + 2𝑥 + 5𝑦 + 1000
a) State the minimum value of cost in the case when there are no constraints.
Exercise 2:
A firm produced two goods A and B. The weekly cost of producing 𝑥 items of A
and 𝑦 items of B is
𝐶 = 0.2𝑥 2 + 0.05𝑦 2 + 0.1𝑥𝑦 + 2𝑥 + 5𝑦 + 1000
b) Find the minimum value of cost when the firm is committed to producing
500 goods of either type in total.
min 𝐶 = 0.2𝑥 2 + 0.05𝑦 2 + 0.1𝑥𝑦 + 2𝑥 + 5𝑦 + 1000
Constraint: 𝑥 + 𝑦 = 500 → 𝑥 = 500 − 𝑦
𝐶 = 0.2 500 − 𝑦 2 + 0.05𝑦 2 + 0.1(500 − 𝑦)𝑦 + 2(500 − 𝑦) + 5𝑦 + 1000
Exercise 2:
A firm produced two goods A and B. The weekly cost of producing 𝑥 items of A
and 𝑦 items of B is
𝐶 = 0.2𝑥 2 + 0.05𝑦 2 + 0.1𝑥𝑦 + 2𝑥 + 5𝑦 + 1000
b) Find the minimum value of cost when the firm is committed to producing
500 goods of either type in total.
Exercise 2:
A firm produced two goods A and B. The weekly cost of producing 𝑥 items of A
and 𝑦 items of B is
𝐶 = 0.2𝑥 2 + 0.05𝑦 2 + 0.1𝑥𝑦 + 2𝑥 + 5𝑦 + 1000
b) Find the minimum value of cost when the firm is committed to producing
500 goods of either type in total.
𝑑𝐶 𝑑2 𝐶
= −147 + 0.3𝑦 2
= 0.3 > 0 → 𝑚𝑖𝑛
𝑑𝑦 𝑑𝑦
Exercise 3:
A monopolistic producer of two goods, 𝐺1 and 𝐺2 , has a total cost function
𝑇𝐶 = 5𝑄1 + 10𝑄2
Where 𝑄1 and 𝑄2 denote the quantities of 𝐺1 and 𝐺2 , respectively. If 𝑃1 and 𝑃2
denote the corresponding prices, then the demand equations are:
𝑃1 = 50 − 𝑄1 − 𝑄2
𝑃2 = 100 − 𝑄1 − 4𝑄2
a) Use the Lagrange method to find the maximum profit if the firm’s total costs
are fixed at $100.
b) Estimate the new optimal profit if the total costs rise to $101.
EXERCISES
Exercise 3:
𝑃1 = 50 − 𝑄1 − 𝑄2
𝑃2 = 100 − 𝑄1 − 4𝑄2
a) Find the maximum profit if the firm’s total costs are fixed at $100.
𝑅 = 𝑄1 𝑃1 + 𝑄2 𝑃2 𝑅 = 𝑄1 50 − 𝑄1 − 𝑄2 + 𝑄2 (100 − 𝑄1 − 4𝑄2 )
Exercise 3:
𝑃1 = 50 − 𝑄1 − 𝑄2
𝑃2 = 100 − 𝑄1 − 4𝑄2
a) Find the maximum profit if the firm’s total costs are fixed at $100.
Exercise 3:
a) Find the maximum profit if the firm’s total costs are fixed at $100.
Exercise 3:
a) Find the maximum profit if the firm’s total costs are fixed at $100.
𝜋 = 600
EXERCISES
Exercise 3:
b) Estimate the new optimal profit if the total costs rise to $101.
How evolves the profit when the constraint increases (by 1)?
𝐿 = 𝑓(𝑥, 𝑦) − λ(𝑔 𝑥, 𝑦 − 𝑐)
𝜕𝐿
=λ‼
𝜕𝑐
λ=3
If the constraint (i.e. the total cost) increases by 1, the profit increases by 3.
EXERCISES
Exercise 4:
A consumer’s utility function is
𝑈 = ln 𝑥1 + 2ln(𝑥2 )
One good 𝑥1 costs 2 CHF and
one good 𝑥2 costs 3 CHF. You
can spend a maximum of 18 CHF
on both goods. Find the values of
𝑥1 and 𝑥2 which maximize 𝑈
subject to the budgetary
constraint.
EXERCISES
Exercise 4:
A consumer’s utility function is
𝑈 = ln 𝑥1 + 2ln(𝑥2 )
One good 𝑥1 costs 2 CHF and one good 𝑥2 cost 3 CHF. You can spend a
maximum of 18 CHF on both goods. Find the values of 𝑥1 and 𝑥2 which
maximize U subject to the budgetary constraint.
3
Constraint: 2𝑥1 + 3𝑥2 = 18 → 𝑥1 = 9 − 𝑥2
2
3
𝑈 = ln 9 − 𝑥2 + 2ln(𝑥2 )
2
EXERCISES
Exercise 4:
A consumer’s utility function is
𝑈 = ln 𝑥1 + 2ln(𝑥2 )
One good 𝑥1 costs 2 CHF and one good 𝑥2 cost 3 CHF. You can spend a
maximum of 18 CHF on both goods. Find the values of 𝑥1 and 𝑥2 which
maximize U subject to the budgetary constraint.
3
𝑈 = ln 9 − 𝑥2 + 2ln(𝑥2 )
2
3 3 9
𝑑𝑈 − 2 𝑑𝑈 − 𝑥2 + 18 − 3𝑥2 𝑑𝑈 − 𝑥2 + 18
= 2 + =0 → = 2 =0 → = 2 =0
3
𝑑𝑥2 9 − 𝑥 𝑥2 𝑑𝑥2 3 𝑑𝑥2 3
9 − 𝑥2 𝑥2 9 − 𝑥2 𝑥2
2 2 2 2
EXERCISES
Exercise 4:
A consumer’s utility function is
𝑈 = ln 𝑥1 + 2ln(𝑥2 )
One good 𝑥1 costs 2 CHF and one good 𝑥2 cost 3 CHF. You can spend a
maximum of 18 CHF on both goods. Find the values of 𝑥1 and 𝑥2 which
maximize U subject to the budgetary constraint.
9
− 𝑥2 + 18 = 0 𝑥2 = 4
2
3
𝑥1 = 9 − 𝑥2 𝑥1 = 3
2
EXERCISES
Exercise 4:
A consumer’s utility function is
𝑈 = ln 𝑥1 + 2ln(𝑥2 )
One good 𝑥1 costs 2 CHF and one good 𝑥2 cost 3 CHF. You can spend a
maximum of 18 CHF on both goods. Find the values of 𝑥1 and 𝑥2 which
maximize U subject to the budgetary constraint.
9 9 3 9
𝑑𝑈 − 𝑥2 + 18 2
𝑑 𝑈 − 9 − 𝑥2 𝑥2 − − 𝑥2 + 18 (9 − 3𝑥2 )
= 2 =0 2 2 2
3 → 2 = 2
𝑑𝑥2 9 − 𝑥2 𝑥2 𝑑𝑥 2 3
2 9 − 𝑥2 𝑥2
2
𝑑2 𝑈(4)
→ 2 < 0 → 𝑚𝑎𝑥
𝑑𝑥2
EXERCISES
Exercise 5:
You work for a soda company which
produce 330ml cans. Cans are made
of aluminium which is quite expensive.
Your manager asks you to find the
optimal dimensions for a can to use
the least possible aluminium.
(Assume that a can is a perfect cylinder).
EXERCISES
Exercise 5:
You work for a soda company which produce 500ml cans. Cans are made
of aluminium which is quite expensive. Your manager asks you to find the
optimal dimensions for a can to use the least possible aluminium.
(Assume that a can is a perfect cylinder).
𝐴𝑟𝑒𝑎 𝑜𝑓 = 𝜋𝑟 2
𝒓 𝒉
𝑃𝑒𝑟𝑖𝑚𝑒𝑡𝑒𝑟 𝑜𝑓 = 2𝜋𝑟
EXERCISES
𝒓
𝑨𝒓𝒆𝒂 = 𝝅𝒓𝟐
𝒉
𝑽𝒐𝒍𝒖𝒎𝒆 = 𝝅𝒓𝟐 ∗ 𝒉
EXERCISES
EXERCISES
𝒉 𝑨𝒓𝒆𝒂 = 𝟐𝝅𝒓 ∗ 𝒉 𝒉
Exercise 5:
You work for a soda company which produce 330ml cans. Cans are made
of aluminium which is quite expensive. Your manager asks you to find the
optimal dimensions for a can to use the least possible aluminium.
(Assume that a can is a perfect cylinder).
Exercise 5:
You work for a soda company which produce 330ml cans. Cans are made
of aluminium which is quite expensive. Your manager asks you to find the
optimal dimensions for a can to use the least possible aluminium.
(Assume that a can is a perfect cylinder).
Exercise 5:
You work for a soda company which produce 330ml cans. Cans are made
of aluminium which is quite expensive. Your manager asks you to find the
optimal dimensions for a can to use the least possible aluminium.
(Assume that a can is a perfect cylinder).
4𝜋𝑟 3 = 0.66
𝑟 = 0.37 𝑑𝑚 = 37𝑚𝑚
Check that it is a min…
EXERCISES
Exercise 5:
You work for a soda company which produce 330ml cans. Cans are made
of aluminium which is quite expensive. Your manager asks you to find the
optimal dimensions for a can to use the least possible aluminium.
(Assume that a can is a perfect cylinder).
0.33
𝑟 = 0.37 𝑑𝑚 = 37 𝑚𝑚 ℎ= 2
= 0.75 𝑑𝑚 = 75 𝑚𝑚
𝜋𝑟