Note: This page provides formulas and some implications associated with mean-variance equilibrium. It is highly preliminary and may contain errors. In time, any errors will be corrected and the explanations expanded, especially those concerning the economics of the results and their practical implications.


The Optimality Condition with No Bounds

As before, we use the three-asset example for simplicity.

correlations (cc):

             cash   bonds  stocks
cash         1.00    0.40    0.15
bonds        0.40    1.00    0.35
stocks       0.15    0.35    1.00
standard deviations (sd):
cash           1.00
bonds          7.40
stocks        15.40
covariances (C):
               cash     bonds    stocks
cash          1.000     2.960     2.310
bonds         2.960    54.760    39.886
stocks        2.310    39.886   237.160

expected returns (e):

cash           2.80
bonds          6.30
stocks        10.80

Assume that portfolio x is optimal for risk tolerance t. Moreover, assume that each position in x is within any relevant bounds (that is, that no bounds are binding). For example, here the optimal portfolio (x) for a risk tolerance (t) of 25 is:

portfolio (x):

cash         0.0671
bonds        0.6021
stocks       0.3308 

We know from the conditions for optimality that for this portfolio, the marginal utility of each asset must be the same. Let z represent this common marginal utility.. For reasons that will become clear, we express utility and marginal utility in variance-equivalent terms:

u = t*ep - vp

mu(i) = t* dep/dx(i) - dvp/dx(i)

We know that:

mu(i) = t*e(i) - 2*C(i,:)*x

But optimality requires that this equal z. Hence for each asset i:

t*e(i) - 2*C(i,:)*x = z  

Moreover, for portfolio x to be a portfolio, the sum of its components must equal 1:

sum(x) = 1


x'*ones(n,1) = 1

where n is the number of assets

We can combine all these conditions in one matrix equation, which will prove useful in a number of contexts. First, we write all n of the first order conditions as:

t*e - 2*C*x = z*ones(n,1)

and re-arrange to give:

2*C*x + ones(n,1)*z = t*e

To this we will add the full investment constraint:

x'*ones(n,1) = 1

Define an {(n+1)*1} vector that includes the portfolio composition (x(1), x(2), ... x(n)) and z:

xx = [x ; z]

This allows us to "stack" all the conditions to give:

CC*xx = kk + t*ee


CC = [ 2*C ones(n,1) ; ones(1,n) 0]

kk = [zeros(n,1); 1]

ee = [e ; 0]

In our case:


    2.0000    5.9200    4.6200    1.0000
    5.9200  109.5200   79.7720    1.0000
    4.6200   79.7720  474.3200    1.0000
    1.0000    1.0000    1.0000         0






Finding an optimal portfolio with no bounds

It is straightforward to find an optimal portfolio if no upper and lower bounds are present or if any such bounds can be assumed to not be binding. Recall the conditions for optimality:

CC*xx = kk + t*ee

Multiplying both sides by the inverse of CC gives:

inv(CC)*CC*xx = inv(CC)*kk + t*inv(CC)*ee


xx = inv(CC)*kk + t*inv(CC)*ee

Now, let:

zp = inv(CC)*kk


rtswap = inv(CC)*ee


xx = zp + t*rtswap

In our example:

cash         1.0392
bonds       -0.0396
stocks       0.0004
z           -1.8458
cash        -0.0389
bonds        0.0257
stocks       0.0132
z            2.6648

Note that the asset positions in zp sum to 1.0. This must be the case since the final element in kk is 1.0 and the final row in CC has ones in every asset position. The effect is to require that the sum of the resulting holdings equals 1.0. Thus zp will always represent a true portfolio -- that is, holdings that sum to 1.0.

In contrast, note that the asset positions in rtswap sum to 0.0. This must be the case since the final element in ee is 0.0. Since the final row in CC contains ones in every asset position, the effect is to require that the sum of the resulting holdings equals 0.0. Thus rtswap will always represent a zero-investment strategy, or swap.

Consider now the optimal portfolio for an investor with zero tolerance for risk:

xx = zp + 0*rtswap

Thus zp is the optimal portfolio for an investor with no tolerance for risk. It must therefore be the minimum-variance portfolio.

Now consider the investor with a risk tolerance of 25. The optimum portfolio is:

xx = zp + 25*rtswap


    0.0671         1.0392      -0.9721
    0.6021        -0.0396       0.6418
    0.3308   =     0.0004  +    0.3303
   64.7731        -1.8458      66.6189

In effect, the investor takes 25 units of the rtswap. This, added to the initial portfolio, gives net holdings with relatively little cash, a substantial bond position and a smaller but still significant stock position.


Two-fund separation

Returning to the equation for an optimal portfolio:

xx = zp + t*rtswap

