Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction
The tools of linear algebra are used throughout finance to simplify notation and
calculations. In this paper I will describe the process of Markowitz Style Portfolio
Optimization and utilize linear algebra to greatly simplify the process. Also, I have
constructed an excel file which constructs the optimal portfolio for a given asset universe.
This paper is intended as a useful guide for using matrices in portfolio optimization and I
am in no way claiming this is the first guide of its nature.
Quick Review of Statistics1
We will need to calculate the average (mean) return for assets, which can be calculated as
follows:
!
! !
!!!
Where ! is the probability that the return of the asset will be ! . The variance of returns
can be calculated as follows:
=
Where is all the possible returns of the asset. Finally, the covariance of two assets
returns is defined as:
! , ! =
Where x and y are all the possible values of the returns on assets x and y. From this
definition, we can see that ! , ! = ! , ! .
Mean-Variance Criteria
Throughout this paper, we will assume that returns are normally distributed meaning that
the distribution of returns can be fully described by the mean and variance of the returns.2
The expected return is defined as the mean return. This assumption naturally leads to
investor utility (which the investor attempts to maximize) depending solely on these two
criteria in the following standard two-moment utility function.3
= ! !!
Where ! is the expected return of security and !! is the variance of the returns of
security . The in this equation is a measure of risk aversion. There is a lot of debate
as to the validity of this assumption because empirical evidence suggests returns may not
be normally distributed; however, for ease of exposition, I will carry this assumption
throughout this paper.
Michael. Lecture. Economics 423 Financial Markets. Chapel Hill, NC.
Aguilar, Michael. Lecture. Economics 423 Financial Markets. Chapel Hill, NC.
3
Ibid
1Aguilar,
2
To form optimal portfolios, we have to have forecasts for the expected returns of each
asset, the variance of each of those returns, and also the covariance of the returns for all
of the assets in the universe.
Asset Allocation
Traditional security selection involves picking a few of your favorite securities and
investing heavily in those few securities. With the rise of modern portfolio theory,
however, the idea of diversification became more apparent in that by increasing a
portfolio by only a few assets (assuming asset returns have low or negative correlation)
one can significantly reduce the portfolio variance. Meir Statman, in 1987, suggested
that the full benefits of diversification required a portfolio of around 30-40 stocks rather
than the previously thought of 10 or so stocks.4
Markowitz Portfolio Optimization
In 1952, Harry Markowitz first developed the idea of portfolio optimization, where we
maximize expected return given some maximum allowed variance or equivalently (and
more intuitively), minimizing variance subject to some minimum expected return.5
To find optimal portfolios, we use three steps:6
1) We find the efficient sets of risky portfolios (portfolio of risky assets) by solving a
constrained optimization problem where we find the portfolio weights that give us
the minimal portfolio variance subject to the expected return being equal to some
target rate of return.
2) We then find the best of these risky portfolios by looking for the portfolio that
maximizes the Sharpe Ratio:
=
Where , and are defined as above and ! is the risk free rate. Maximizing
the Sharpe Ratio gives us the highest risk reward tradeoff. The risky portfolio
that maximizes this ratio is then combined with the risk free rate. In practice, the
risk free rate is the 90-day Treasury bill.
3) Finally, we find the optimal allocation between the risky portfolio and the risk
free rate that maximizes the investors utility.
Because this paper is intended to show the benefits of using linear algebra in portfolio
optimization, I will only derive mathematically the first step since this is where linear
algebra is most useful. I will show graphically how to complete steps 2) and 3).
Throughout this paper, I will use ! and ! to represent the return on the risky portfolio
and the complete portfolio (risky portfolio mixed with risk free rate), respectively.
4
Statman, Meir. How many stocks make a diversified portfolio. Journal of Financial and Quantitative
Analysis. Volume 22, No. 3 (1987): pp. 353-363.
5
Markowitz, Harry. Portfolio Selection. The Journal of Finance Volume 7, No. 1. (1952), pp.77-91.
6
Aguilar, Michael. Lecture. Economics 423 Financial Markets. Chapel Hill, NC.
Similarly, ! and ! represent the standard deviation of the risky and complete portfolios,
respectively.
Step One-Construct Efficient Risky Portfolios
The first step in the process of minimizing variance for some target return is constructing
the expected return and variance for the risky portfolio from expected returns and
variances for the assets comprising the portfolio.
Expected Return and Variance of Risky Portfolio
The risky portfolio expected return is simply the weighted average of expected returns on
the securities within the portfolio.
!
! =
! [! ]
!!!
= where =
, =
!
[! ]
!
Where ! is the portfolio weights for security and ! is the expected return for
security . The variance of the risky portfolio can be derived as follows:
!
!
!!! !
!
!!!
8
!
!!! ! ! !"
!!
!!
! ! !" = !
=
!!! !!!
!!
!!
!!
!!
!
= !
!
! ! =
!!!
! [! ] = 0
!!!
! = 1
!!!
! 1 = 0
!!!
1
!
1
Constrained Optimization
We now have the problem set up where we need to minimize !! with respect to the two
constraints. In order to solve this, we will use a Lagrangian that will yield a system of
equations that we will solve using the tools of linear algebra.14
10
Aguilar, Michael. Lecture. Economics 423 Financial Markets. Chapel Hill, NC.
Zivot, Eric. "Portfolio Theory with Matrix Algebra." Washington University.
12
Aguilar, Michael. Lecture. Economics 423 Financial Markets. Chapel Hill, NC.
13
Zivot, Eric. "Portfolio Theory with Matrix Algebra." Washington University.
11
! , , ! , ! , ! =
! ! + !
! , ! + !
!!! !!!
!!!
! 1
!!!
= !
!!
!!
+ !
= !
!!
!
+ !
!! !
!
1
1
!
1
!
!
!
!
! !! + + ! !!
+ ! ! ! + + ! !
! !! + + ! !!
+ ! ! + + ! 1
= !! !! + + ! ! !! + + ! ! !! + + !! !! + ! ! ! + + ! !
+ ! ! + + ! 1
Because is symmetric:
!
! ! !" + ! ! ! + + ! !
+ ! ! + + ! 1
!!! !!!
2! !! + + 2! !!
!
=
+ !
2! !! + + 2! !!
!
+ !
14
15
Aguilar, Michael. Lecture. Economics 423 Financial Markets. Chapel Hill, NC.
Zivot, Eric. "Portfolio Theory with Matrix Algebra." Washington University.
= 2 + ! + ! 1
The other two FOCs are trivial thus we have the following three FOCs.
0=
= 2 + ! + ! 1
0=
=
!
0=
= 1 1
!
The FOCs give us + 2 linear equations and + 2 unknowns. This system of equations
can be depicted using matrices as follows:
2
!
1!
0
0
1
0
0
0
! =
!
1
- Or =
Where:
2
= !
1!
0
0
1
0
0 , = ! & =
!
0
1
Asset
IYM
IDU
4.20%
-0.66%
7
TLT
1.45%
Variance-Covariance Matrix:
IYM
IDU
TLT
IYM
0.000150146
3.05394E-05
-5.88111E-05
IDU
3.05394E-05
3.62022E-05
-1.53612E-05
TLT
-5.88111E-05
-1.53612E-05
7.96458E-05
For this example, assume there is a required ! of 5%. Plugging these values into the
formula for above and multiplying !! by I got the portfolio weights equal to:
Asset
IYM
IDU
TLT
Portfolio
Weights
0.829647538
-0.600511587
0.770864049
Asset
E[R]
4.20%
-0.66%
1.45%
Asset
Portfolio
Variance
of
Variance
E[r}
Optimal
Portfolio
0.0150%
5.00%
0.00723%
0.0036%
0.0080%
I also have plotted several efficient portfolios and connected them to form the efficient
frontier (line containing efficient portfolios).
The benefits of diversification are obvious when looking at the efficient frontier.
Combining the three assets into a portfolio can give you a higher expected return with a
lower variance than any of the three individual assets can by themselves. The benefits of
diversification increase as the assets become less correlated with each other, and the
curvature of the efficient frontier increases.
Step 2-Mix Risky Portfolio with Risk Free Rate to Form Capital Markets Line
We now have a set of efficient portfolios called the efficient frontier. The next step in
portfolio optimization is mixing these efficient portfolios with the risk free rate to form a
complete portfolio. The complete portfolio will depend on the portfolio weight of the
risky portfolio, , and the portfolio weight of the risk free rate, 1 . As we mix the
risky portfolio with the risk free rate, we form a line between the two called the Capital
Markets Line (CML). We will derive this line now. The expected return of the complete
portfolio is derived as follows:16
! = ! + 1 !
! = ! + 1 ! = ! + ! !
The variance of the complete portfolio can be found by:17
! = [ ! + ! ! = !
= ! !!
!
!
! !
!
This Capital Markets Line can be formed from any risky portfolio, but, given our utility
function earlier, the steepest CML would yield the highest utility. Therefore, as
illustrated below, the optimal risky portfolio with which to construct our CML is the one
in which the CML is tangent to the efficient frontier because this is the steepest possible
CML (highest Sharpe ratio).19
20
16
Aguilar, Michael. Lecture. Economics 423 Financial Markets. Chapel Hill, NC.
Ibid
18
Ibid
19
Aguilar, Michael. Lecture. Economics 423 Financial Markets. Chapel Hill, NC.
20
"Efficient Frontier." Wikipedia. Wikimedia Foundation, 29 Mar. 2013. Web. 08 Apr. 2013.
17
We have now constructed a line consisting of optimal portfolios. Now all that remains is
to find the point on the CML that maximizes utility for a given individuals risk
preferences.
Step 3-Allocate Between Risky Portfolio and Risk Free Rate to Maximize Utility
As mentioned earlier, we assume each investor has a two-moment utility function
described earlier. We can rearrange this formula to form indifference curves for a given
utility level as follows:21
= !
= + !
The indifference curves are clearly upward sloping because as the standard deviation of
the portfolio increases, the investor must be compensated in the form of a higher .
The indifference curves are illustrated in the image below.
22
The indifference curves utility increase as we move to higher return and lower risk (up
and to the left in graph). It is clear that the portfolio that would give the investor the
highest utility is the portfolio on the CML that is tangent to the utility curves above. I
have intentionally described this qualitatively rather than quantitatively because my focus
for this paper is the first step of Markowitz Portfolio Optimization.
Excel Program
I have also created an excel file which automates the process of minimizing portfolio
variance given some target expected return (Step 1). This file uses the assumption that
past performance of an assets return is a good indicator of future returns. As I have state
21
22
Aguilar, Michael. Lecture. Economics 423 Financial Markets. Chapel Hill, NC.
Harry Markowitz." Wikipedia. Wikipedia Foundation, 20 Mar. 2013. Web. 8 Apr. 2013.
10
many times, this assumption is solely for ease of exposition and is not meant to be
indicative of reality. The instructions on how to use the file are located on its cover page.
Conclusion
To summarize, the tools of linear algebra are incredibly useful in portfolio theory. Not
only is the exposition of the problems simplified, but both the difficulty and quantity of
calculations are greatly reduced as well.
11
12