Topic #10 Markowitz Portfolio Theory: Reading: Luenberger Chapter 6, Sections 6 - 10
Topic #10 Markowitz Portfolio Theory: Reading: Luenberger Chapter 6, Sections 6 - 10
Primbs/Investment Science 1
The Markowitz Model
Markowitz’s Message
Primbs/Investment Science 2
Picture of Markowitz
For a given mean return, you would like to
minimize your risk or the variance.
r
x
Minimum variance point for a given mean return
Primbs/Investment Science 3
The Markowitz Model
Markowitz formulated the problem of being on the
efficient frontier as an optimization.
Primbs/Investment Science 4
Markowitz Optimization
1 n
Minimize:
2 i , j 1
wi w j ij = 1/2 (Variance)
n
Subject to: wr r
i 1
i i p = Mean Return
w
i 1
i 1 = Weights sum to 1.
Primbs/Investment Science 5
The Markowitz Model
Markowitz’s Message
Primbs/Investment Science 6
Solving a General Optimization
Min: f ( x, u )
s.t.: g1 ( x, u ) c1
g 2 ( x , u ) c2
Min: f ( x, u )
s.t.: g1 ( x, u ) c1 0
g 2 ( x, u ) c2 0
Primbs/Investment Science 7
Solving a General Optimization
Min: f ( x, u )
s.t.: g1 ( x, u ) c1
g 2 ( x , u ) c2
Min: f ( x, u )
s.t.: g1 ( x, u ) c1 0 1
g 2 ( x, u ) c2 0 2
Primbs/Investment Science 8
Solving a General Optimization
Min: f ( x, u )
s.t.: g1 ( x, u ) c1
g 2 ( x , u ) c2
L( x, u, 1 , 2 ) f ( x, u ) 1 ( g1 ( x, u ) c1 ) 2 ( g 2 ( x, u ) c2 )
Primbs/Investment Science 9
Solving a General Optimization
Min: f ( x, u )
s.t.: g1 ( x, u ) c1
g 2 ( x , u ) c2
L f g g L
1 1 2 2 0 g1 ( x, u ) c1 0
x x x x 1
L f g g L
1 1 2 2 0 g 2 ( x, u ) c2 0
u u u u 2
Primbs/Investment Science 10
Solving a General Optimization
Min: f ( x, u )
s.t.: g1 ( x, u ) c1
g 2 ( x , u ) c2
L f g g L
1 1 2 2 0 g1 ( x, u ) c1 0
x x x x 1
L f g g L
1 1 2 2 0 g 2 ( x, u ) c2 0
u u u u 2
Primbs/Investment Science 11
Markowitz Optimization
1 n
Minimize:
2 i , j 1
wi w j ij = 1/2 (Variance)
n
Subject to: wr r
i 1
i i p = Mean Return
w
i 1
i 1 = Weights sum to 1.
Primbs/Investment Science 12
Markowitz Optimization
Step 1
1 n
Minimize:
2 i , j 1
wi w j ij
n
Subject to: wr r
i 1
i i p 0
w 1 0
i 1
i
Primbs/Investment Science 13
Markowitz Optimization
Step 2
1 n
Minimize:
2 i , j 1
wi w j ij
n
Subject to: wr r
i 1
i i p 0
w 1 0
i 1
i
Primbs/Investment Science 14
Markowitz Optimization
Step 3
1 n
Minimize:
2 i , j 1
wi w j ij
n
Subject to: wr r
i 1
i i p 0
w 1 0
i 1
i
Primbs/Investment Science 15
Markowitz Optimization
Step 4
Form the Lagrangian:
1 n n n
L( w, , ) wi w j ij wi ri rp wi 1
2 i , j 1 i 1 i 1
wr r
i 1
i i p
These equations
characterize efficient
n
funds.
w
i 1
i 1
Primbs/Investment Science 16
Markowitz Optimization
Step 5
wr r
i 1
i i p
These equations
characterize efficient
n
funds.
w
i 1
i 1
Primbs/Investment Science 17
The Markowitz Model
Markowitz’s Message
Primbs/Investment Science 18
The Two-Fund Theorem
Let’s make the following assumptions:
Primbs/Investment Science 19
Importance of the Two Fund
Theorem
Another Efficient
x
r Fund
x Fund 2
x It is just a portfolio of Fund 1 and Fund 2.
Fund 1
Primbs/Investment Science 20
The Two-Fund Theorem
Theorem: Investors seeking efficient portfolios need only
invest in combinations of two efficient funds.
Proof:
Let rP1 , 1 , 1 w1 ( w11 , w12 , , w1n )
and rP2 , 2 , 2
w 2
( w1
2
, w2
2
, , w 2
n)
1: ij w ri 0
1
j
1 1
2:
j 1
ij w2j 2 ri 2 0
j 1
n n n
w
n
w r r wi1 1 w r r 1
2 2 2
1 1
i i P i
i i P i 1
i 1 i 1 i 1
Primbs/Investment Science 21
The Two-Fund Theorem
1: 2: 3:
n
n n
w 3
3
r 3
0
ij 2 2 2
w ri
1
j 0 1
ij w r1
i 0 ij j
j i
j 1 j 1
j 1 n n
w
n n
n
1
n 3
w r r
3 3
w r r
w r r w 1
2 2 2
1 1 1
i i i P
w 1i i i P i
i i P i 1 i 1
i 1 i 1 i 1
i 1
Primbs/Investment Science 22
The Two-Fund Theorem
1: 2: 3:
n
n n
w 3
3
r 3
0
ij 2 2 2
w ri
1
j 0 1
ij w r
1
i 0 ij j
j i
j 1 j 1
j 1 n n
w
n n
n
1
n 3
w r r
3 3
w r r
w r r w 1
2 2 2
1 1 1
i i i P
w 1i i i P i
i i P i 1 i 1
i 1 i 1 i 1
i 1
w3 w1 (1 ) w2
n
3 1 (1 )2
ij j i
w
j 1
3
3
r 3
3 1 (1 ) 2
n
ij (w1j (1 ) w2j ) (1 (1 )2 )ri ( 1 (1 ) 2 )
j 1
n n
ij w j ri (1 ) ij w j ri 0
1 1 1 2 2 2
j 1 j 1
Primbs/Investment Science 23
The Two-Fund Theorem
1: 2: 3:
n
n n
w 3
3
r 3
0
ij 2 2 2
w ri
1
j 0 ij w
1
ri
1
0 ij j j i
j 1 j 1
j 1 n n
w
n n
n
1
n 3
w r r
3 3
w r r
w r r w 1
2 2 2
1 1 1
i i i P
w 1i i i P i
i i P i 1 i 1
i 1 i 1 i 1
i 1
w3 w1 (1 ) w2
n
3 1 (1 )2
i ri
w 3
i 1
3 1 (1 ) 2
n
(wi1 (1 ) wi2 )ri
i 1
n 1 n 2
wi ri (1 ) wi ri rP (1 )rP rP
1 2 3
i 1 i 1
Primbs/Investment Science 24
The Two-Fund Theorem
1: 2: 3:
n
n n
w 3
3
r 3
0
ij 2 2 2
w ri
1
j 0 ij
1
w ri
1
0 ij j j i
j 1 j 1
j 1 n n
w
n n
n
1
n 3
w r r
3 3
w r r
w r r w 1
2 2 2
1 1 1
i i i P
w 1i i i P i
i i P i 1 i 1
i 1 i 1 i 1
i 1
w3 w1 (1 ) w2
n 3 1 (1 )2
i
w 3
i 1
3 1 (1 ) 2
n
wi1 (1 ) wi2
i 1
n 1 n 2
wi (1 ) wi (1 ) 1
i 1 i 1
( w3 , 3 , 3 ) is efficient!
Primbs/Investment Science 25
The Two-Fund Theorem
Solutions
Min Variance Mean Return = 25%
w1 0.3
0.413793103 -0.244898
w2 0.172413793 0.5102041
w3 0.413793103 0.7346939
0.25
Lagrange -0.01034483 0.0306122
Mu -0.244898 Efficient
0.2
Mean Return0.167241379 0.25 Frontier
Mean Return
Primbs/Investment Science 26
The Markowitz Model
Markowitz’s Message
Primbs/Investment Science 27
Inclusion of a Risk-Free Asset
We have assumed that all the assets are risky.
r
rf
Primbs/Investment Science 28
Inclusion of a Risk-Free Asset
What happens when we combine the risk free asset
with a risky portfolio
risky asset: ( r , 2
)
Primbs/Investment Science 29
Inclusion of a Risk-Free Asset
For this portfolio we have
(mean, standard deviation)= (rf (1 )r , (1 ) )
r
x
(r , 2 )
rf
Primbs/Investment Science 30
Expanded Feasible Region
r F
x Tangent to the feasible region of risky funds.
rf
Primbs/Investment Science 31
The Markowitz Model
Markowitz’s Message
Primbs/Investment Science 32
The One-Fund Theorem
Let’s make the following assumptions:
Primbs/Investment Science 33
The One-Fund Theorem
Theorem: There is a single fund F of risky assets such that
any efficient portfolio can be constructed as a
combination of the fund F and the risk-free asset.
r F
x Tangent to the feasible region of risky portfolios.
rf
Primbs/Investment Science 34
Computation of the One-Fund
The one-fund is the fund of risky assets that results in the maximum slope
with the risk-free rate.
r F
x Tangent to the feasible region of risky funds.
rf
Primbs/Investment Science 35
Computation of the One-Fund
The one-fund is the fund of risky assets that results in the maximum slope
with the risk-free rate.
n
Maximize this slope
rFund rf
wi (ri rf )
slope max i 1
1/ 2
Fund wi
n
wi w j ij
i , j 1
Take derivative wrt. wk for k=1...n and set equal to zero:
1/ 2 1/ 2
n n
n n
wi w j ij (rk rf ) wi (ri rf ) wi w j ij w j kj
i , j 1 i 1 i , j 1 j 1 0
n
wi w j ij
i , j 1
Primbs/Investment Science 36
Computation of the One-Fund
1/ 2 1 / 2
n n n n
wi w j ij (rk rf ) wi (ri rf ) wi w j ij w j kj
i , j 1 i 1 i , j 1 j 1 0
n
wi w j ij
i , j 1
n n
wi (ri rf ) w j kj
i 1 j 1 0
(rk rf )
n
wi w j ij
i , j 1
n
wi (ri rf ) n
Let
i 1 (rk rf ) w j kj 0
n j 1
wi w j ij
i , j 1 for k=1,...,n
Primbs/Investment Science 37
Computation of the One-Fund
n
(rk rf ) w j kj 0
for k=1,...,n
j 1
n
w
j 1
j kj (rk rf ) for k=1,...,n
Let: w j v j v
j 1
j kj (rk rf ) for k=1,...,n
vj
Solve for j and normalize wj n
v
i 1
i
Markowitz’s Message
Primbs/Investment Science 39
The Message of Markowitz
The Two-Fund and One-Fund theorems are important
consequences of Markowitz.
Primbs/Investment Science 40
Problems
Primbs/Investment Science 41
The two-fund theorem:
Primbs/Investment Science 42
The one-fund theorem:
a) 30%
b) 10%
Primbs/Investment Science 43
Optimizations:
r1 0.1 11 0.3
12 0.01
r2 0.2 22 0.4
There are two assets in the market with means and covariances given
above. Write the optimization problem for a portfolio with minimum
variance subject to a mean return constraint of 18%. Write the necessary
conditions for the solution. Solve them.
Primbs/Investment Science 44
Appendix 1:
Markowitz Theory using
Linear Algebra
Primbs/Investment Science 45
The Markowitz Model
Constrained Optimization
Markowitz’s Message
Primbs/Investment Science 46
Picture of Markowitz
For a given mean return, you would like to
minimize your risk or the variance.
r
x
Minimum variance point for a given mean return
Primbs/Investment Science 47
The Markowitz Model
Markowitz formulated the problem of being on the minimum
variance set as an optimization.
Assume there are n risky assets with r1
r1
r r
r 2 r 2
Returns: r1 , r2 , , rn
rn rn
Mean returns: r1 , r2 , , rn
11 12 1n
Covariances: ij for i,j=1,...,n 22 2 n
21
n1 n 2 nn
Primbs/Investment Science 48
Markowitz Optimization
1 n
Minimize:
2 i , j 1
wi w j ij = 1/2 (Variance)
n
Subject to: wr r
i 1
i i p = Mean Return
w
i 1
i 1 = Weights sum to 1.
Primbs/Investment Science 49
Markowitz Optimization
Linear Algebra
Minimize: 1 T
w w = 1/2 (Variance)
2
wT 1 1 = Weights sum to 1.
Primbs/Investment Science 50
The Markowitz Model
Constrained Optimization
Markowitz’s Message
Primbs/Investment Science 51
Constrained Optimization
Min: f ( x, u )
s.t.: g ( x, u ) c
f f
At a minimum, variations in df dx du 0
f(x,u) are equal to zero. x u
1
g g
Solve for du in terms of dx. du dx
u x
Primbs/Investment Science 52
Constrained Optimization
f f
At a minimum, variations in df dx du 0
f(x,u) are equal to zero. x u
1
However, only variations that g g
preserve the constraint are allowed.
du dx
u x
f f g 1 g
Substitute into df df dx
x u u x
1
f f g g
We are at a minimum if: 0
(and constraint is satisfied) x u u x
Primbs/Investment Science 53
Constrained Optimization
1
f f g g
We are at a minimum if: 0
(and constraint is satisfied) x u u x
1
Let’s rewrite this f g f g
condition and 0
u u x x
Primbs/Investment Science 54
The Lagrangian
Min: f ( x, u )
s.t.: g ( x, u ) c
L f g
Setting the partial of 0
the Lagrangian equal x x x
to zero gives the L f g Optimality
correct optimality 0 Conditions
conditions u u u
L
g ( x, u ) c 0
Primbs/Investment Science 55
The Markowitz Model
Constrained Optimization
Markowitz’s Message
Primbs/Investment Science 56
Derivatives using Linear Algebra
x
( xT A) AT
x ( Ax) A
x (a T x) a T
x ( xT Ax) x T A x T AT
x
( x T Ax) 2 x T A if A is symmetric (i.e. A=AT).
Note: I use the convention that derivatives (i.e. gradients) are row vectors.
This means the chain rule works from left to right:
Let: y Bx then
y
x ( y Ax) y A x A
T T
( Bx)T A xT AT B
T T
xT B T A xT AT B
x
Primbs/Investment Science 57
The Markowitz Model
Constrained Optimization
Markowitz’s Message
Primbs/Investment Science 58
A Constrained Quadratic
Optimization
Min: 1
2 xT Ax Assume A is symmetric
s.t.: bT x c
Take partials:
L Ax b 0
( x , ) x T A b T 0 transpose
x
L bT x c
( x, ) x T b c 0
Solve to find optimum.
Primbs/Investment Science 59
The Markowitz Model
Constrained Optimization
Markowitz’s Message
Primbs/Investment Science 60
Markowitz Optimization
Linear Algebra
Minimize: 1 T
w w = 1/2 (Variance)
2
wT 1 1 = Weights sum to 1.
Primbs/Investment Science 61
Markowitz Optimization
1 T
Minimize: w w Lagrange Mult.
2
Subject to: wT r rp 0
wT 1 1 0
1 T
Lagrangian: L( w, , ) w w ( wT r rp ) ( wT 1 1)
2
T
L
w r 1 0
w
Optimality L
T
r w rp 0
T
Conditions
T
L
1T w 1 0
Primbs/Investment Science 62
The Structure of Optimality
w r 1 0
Optimality
Conditions r T w rp 0
1 w 1 0
T
r 1 w 0
Rewrite as: r T
0 0 rP
1T 0 0 1
Primbs/Investment Science 63
Solving the Markowitz Problem
r 1 w 0
Rewrite as: r T
0 0 rP
1T 0 0 1
Given rp
1
Solve for optimal w w r 1 0
(and )by: r T 0 0 r
P
1T 0 0 1
Primbs/Investment Science 64
The Two Fund Theorem
Let (w1,1,1) and (w2,2,2) be Markowitz solutions
1
r r 2
corresponding to P and P , respectively. Then the solution to
3
the Markowitz problem for rP is:
(w1,1,1)= (w1,1,1)+(1-)(w1,1,1)
where solves: r 3 r 1 (1 ) r 2
P P P
Proof: 1
1
w3 r 1 0 r 1 0 0
1
r T 0 0 r 3 r T 0 0 2
rP (1 ) rP
3 P 1
3 1T 0 0 1 1T 0 0 1
1 1
r 1 0 r 1 0 w1 w2
r T 0 0 r 1 (1 ) r T
P 0 0 r 2 (1 )
P 1 2
1T 0 0 1 1T 0 0 1 1 2
Primbs/Investment Science 65
Importance of Two Fund Theorem
Theorem: Investors seeking efficient portfolios need only
invest in combinations of two efficient funds.
Another Efficient
x
r Fund
x Fund 2
x It is just a portfolio of Fund 1 and Fund 2.
Fund 1
Only two efficient funds need to exist, and everyone can
invest in them!
Primbs/Investment Science 66
The Markowitz Model
Constrained Optimization
Markowitz’s Message
Primbs/Investment Science 67
Inclusion of a Risk-Free Asset
We have assumed that all the assets are risky.
r
rf
Primbs/Investment Science 68
Inclusion of a Risk-Free Asset
What happens when we combine the risk free asset
with a risky portfolio
risky asset: ( r , 2
)
Primbs/Investment Science 69
Inclusion of a Risk-Free Asset
For this portfolio we have
(mean, standard deviation)= (rf (1 )r , (1 ) )
r
x
(r , 2 )
rf
Primbs/Investment Science 70
Expanded Feasible Region
r F
x Tangent to the feasible region of risky funds.
rf
Primbs/Investment Science 71
The Markowitz Model
Constrained Optimization
Markowitz’s Message
Primbs/Investment Science 72
The One-Fund Theorem
Theorem: There is a single fund F of risky assets such that
any efficient portfolio can be constructed as a
combination of the fund F and the risk-free asset.
r F
x Tangent to the feasible region of risky portfolios.
rf
Primbs/Investment Science 73
Derivation of the One-Fund
Theorem
Let w be the weights on risky assets, and w0 the weight on the risk free asset.
Minimize: 1 T
w w = 1/2 (Variance)
2
Subject to: w0 rf wT r rp = Mean Return
w0 wT 1 1 = Weights sum to 1.
w0 1 wT 1
Primbs/Investment Science 74
Derivation of the One-Fund
Theorem
Minimize: 1 T
w w
2 Lagrange Mult.
Subject to: rf w (r rf 1) rp
T
1 T
Lagrangian: L( w, ) w w (rf wT (r rf 1) rp )
2
T
L
Optimality w (r rf 1) 0
w
Conditions T
L
rf (r rf 1) w rp 0
T
Primbs/Investment Science 75
Derivation of the One-Fund
Theorem
T
L
Optimality w (r rf 1) 0
w
Conditions T
L
rf (r rf 1) w rp 0
T
w 1 (rf 1 r )
But these weights won’t sum to 1. So normalize to sum to 1.
1 1
w T ( 1
( r f 1 r )) ( 1
(rf 1 r ))
1 ( (rf 1 r ))
1 1
1 ( (rf 1 r ))
T
Primbs/Investment Science 76
Appendix 2:
When the 1-Fund and 2-Fund
Theorems Hold
Primbs/Investment Science 77
When the two fund theorem holds
The Two Fund Theorem
Primbs/Investment Science 78
No Short Selling
Minimize: 1 T
w w = 1/2 (Variance)
2
wT 1 1 = Weights sum to 1
wi 0 = No short selling
Primbs/Investment Science 79
No Short Selling
1 T
L( w, , ) w w ( wT r rp ) ( wT 1 1) i wi
2 i
1T w 1
wi 0
i 0 This condition is not linear in
w 0 ( i , wi )
i i
Primbs/Investment Science 80
When the One-Fund Theorem Holds
Risk Free Asset:
Short Sell No Short Sell
Risky Assets
Short Sell Yes No
Primbs/Investment Science 81
Pictures: Short Selling of Risk Free
Allowed
Efficient Frontier
r F
x Tangent to the feasible region of risky portfolios.
(Doesn’t matter if this is under short selling or no
rf short selling of risky assets!)
Primbs/Investment Science 82
When the One-Fund Theorem Holds
Risk Free Asset:
Short Sell No Short Sell
Risky Assets
Short Sell Yes No
Primbs/Investment Science 83
Pictures: Short Selling of Risk Free
Not Allowed
Efficient Frontier
r F
x Tangent to the feasible region of risky portfolios.
(Doesn’t matter if this is under short selling or no
rf short selling of risky assets!)
Primbs/Investment Science 84
General Optimization
1 T
Minimize: w w = 1/2 (Variance)
2
r
Subject to: f wT
(r rf 1) rp = Mean Return
wi 0 = No Short Risky
1 1T w 0 = No Short Risk-free
Primbs/Investment Science 85
First Order Optimality Conditions
L
w (r rf 1) 1 0
w
rf wT (r rf 1) rp 0
wi 0 i 0 wi i 0
11 w 0
T
0 (1 1T w) 0
Primbs/Investment Science 86
Allow Shorting of the Risk-Free
L
w (r rf 1) 1 0
w
rf wT (r rf 1) rp 0
wi 0 i 0 wi i 0
11 w 0
T
0 (1 1T w) 0
L
w (r rf 1) 0
w
rf wT (r rf 1) rp 0
wi 0 i 0 wi i 0
Primbs/Investment Science 88
Allow Shorting of Risky
L
w (r rf 1) 1 0
w
rf wT (r rf 1) rp 0
wi 0 i 0 wi i 0
11 w 0
T
0 (1 1T w) 0
L
w (r rf 1) 1 0
w
rf wT (r rf 1) rp 0
1 1T w 0 0 (1 1T w) 0
Primbs/Investment Science 90
Appendix 3:
Lagrange Multipliers and the
Objective Function
Primbs/Investment Science 91
Constrained Optimization
Why is the derivative of the objective with respect to the constraint?
Min: f ( x, u ) f ( x, u )
s.t.: g ( x, u ) c g ( x, u ) c 0
f f
df dx du 0
Optimality Condition x u
g g
dg dx du dc 0
x u
Solve for du
1
g g g g
du dc dx du dc dx
u x u x
Primbs/Investment Science 92
Constrained Optimization
1
f f g g
So: df dx dc dx
x u u x
f f g 1 g f g
1
df dx dc
x u u x u u
1
f g f g
But: 0
u u u u
f g
df dx dc
x x
df
dc
Primbs/Investment Science 93