It is clear that every investor can be accommodated if there are two instruments in the world: a portfolio (zp) and a swap (rtswap). Moreover, the magnitude of the latter that an investor should take is proportional to his or her risk tolerance. Optimal holdings are thus linear functions of risk tolerance.

In fact, all investors can be accommodated by any two optimal portfolios. For example, consider xxa and xxb, which are optimal for risk tolerances of ta and tb, respectively:

xxa = zp + ta*rtswap
xxb = zp + tb*rtswap

Now, consider an investor with risk tolerance t. Assume that she invests pa in portfolio xxa and pb (=1-pa) in portfolio xxb. The resulting portfolio xx will be:

xx = pa*xxa + (1-pa)*xxb = zp + (pa*ta + (1-pa)*tb) * rtswap

This will in fact be optimal if:

t = pa*ta + (1-pa)*tb


pa = (t - tb) / (ta - tb)

As long as short positions are allowed (as is assumed here), any investor can choose any mix of portfolios xxa and xxb and be assured of optimality. Moreover, this will be the case as long as xxa and xxb are optimal for some levels of risk tolerance (i.e. are on the efficient frontier).

This relationship is termed the two-fund separation theorem since it allows the choice problem to be separated into (1) the selection of two efficient funds and (2) the selection of the appropriate combination of such funds for each investor.


Expected Return and Beta Values

The first-order conditions for the optimality of portfolio x for an investor with risk tolerance i requires that the following hold for every asset i:

t*e(i) - 2*C(i,:)*x = z

The second term is equivalent to the covariance of asset i with portfolio x. We may thus write:

t*e(i) - 2*Cix = z


e(i) = z/t + 2*Cix/t

Note that this means that the values of e(i) will plot on a straight line in a graph in which e(i) is plotted on the vertical axis and Cix is plotted on the horizontal axis. Moreover, the vertical intercept will equal z/t and the slope will equal 2/t (and the latter will be positive, so the line will be upward-sloping). Thus the higher the covariance with the optimal portfolio, the higher will be the expected return.

Since this is true for every asset i, it must also be true for every combination of assets, including portfolio x. Thus:

ex = z/t + 2*Cxx/t

But Cxx is the variance of x (Vx), so:

ex = z/t + 2*Vx/t

We may combine this with the equation for a single asset to obtain:

( e(i) - z/t ) / ( ex - z/t) = ( 2*Cix/t ) / ( 2*Vx/t)

Simplifying gives:

e(i) = z/t + ( ex - z/t ) * (Cix / Vx)

From regression theory, we can interpret Cix/Vx (the scaled covariance of asset i with the optimal portfolio x) as the beta value of i relative to x. Thus:

e(i) = z/t + ( ex - z/t) * Bix

This implies that there is a linear relationship between asset expected returns and their beta values with respect to the optimal portfolio. Note that this is a direct implication of the assumption that x is an optimal portfolio (and the lack of binding upper or lower bound constraints).


The Market Portfolio and the Security Market Line

Now consider a world in which all investors solve the problem formulated here but differ in both risk tolerance and wealth. Let there be m investors, with w(j) the relative wealth of investor j. Let ww be the {m*1} vector of these relative wealths (summing to 1.0). Similarly, let t(j) be investor j's risk tolerance and tt the {m*1} vector of all such risk tolerances. For our example let there be 2 investors (Dick and Jane) with:


Dick           10
Jane           25


Dick         0.30
Jane         0.70


We may represent all the optimal portfolios in an {n*m} matrix XX in which the j'th column contains the optimal portfolio for investor j. Here:

XX = zp*ones(1,m) + rtswap*tt'
               Dick      Jane
cash         0.6504    0.0671
bonds        0.2171    0.6021
stocks       0.1326    0.3308
z           24.8018   64.7731

Now consider xxm, the wealth-weighted average of the investors' portfolios:

xxm = XX*ww

This can be termed the market portfolio, since it contains all assets, in market-weighted proportions. Here:

Cash         0.2421
Bonds        0.4866
Stocks       0.2713
z           52.7817

Note that the last two equations can be combined to give:

xxm = zp*ones(1,m)*ww + rtswap*tt'*ww


