The Efficient Frontier

The concept of efficient frontier arises naturally when asking the portfolio selection question (i.e. What combination of stocks and bonds should I buy?)

The Efficient Frontier is the set of all portfolios which give a minimum risk for a given expected return (ergo, you should always seek to invest in the Efficient Frontier).

The derivation of the Efficient Frontier equation was first published in…. by…

I haven’t found many resources explaining the subject in-depth, beyond the original paper; so here is a derivation of the Efficient Frontier equation, modernized to soothe your vector-notation cravings.

Prerequisite: Lagrange multipliers

We often find the problem of constrained optimization, which can be stated as:

minimize f(X)

Subject to

\forall_i \: c_i (X) = 0

Lagrange multipliers reduce this problem to an unconstrained optimization problem. The previous problem is reduced to:
minimize f+\sigma \lambda_i c_i
(* A generalization of Lagrange multipliers is given by KKT conditions, in which constraints can be a mix of equalities and inequalities. We will revisit these when we analyze de case of portfolio selection when you can’t hold short positions.)


Statement of the problem

We have the option to invest in several assets. Our portfolio is vector P , the ratios of our total capital that we invest in each asset. Since they are ratios and we are supposed to invest all our money, they add up to 1:

1 = \textbf{1}.P

The return of an asset on a given time interval is a random variable. As there are usually many assets in which we could invest, we are dealing with a vector of random variables X . The return of our portfolio will also be a random variable, given by:

x_p = X . P

The expected return of an asset, on the other hand, is just a number. Therefore, for a vector of expected returns \mu = E(X) , the expected return of our portfolio will be:

\mu_p = \mu . P

The risk of a single asset is statistically described by its variance \sigma^2 . But since we are dealing with a vector of assets, the quantity of interest is its covariance matrix C = cov(X) . By the definition of covariance, C will be a symmetric matrix. The risk of our portfolio will be:

\sigma_p^2 = P^T . C . P

We want to minimize this risk (or minimize half this risk, which is the same), for a given expected return \mu_p . We are now ready to formalize our problem:

minimize \frac{1}{2} P^T . C . P

Subject to:

1 = \textbf{1}.P
\mu_p = \mu . P


By Lagrange multipliers, an equivalent formulation of the above problem is

minimize \frac{1}{2} P^T . C . P + \lambda_1 (1 - \textbf{1}.P) + \lambda_2 (\mu_p - \mu . P)

Taking the derivative of this expression with respect to \lambda_1 , \lambda_2, P will yield an equation system that determines the solution of the problem. We get:

C . P = \lambda_1 \textbf{1} + \lambda_2 . \mu
1 = \textbf{1}.P
\mu_p = \mu . P

To simplify define this, let’s define:

\lambda = (\lambda_1, \lambda_2)
U = (\textbf{1}, \mu)
U_p = (1, \mu_p)

With this definitions, the above equations turn into :

C. P = U. \lambda
U_p = U^T . P

Solving these equations yields:

\lambda = M^{-1} . U_p
P = C^{-1}.U. M^{-1} . U_p
where M = U^T . C^{-1} . U

Note that we finally got our risk minimizing portfolios P , as a function of portfolio return \mu_p . By the definition of \sigma_p^2 in the previous section, the risk of such portfolios is:

\sigma_p^2 = U_p^T . M^{-1} . U_p

Note that this gives us the minimum possible risk for a given return \mu_p , and it turns out to be a quadratic function.

With Risk-Free Asset

Besides investing in risky assets (stocks), we can also invest in a risk-free asset (bonds). This particular case is usually given a separate treatment. Instead, we will just say that for this particular case, matrix C becomes singular, and we shall therefore replace inverses by pseudo-inverses when apropiate in the equations above. That’s all.

No short-position


It may happen that we are not allowed to hold short-positions in some assets. That means all components of P should be positive. The resulting problem is:

minimize \frac{1}{2} P^T . C . P

Subject to:

1 = \textbf{1}.P
\mu_p = \mu . P



for I in range(10)

Author: matiasmorant

Mechanical engineer fascinated by math, programming & science

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: