Professional Documents
Culture Documents
Seminar 4 Optimisation
Seminar 4 Optimisation
Seminar 4 Optimisation
and Probability
YU SHENG LOH
Optimisation
Optimisation
Maximising or minimising a given function
◦ Unconstrained
◦ Constrained
Unconstrained
◦ Maximisation is about finding the largest possible value of the function
◦ Minimisation about finding the smallest possible value
◦ And the input of the function that is associated with this value
Constrained
◦ Finding the maximum or minimum value of the function
◦ Subject to a given set of constraints on the inputs
Unconstrained Optimisation
Finding the maximum or minimum of a function 𝑦 = 𝑓(𝑥)
!"
To do so, we set =0
!#
!' "
To do so, we find !#'
!&
= 4𝑥 ' − 4𝑥
!#
= 4𝑥(𝑥 % − 1)
= 4𝑥(𝑥 + 1)(𝑥 − 1)
=0
𝑥 = 0, 1, 𝑜𝑟 − 1
Unconstrained Optimisation
To check if it is a maximum or minimum point, we check the second derivative of the function
!' &
!#'
= 12𝑥 % − 4
When 𝑥 = 0 𝑥=1 𝑥 = −1
!' & !' & !' &
= −4 < 0 =8>0 =8>0
!#' !#' !#'
It is a maximum point minimum point minimum point
𝑓 0 =0 𝑓 1 = −1 𝑓 −1 = −1
Constrained Optimisation
Optimisation with one or more constraints included
◦ Typically involving two or more variables
Find the maximum and/or minimum points of the function 𝑓 𝑥, 𝑦 = 𝑥 % 𝑦 − 2𝑥𝑦 % , subject to
the constraint 𝑥 + 𝑦 = 0.6
(& (&
= 2𝑥𝑦 − 2𝑦 % = 0, = 𝑥 % − 4𝑥𝑦 = 0
(# ("
Constrained Optimisation
Rewriting the expressions
(& (&
+2 = 𝑥 % − 4𝑥𝑦 + 4𝑥𝑦 − 4𝑦 % = 0
(" (#
𝑥 % − 4𝑦 % = 0
𝑥 + 2𝑦 𝑥 − 2𝑦 = 0
𝑥 = 2𝑦 𝑜𝑟 − 2𝑦
Constrained Optimisation
Subject to constraint 𝑥 + 𝑦 = 0.6
Suppose that an investor has to invest all his money into these two assets and he only cares
about returns and the standard deviation of returns. What should be the allocation between the
two assets?
Example in Finance
Let 𝑥) be the proportion of wealth invested in Asset A and 𝑥* be the proportion of wealth
invested in Asset B
To suit this investor’s needs, we need to minimise the variance of the portfolio, subject to the
constraint 𝑥) + 𝑥* = 1
Example in Finance
𝜎+% = 0.04% 𝑥)% + 0.06% 𝑥*% + 2(0.4)(0.04)(0.06)𝑥) 𝑥*
= 0.0016𝑥)% + 0.0036𝑥*% + 0.00192𝑥) 𝑥*
Expressing 𝑥* in terms of 𝑥)
𝜎+% = 0.0016𝑥)% + 0.0036 1 − 𝑥) % + 0.00192𝑥) (1 − 𝑥) )
= 0.0016𝑥)% + 0.0036 1 − 𝑥) % + 0.00192(𝑥) − 𝑥)% )
Example in Finance
To minimise the variance, we first differentiate it with respect to 𝑥)
!,('
= 2 ∗ 0.0016𝑥) + 2 ∗ (−1)0.0036(1 − 𝑥) ) + 0.00192 (1 − 2𝑥) )
!#)
The investor should invest 80.4878% of his wealth in Asset A and 19.5122% in Asset B
This gives a portfolio return of 5.5854% and standard deviation of 4.6527%
Lagrange Multiplier
Method of finding local maxima and/or local minima of a function subject to a set of constraints
◦ Particularly useful in constrained optimisation that are more challenging
ℒ 𝑥- , 𝑥% , … , 𝑥. , 𝜆- , … , 𝜆/ = 𝑓 𝑥- , 𝑥% , … , 𝑥. − 𝜆- 𝑔- 𝑥- , 𝑥% , … , 𝑥. − ⋯ − 𝜆/ 𝑔/ 𝑥- , 𝑥% , … , 𝑥.
Next, find the partial derivatives of the Lagrangian function with respect to all the variables and
set them equal to 0
Solve for the variables
Lagrange Multiplier
Optimise 𝑓 𝑥, 𝑦 = 𝑥 % + 𝑦 % subject to the constraint 𝑥𝑦 = 4
%# 1"
= Substituting the values back into the constraint
%" 1#
# "
"
=# 𝑥 𝑥 =4
𝑥% = 𝑦% 𝑥% = 4
𝑥=𝑦 𝑥 = ±2, 𝑦 = ±2
𝑓 𝑥, 𝑦 = 8
Example in Finance
Back to the example of an investor that requires a proportion of wealth 𝑥) to be invested in
Asset A and 𝑥* in Asset B
Minimise the variance of portfolio containing assets A and B
𝜎+% = 𝑥)% 𝜎)% + 𝑥*% 𝜎*% + 2𝑥) 𝑥* 𝜎)*
Subject to the constraint 𝑥) + 𝑥* = 1
(ℒ
= 2𝑥) 𝜎)% + 2𝑥* 𝜎)* − 𝜆
(#)
(ℒ
= 2𝑥* 𝜎*% + 2𝑥) 𝜎)* − 𝜆 =0
(#*
(ℒ
= 𝑥) + 𝑥* − 1
(1
Example in Finance
Subbing in the values of standard deviations and correlations given in the example, we have the
following equations
0.00528𝑥* − 0.00128𝑥) = 0
0.00528(1 − 𝑥) ) − 0.00128𝑥) = 0
0.00528 − 0.00528𝑥) − 0.00128𝑥) = 0
0.00528 − 0.00656𝑥) = 0
0.00656𝑥) = 0.00528
𝑥) = 0.804878
Example in Finance
Minimum Variance Portfolio
-
𝑚𝑖𝑛 𝒘2 𝚺𝐰
%
Subject to 𝒘2 𝟏̇ = 1
2. Using the method of Lagrange multiplier, find the optimal points of 𝑓 𝑥, 𝑦 = 𝑥 % 𝑦 − 2𝑥𝑦 % ,
subject to the constraints 𝑥 + 𝑦 = 0.6 and 𝑥 % + 𝑦 = 2.6