xxm = zp*[ones(1,m)*ww] + rtswap*[tt'*ww]

The first expression in square brackets equals 1.0. And the second expression is simply a wealth-weighted average of the investors' risk tolerances. Define the latter as:

tm = tt'*ww


xm = zp + tm*rtswap

This indicates that the market portfolio is optimal for an investor with a risk tolerance equal to the wealth-weighted average investor risk tolerance (perhaps better termed the "societal risk tolerance"). Given this optimality it immediately follows that:

e(i) = z/tm + (em - z/tm) * Bim

where z is the value of z for an investor with risk tolerance tm.

If there is a riskless asset, z/tm will equal its return. We thus obtain the formula for the original CAPM:

e(i) = rf + (em - rf) * Bim

In the absence of a riskless asset, z/tm can be interpreted as the expected return on a zero-beta asset. Note that the slope of the resulting Security Market Line will equal the market risk premium and will generally be positive.

It is useful to compare an Investor's optimal strategy with that of an Investor who is average in every respect (here, t = tm). We know that the latter will hold the market portfolio. Thus:

xm = zp + tm*rtswap
x = zp + t*rtswap 
x - xm = (t - tm) * rtswap


x = xm + (t - tm) * rtswap

Thus an Investor's optimal portfolio will differ from the market portfolio by rtswap times the difference between the Investor's risk tolerance and that of the market (society). We can think of rtswap as the "tilt" away from the market per unit of difference between the investor's risk tolerance and that of the market. In this view, the two vectors that provide two-fund separation are the market portfolio and the swap given by vector rtswap.


Reverse Optimization

Recall the conditions for optimality of a portfolio x for an investor with risk tolerance t if no bounds are relevant. For each asset i:

t*e(i) - 2*C(i,:)*x = z 

Now, assume that the values of all covariances are known and that x can be assumed to be optimal for some investor, but that the risk tolerance of that investor is not known. Moreover, assume that the expected returns of two of the assets has been predicted, but the others have not. In our example, assume that the expected real return on Cash (asset 1) is 3.0% and the expected real return on Stocks (asset 3) is 8.0%. Then:

t*e(1) - 2*C(1,:)*x = z
t*e(3) - 2*C(3,:)*x = z

where t and z are unknown variables and all other values are specified. This is a system of two linear equations with two unknowns and hence can be solved simply. For example:

t*e(1) - 2*C(1,:)*x = t*e(3) - 2*C(3,:)*x


t = ( 2*(C(1,:) - C(3,:))*x ) / ( e(1) - e(3))

In this case:

t =


Substituting in the first of the two equations:

z = t*e(1) - 2*C(1,:)*x 


z =


We now know the values of t and z for which portfolio x is optimal. But from the conditions of optimality we also know what all the remaining asset expected returns must be. Recall that:

t*e(i) - 2*C(i,:)*x = z 


e(i) = ( z + 2*C(i,:)*x ) / t

In this case there is only one remaining expected return, that of Bonds (asset 2). Its expected return will be:

e(2) = ( z + 2*C(2,:)*x ) / t


e(2) =


We are thus able to infer the vector of expected returns from the assumptions that (1) covariances are known, (2) an efficient portfolio is known, and (3) two expected returns are known. This process is is sometimes termed reverse optimization. Given the difficulty associated with predicting expected returns, it can be a powerful tool to insure that optimizations give sensible answers. If, for example, the market portfolio is used in this procedure, the results will be those implied by the capital asset pricing model.

The reverse optimization worksheet uses this approach. Inputs may be pasted in directly from the output of the weighted covariance worksheet. The output of the reverse optimization worksheet may, in turn, be pasted directly into the optimization worksheet.


Additional Sources of Utility

Thus far we have assumed that Investor utility functions included only expected return and variance, that is:

u = ep - vp / t

But at least some Investors may care about other attributes of a portfolio. Of particular interest are attributes for which the portfolio attribute is a linear combination of the attributes of individual assets. For our example, assume that the liquidity of each asset can be specified and that a portfolio's liquidity is a value-weighted average of the liquidities of the individual assets. For example, assume that the asset expected returns are:

Cash           3.00
Bonds          5.00
Stocks         8.00

and the liquidity measures (denoted a for "attribute") are:

Cash           1.00
Bonds          0.50
Stocks         0.20

Then the liquidity of portfolio x will be:

ap = x'*a

As with e, we can make a new vector with these attributes plus a zero:

aa = [a ; 0]

An Investor's utility will be assumed to depend on three characteristics of the portfolio. In particular, let at be an Investor's liquidity preference -- his or her marginal rate of substitution of variance for liquidity. The more an Investor prefers to have liquidity, the greater the amount of added variance he or she will accept to obtain added liquidity. Thus for an Investor unconcerned with liquidity, at=0. For one very concerned with liquidity, at will be large, and so on.

We can now write the Investor's utility function as:

u = t*ep + at*ap - vp

The first-order conditions for portfolio optimality then become:

mu(i) = t*e(i) + at*a(i) - 2*C(i,:)*x = z      (for all i)

Combining all these first-order conditions gives:

t*e + at*a - 2*C*x = z*ones(n,1)


2*C*x + ones(n,1)*z = t*e + at*a

Finally, adding the full investment constraint gives:

CC*xx = kk + at*aa + t*ee


CC = [ 2*C ones(n,1) ; ones(1,n) 0]
kk = [zeros(n,1); 1]
aa = [a; 0]
ee = [e ; 0]

To find the optimal portfolio for an Investor with liquidity preference at and risk tolerance t, we can simply solve:

xx = inv(CC)*kk + at*inv(CC)*aa + t*inv(CC)*ee


xx = zp + at*atswap + t*rtswap

where zp and rtswap are as defined earlier, and:

atswap = inv(CC)*aa


Cash         0.0053
Bonds       -0.0043
Stocks      -0.0011
z            1.0195

We call this vector a swap because the asset positions must sum to zero due to the zero in the last position of aa. Moreover, the amount of adjustment in the overall portfolio should equal this vector times the Investor's liquidity preference. Hence the name atswap (here - liquidity preference swap). Note that the more an Investor prefers liquidity, the larger the cash position and the smaller the bond and stock positions.

In this case, zp is now the optimal portfolio for an Investor with zero risk tolerance and zero liquidity preference. Let att be the vector of Investor liquidity preferences. Here:

Dick         0.00
Jane         0.20

By summing over all Investors as before we have:

xm = zp + atm*atswap + tm*rtswap

where atm is the weighted average liquidity preference:

atm = ww'*att


atm = 

In this case the optimal portfolios for the investors are:

XX = zp*ones(1,m) + atswap*att' + rtswap*tt'


               Dick      Jane
Cash         0.6504    0.0682
Bonds        0.2171    0.6013
Stocks       0.1326    0.3305
z           24.8018   64.9770
xm = XX*ww
Cash         0.2428
Bonds        0.4860
Stocks       0.2711
z           52.9244

As before, it is useful to compare an Investor's optimal strategy with that of an Investor who is average in every respect (here, t = tm and at = atm). We know that the latter will hold the market portfolio. Thus:

xm = zp + atm*atswap + tm*rtswap
x = zp + at*atswap + t*rtswap 
x - xm = (at-atm)*atswap + (t-tm)*rtswap


x = xm + (at-atm)*atswap + (t-tm)*rtswap

Thus an Investor's optimal portfolio will differ from the market portfolio by atswap times the difference between the Investor's liquidity preference and that of the market (society). plus rtswap times the difference between the Investor's risk tolerance and that of the market (society) As before, we can think of rtswap as the "tilt" away from the market per unit of difference between the investor's risk tolerance and that of the market. And here, atswap is the "tilt" away from the market per unit of difference between the Investor's liquidity preference and that of the market.

Note that in this case, three funds (and/or swaps) will be required to span the space of optimal portfolios (thus -- three-fund separation). One alternative would be to employ these three vectors: the market portfolio, the swap given by atswap, and the swap given by rtswap.


Liability Hedging

Finally, consider Investors who are concerned not with asset risk and return but with the risk and return of the difference between asset return and that of some liability (for example, pension obligations). For example, let the Investor's utility function depend on the expected surplus and standard deviation of surplus, where surplus is defined as:

s = ra - h*rl

where ra is the return on assets, rl is the return on liabilities, and h is a constant.

The expected surplus es will be:

es = ea - h*erl

where ea is the expected return on the assets and erl is the expected return on the liabilities.

The variance of the surplus vs will be:

vs = va - 2*h*cal + (h^2)*vl

where va is the variance of the asset return, cal is the covariance of the asset and liability returns, and vl is the variance of the liability return.

In variance-equivalent terms, the utility function can be written as:

u = t*ex - vs


u = t*(ea - h*erl) - (va - 2*h*cal + (h^2)*vl)

But some of these terms will not be affected by the decision variables in the optimization (that is, the allocation of the fund among the assets). In particular, erl and vl are characteristics of the liability return distribution that cannot be changed via asset allocation. Hence we can simplify the problem to one of maximizing:

u = t*ea - va - 2*h*cal 

The first two terms in this objective function are precisely the same as in the general asset allocation problem. Only the third differs.

Consider the covariance of the asset returns with the liability. This will be a weighted average of the covariances of the individual assets with the liability, with the relative portfolio values as weights:

cal = cl'*x

where cl is an {n*1}vector of the covariances of the assets with the liability. But note that this makes the third term a linear function of the portfolio weights. Re-writing:

u = t*ea - [h*2*cl']*x - va

But this is equivalent to the general formulation with a linear attribute, so all the conclusions reached earlier can be applied to this case. In particular, (1) one additional fund or swap will be needed to provide all possible optimal portfolios, (2) the market portfolio will be optimal for an Investor with the market average desire to hedge (here, h), and (3) a given Investor should tilt away from the market portfolio based, among other things, on the difference between his or her desire to hedge and that of the weighted average Investor.