
Mean-variance optimisation: the algorithm behind optimal portfolio construction
Mean-variance optimisation (MVO) is the mathematical procedure that identifies the portfolio weights delivering the highest expected return for a given level of risk—or equivalently, the lowest risk for a given expected return. It is the computational engine of Modern Portfolio Theory and the basis on which most quantitative portfolio construction is performed.
What mean-variance optimisation is
The technique was developed by Harry Markowitz and published in his 1952 paper Portfolio Selection in the Journal of Finance. Its name reflects its inputs: the mean (expected return) of each asset and the variance-covariance structure across the asset set. Together, these inputs define the risk and return of every possible weighted combination of the available assets.
The goal of MVO is to identify, from the infinite set of possible weight combinations, those that are efficient—meaning no other combination offers a higher return at the same risk, or lower risk at the same return. The collection of these efficient combinations is the efficient frontier. MVO is the algorithm that traces it.
In its standard form, MVO solves a quadratic programming problem. The objective function minimises portfolio variance for a given level of target return, subject to the constraint that all weights sum to one (and, in long-only portfolios, that no weight is negative). Running this optimisation across a range of target returns produces the full efficient frontier.
How it works
The three core inputs are: a vector of expected returns for each asset, the standard deviation (volatility) of each asset's returns, and the pairwise correlation matrix across all assets. The correlations and volatilities combine to form the covariance matrix—the key structure MVO uses to calculate portfolio-level risk.
With these inputs, the optimiser sweeps across target return levels and at each point finds the weights that minimise portfolio variance. The resulting set of portfolios maps the efficient frontier. Two portfolios on this set are particularly useful as reference points: the minimum-variance portfolio (the leftmost point on the frontier, with the lowest achievable risk) and the tangency portfolio (the point where the Sharpe ratio is maximised).
In practice, MVO is usually augmented with position constraints—minimum and maximum weights per asset—to prevent the optimiser from taking extreme positions in a single asset. Without constraints, small differences in expected return estimates can lead to portfolios with near-100% concentration in one asset, which is rarely desirable regardless of what the model suggests.
What the evidence shows
Markowitz's framework has been validated across decades of academic research. DeMiguel, Garlappi, and Uppal (2009, Optimal Versus Naive Diversification: How Inefficient is the 1/N Portfolio Strategy?) tested MVO against an equal-weight benchmark across 14 datasets and found that, despite its theoretical superiority, MVO frequently failed to outperform equal weighting out of sample—primarily due to estimation error in expected returns. This finding is widely cited and does not invalidate MVO; it highlights the critical importance of input quality.
Jagannathan and Ma (2003, Risk Reduction in Large Portfolios: Why Imposing the Wrong Constraints Helps) showed that imposing no-short-selling constraints substantially reduces the impact of estimation error in the covariance matrix, improving out-of-sample performance. This supports the common practice of applying weight constraints in practical implementations.
Limitations and trade-offs
MVO's most significant limitation is its sensitivity to input estimation error. Because the optimiser seeks maximum efficiency, it tends to amplify small errors in expected return estimates into large, unstable weight allocations—a problem described as error maximisation. Expected returns are notoriously difficult to estimate from historical data with sufficient accuracy, making this a structural weakness of the method rather than an edge case.
The covariance matrix presents a related problem. In portfolios with many assets, estimating a stable covariance matrix requires a long history of returns—often longer than is practically available. When the matrix is poorly conditioned, the optimiser exploits spurious correlations and produces weights that are fragile out of sample. Alternative methods such as Hierarchical Risk Parity were developed specifically to reduce this dependence on a well-estimated covariance matrix.
Mean-variance optimisation in pfolio
Mean-variance optimisation is pfolio's default portfolio construction method, applied with position constraints to limit concentration. Two alternatives are also available—Hierarchical Risk Parity and equal weight—for investors who prefer approaches less sensitive to estimation error. You can compare all three methods and adjust your portfolio construction approach in the how we build portfolios help article, or explore model portfolios at pfolio.io/portfolios.
Related articles
- The efficient frontier: how to construct portfolios with optimal risk-adjusted returns
- Hierarchical Risk Parity (HRP): a robust alternative to mean-variance optimisation
- Equal weight portfolio: a simple and surprisingly effective allocation strategy
- Portfolio variance: understanding return dispersion and investment risk
Disclaimer
Get started now

