Modern Portfolio Theory and Mean-Variance Optimization › Multi-Asset Portfolio Optimization
Quantitative FinanceAll chapters Modern Portfolio Theory and Mean-Variance Optimization › Multi-Asset Portfolio OptimizationOne section · Sections in this chapter4 / 12 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
With more than two assets, we need the full matrix formulation. The principles remain the same, but the algebra becomes more complex, requiring linear algebra tools to express and solve the optimization problem efficiently. Let be the vector of weights, the vector of expected returns, and the covariance matrix.
The optimization problem has two related formulations, each emphasizing a different perspective on the objective:
Formulation 1: Minimize risk for a target return
This formulation starts with a desired level of expected return and asks: what is the least risky way to achieve it?
where:
- : vector of portfolio weights
- : covariance matrix of asset returns
- : vector of expected returns
- : required level of expected return
- : vector of ones (sum constraint)
The factor of in the objective is a mathematical convenience that simplifies the derivatives. It does not change the optimal solution because multiplying an objective by a positive constant does not alter which portfolio minimizes it.
Formulation 2: Maximize utility (mean-variance utility)
This formulation takes a different approach, directly modeling investor preferences through a utility function that trades off return against risk:
where:
- : risk aversion parameter ()
- : vector of portfolio weights
- : vector of expected returns
- : covariance matrix of asset returns
- : vector of ones
The parameter captures how much you dislike risk. If you are highly risk-averse (large ), you penalize variance heavily and will choose a conservative, low-volatility portfolio. If you are risk-tolerant (small ), you care more about expected return and will accept higher volatility to chase higher gains. The target-return formulation traces the minimum-variance frontier, including its inefficient lower branch. For targets above the GMV return, its solutions also maximize mean-variance utility for a corresponding . Varying positive traces the efficient upper branch and approaches the GMV portfolio as tends to infinity.
Analytical Solution: Lagrangian Approach
For the target-return closed forms below, assume that is positive definite and that is not proportional to . These conditions make invertible and . If the covariance matrix is singular, the inverse formulas do not apply as written; the constrained system must be treated directly.
For the first formulation, we form the Lagrangian using the techniques from Part I. Its equality multipliers are free variables, not fixed penalties. With differentiable functions and linearly independent constraint gradients, a constrained optimum satisfies stationarity together with the original constraints. We solve that system rather than minimize jointly over weights and multipliers:
where:
- : the Lagrangian function
- : vector of portfolio weights
- : covariance matrix of asset returns
- : Lagrange multipliers enforcing the return and budget constraints
- : vector of expected returns
- : target portfolio return
- : vector of ones
When the optimal value varies differentiably with a constraint's right-hand side, the multiplier gives its signed local rate of change. With the sign convention used here, for the optimal half-variance . A finite change is generally only approximated by this rate times the change. Taking the derivative with respect to and setting it to zero:
where:
- : covariance matrix
- : vector of portfolio weights
- : Lagrange multipliers
- : vector of expected returns
- : vector of ones
This first-order condition states that at the optimum, the marginal increase in risk from adjusting any weight must be exactly offset by the value of that weight in meeting the return and budget constraints. Rearranging terms to solve for explicitly:
where:
- : optimal portfolio weight vector
- : inverse of the covariance matrix
- : vector of expected returns
- : vector of ones
- : Lagrange multipliers
The vector is a covariance-adjusted return direction, while is proportional to the GMV portfolio. Their coefficients and normalization matter: both terms jointly satisfy the target-return and budget constraints, and can be negative on the lower branch.
The Lagrange multipliers and are determined by the constraints. Substituting back:
where:
- : target return
- : Lagrange multipliers
- : vector of expected returns
- : inverse covariance matrix
- : vector of ones
These two equations form a linear system in the two unknowns and . We can solve for and in terms of scalar constants derived from the problem parameters:
where:
- : target portfolio return
The constants , , and depend only on the assets' expected returns and covariance structure, not on the target return. This means we can precompute them once and then quickly find optimal portfolios for any target return, making efficient frontier construction computationally efficient.
The Global Minimum Variance Portfolio
With positive-definite covariance, setting (ignoring the return target) gives the global minimum variance (GMV) portfolio. This formula does not require distinct expected returns:
where:
- : weights of the global minimum variance portfolio
- : inverse of the covariance matrix
- : vector of ones
This formula represents risk minimization in its most basic form. The term identifies the portfolio structure that minimizes variance without regard for expected returns, while the denominator normalizes the weights to sum to one. Each weight depends on the full covariance matrix through ; lower standalone variance or lower correlations do not by themselves guarantee a higher weight. With short selling allowed, some GMV weights can be negative.
This portfolio minimizes variance within the stated asset universe subject to the budget constraint. If variance alone is the objective, it is optimal regardless of expected return. A short investment horizon does not by itself imply that objective; cash needs, liabilities, and available risk-free investments can also matter.
import numpy as np
def global_minimum_variance_portfolio(cov_matrix):
"""
Compute the global minimum variance portfolio weights.
Parameters
----------
cov_matrix : ndarray
n x n positive-definite covariance matrix of asset returns
Returns
-------
weights : ndarray
One-dimensional array of optimal weights with shape (n,)
"""
n = cov_matrix.shape[0]
ones = np.ones(n)
# Compute inverse covariance matrix
cov_inv = np.linalg.inv(cov_matrix)
# GMV weights: Σ⁻¹1 / (1'Σ⁻¹1)
weights = cov_inv @ ones / (ones @ cov_inv @ ones)
return weights