Modern Portfolio Theory and Mean-Variance Optimization

Michael BrenndoerferDecember 13, 202554 min read

Covers Modern Portfolio Theory and mean-variance optimization. Topics include efficient frontier, diversification mathematics.

Quantitative FinanceAll chapters
Part 9 of 15Portfolio Theory and Investment Analysis
Chapter 46Modern Portfolio Theory and Mean-Variance Optimization
Reading the full chapter · 12 sections · 54 min12 sections · 54 min

All 12 sections · 54 min read

Modern Portfolio Theory and Mean-Variance OptimizationFull chapter · Sections in this chapter1 / 12 ↓
Reading tools Definitions, links & notes

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

Notes & comments

Modern Portfolio Theory and Mean-Variance Optimization

In 1952, Harry Markowitz published "Portfolio Selection," developing a foundational mathematical framework for mean-variance portfolio selection. Investors already recognized risk and diversification; Markowitz made the relationship between portfolio risk, individual asset risks, and covariances operational.

In the mean-variance framework, investors prefer higher expected return and lower variance, all else equal. Portfolio risk is measured by return variance or standard deviation. Efficient portfolios offer undominated risk-return combinations; minimizing variance at an arbitrary exact target can also produce portfolios on the inefficient lower branch.

This chapter develops the mathematical machinery of mean-variance optimization from first principles. We'll see how diversification arises naturally from the mathematics of combining assets with less-than-perfect correlation, and we'll implement practical algorithms for finding optimal portfolios. The framework we develop here supplies the covariance and mean-variance tools used in CAPM and factor models. The next two chapters in Part IX cover CAPM and multi-factor models, respectively.

Portfolio Returns and Risk

Before we can optimize portfolios, we need precise definitions of portfolio return and risk. These definitions form the foundation for Modern Portfolio Theory. We need accurate measures of portfolio return and risk to compare investment strategies and identify optimal allocations.

Suppose we allocate wealth across nn assets. The fundamental question is: how should we combine individual asset characteristics to describe the portfolio as a whole? Let wiw_i denote the fraction of wealth invested in asset ii, where the weights must sum to one:

∑i=1nwi=1\sum_{i=1}^{n} w_i = 1

where:

  • wiw_i: fraction of wealth invested in asset ii
  • nn: total number of assets in the portfolio

This constraint ensures we account for all invested capital. A weight of 0.3 means 30% of the portfolio is allocated to that asset. We allow short selling, meaning weights can be negative (representing borrowed positions). Shorting an asset involves selling borrowed shares with the obligation to return them later, creating a negative position that profits when the price falls.

Expected Portfolio Return

The expected return of a portfolio follows naturally from the linearity of expectation, a concept we explored in our probability foundations. If each asset ii has expected return μi=E[Ri]\mu_i = E[R_i], the portfolio's expected return is simply the weighted average:

μp=E[Rp]=∑i=1nwiμi=w⊤μ\mu_p = E[R_p] = \sum_{i=1}^{n} w_i \mu_i = \mathbf{w}^\top \boldsymbol{\mu}

where:

  • μp\mu_p: expected return of the portfolio
  • E[Rp]E[R_p]: expected value of portfolio return
  • wiw_i: weight of asset ii
  • μi\mu_i: expected return of asset ii
  • w\mathbf{w}: vector of portfolio weights, (w1,…,wn)⊤(w_1, \ldots, w_n)^\top
  • μ\boldsymbol{\mu}: vector of expected returns, (μ1,…,μn)⊤(\mu_1, \ldots, \mu_n)^\top

Portfolio expected return is linear in the weights. Doubling an asset's weight doubles that asset's contribution wiμiw_i\mu_i; the change in total portfolio return also depends on which holdings fund the increase. Vector notation provides a compact way to express this relationship for many assets.

Portfolio Variance

The portfolio variance requires more care and reveals how diversification works mathematically. Unlike expected return, variance does not simply average across assets. The portfolio return is:

Rp=∑i=1nwiRiR_p = \sum_{i=1}^{n} w_i R_i

where:

  • RpR_p: return of the portfolio
  • wiw_i: weight of asset ii
  • RiR_i: return of asset ii
  • nn: number of assets

To find the variance of this weighted sum, we must account for how each pair of assets moves together. Taking the variance and using bilinearity of covariance:

σp2=Var(Rp)=Var(∑i=1nwiRi)=∑i=1n∑j=1nwiwjCov(Ri,Rj)(bilinearity of covariance)\begin{aligned} \sigma_p^2 &= \text{Var}(R_p) \\ &= \text{Var}\left(\sum_{i=1}^{n} w_i R_i\right) \\ &= \sum_{i=1}^{n} \sum_{j=1}^{n} w_i w_j \text{Cov}(R_i, R_j) && \text{(bilinearity of covariance)} \end{aligned}

where:

  • σp2\sigma_p^2: variance of the portfolio
  • wi,wjw_i, w_j: weights allocated to assets ii and jj
  • Cov(Ri,Rj)\text{Cov}(R_i, R_j): covariance between returns of assets ii and jj

The double summation captures all pairwise interactions between assets. When i=ji = j, the covariance term becomes the variance of asset ii, contributing wi2σi2w_i^2 \sigma_i^2 to portfolio variance. When i≠ji \neq j, the covariance measures how assets ii and jj move together, and this is where diversification benefits emerge.

Let Σ\Sigma denote the n×nn \times n covariance matrix, where Σij=Cov(Ri,Rj)\Sigma_{ij} = \text{Cov}(R_i, R_j). Then the portfolio variance is:

σp2=w⊤Σw\sigma_p^2 = \mathbf{w}^\top \Sigma \mathbf{w}

where:

  • σp2\sigma_p^2: variance of the portfolio
  • w\mathbf{w}: vector of portfolio weights
  • Σ\Sigma: covariance matrix of asset returns

This compact matrix notation, which we developed in Part I's linear algebra chapter, makes optimization tractable. The quadratic form w⊤Σw\mathbf{w}^\top \Sigma \mathbf{w} appears throughout financial mathematics because it elegantly encapsulates how portfolio risk depends on individual asset variances (the diagonal entries Σii=σi2\Sigma_{ii}=\sigma_i^2) and pairwise covariances (the off-diagonal entries Σij=Cov(Ri,Rj)\Sigma_{ij}=\text{Cov}(R_i,R_j) for i≠ji\ne j).

Covariance Matrix Properties

The covariance matrix Σ\Sigma is symmetric (Σij=Σji\Sigma_{ij} = \Sigma_{ji}) and positive semi-definite, meaning w⊤Σw≥0\mathbf{w}^\top \Sigma \mathbf{w} \geq 0 for all weight vectors w\mathbf{w}. This ensures portfolio variance is always non-negative. When Σ\Sigma is positive definite, the portfolio variance is strictly positive for any non-trivial portfolio.

The Two-Asset Case

The two-asset case provides intuition before we tackle the general problem. By working through this simplified scenario, we can develop a geometric understanding of how risk and return interact, seeing clearly how correlation shapes the set of achievable portfolios. Consider a portfolio with weights ww in asset 1 and (1−w)(1-w) in asset 2.

The expected return is:

μp=wμ1+(1−w)μ2\mu_p = w\mu_1 + (1-w)\mu_2

where:

  • μp\mu_p: expected return of the portfolio
  • ww: weight invested in asset 1
  • μ1,μ2\mu_1, \mu_2: expected returns of assets 1 and 2

This formula shows that expected return varies linearly with the weight ww. As we shift allocation from asset 2 toward asset 1, expected return moves along a straight line between μ2\mu_2 (when w=0w=0) and μ1\mu_1 (when w=1w=1). There are no surprises here: return blending is straightforward.

The variance, however, tells a richer story:

σp2=w2σ12+(1−w)2σ22+2w(1−w)ρ12σ1σ2\sigma_p^2 = w^2\sigma_1^2 + (1-w)^2\sigma_2^2 + 2w(1-w)\rho_{12}\sigma_1\sigma_2

where:

  • σp2\sigma_p^2: variance of the portfolio
  • ww: weight invested in asset 1
  • σ1,σ2\sigma_1, \sigma_2: standard deviations (volatility) of assets 1 and 2
  • ρ12\rho_{12}: correlation coefficient between returns of assets 1 and 2

The first two terms are the weighted individual-variance contributions. Relative to the same weights at zero correlation, the cross-term raises or lowers portfolio variance according to its sign. Whether a combination has less risk than either asset alone depends on all three terms, the weights, and the covariance.

The Diversification Effect

For fixed long-only weights 0≤w≤10\le w\le1, lowering correlation cannot increase portfolio variance; it decreases when both weights and volatilities are positive: ∂σp2/∂ρ12=2w(1−w)σ1σ2≥0\partial\sigma_p^2/\partial\rho_{12}=2w(1-w)\sigma_1\sigma_2\ge0. When correlation is negative, the cross-term is nonpositive. If one weight is negative, the derivative instead becomes negative, so the long-only correlation intuition reverses.

To understand this intuitively, imagine two assets that tend to move in opposite directions. When one zigs, the other zags. With positive holdings in both, these opposite movements partially cancel each other, smoothing the overall portfolio return and reducing its volatility. The lower the correlation, the more pronounced this cancellation effect.

Let's see this numerically:

PythonIn [2]
CollapseExpand
import numpy as np

# Two assets with different risk-return profiles
mu1, sigma1 = 0.10, 0.15  # Asset 1: 10% return, 15% volatility
mu2, sigma2 = 0.06, 0.08  # Asset 2: 6% return, 8% volatility

# Portfolio weights for asset 1
weights = np.linspace(-0.5, 1.5, 100)


def portfolio_stats(w, mu1, mu2, sigma1, sigma2, rho):
    """Calculate portfolio return and standard deviation."""
    mu_p = w * mu1 + (1 - w) * mu2
    var_p = (
        w**2 * sigma1**2
        + (1 - w) ** 2 * sigma2**2
        + 2 * w * (1 - w) * rho * sigma1 * sigma2
    )
    return mu_p, np.sqrt(var_p)
VisualizationOut [3]
CollapseExpand
Matplotlib is building the font cache; this may take a moment.
Line chart showing portfolio frontiers for correlation values of 1.0, 0.5, 0.0, -0.5, and -1.0.
Risk-return tradeoff for two-asset portfolios under correlations from 1.0 to -1.0. At fixed long-only weights, lower correlation cannot increase risk. The plotted weight range also includes short positions, where that correlation response can reverse. Perfect negative correlation permits a zero-variance long-only combination.

The figure reveals several key insights about how correlation shapes investment opportunities:

  • Perfect positive correlation (ρ=1\rho = 1): For long-only weights, portfolio standard deviation is the weighted average of individual volatilities and cannot fall below the less volatile asset. With unrestricted weights, it is ∣wσ1+(1−w)σ2∣|w\sigma_1+(1-w)\sigma_2|; unequal volatilities permit a zero-variance long-short hedge.
  • Imperfect correlation (ρ<1\rho < 1): The displayed frontier can curve leftward. Whether a long-only portfolio has lower risk than either asset alone depends on the weights and covariance, not on ρ<1\rho<1 alone. At fixed long-only weights, lowering correlation cannot increase variance.
  • Perfect negative correlation (ρ=−1\rho = -1): A risk-free portfolio exists. When w=σ2/(σ1+σ2)w = \sigma_2 / (\sigma_1 + \sigma_2), the portfolio variance is exactly zero. This extreme case illustrates the theoretical maximum of diversification: if two assets move in perfectly opposite directions, we can combine them to eliminate all uncertainty.

Minimum Variance Portfolio

For the two-asset case, we can find the minimum variance portfolio analytically. This portfolio represents the allocation that achieves the lowest possible risk, regardless of the expected return it delivers. To find the minimum variance portfolio, we differentiate the variance σp2\sigma_p^2 with respect to ww and set the result to zero:

∂σp2∂w=∂∂w(w2σ12+(1−w)2σ22+2w(1−w)ρ12σ1σ2)=2wσ12+2(1−w)(−1)σ22+2(1−2w)ρ12σ1σ2(differentiate)=2wσ12−2(1−w)σ22+2(1−2w)ρ12σ1σ2(simplify)=0(set to zero)\begin{aligned} \frac{\partial \sigma_p^2}{\partial w} &= \frac{\partial}{\partial w} \left( w^2\sigma_1^2 + (1-w)^2\sigma_2^2 + 2w(1-w)\rho_{12}\sigma_1\sigma_2 \right) \\ &= 2w\sigma_1^2 + 2(1-w)(-1)\sigma_2^2 + 2(1-2w)\rho_{12}\sigma_1\sigma_2 && \text{(differentiate)} \\ &= 2w\sigma_1^2 - 2(1-w)\sigma_2^2 + 2(1-2w)\rho_{12}\sigma_1\sigma_2 && \text{(simplify)} \\ &= 0 && \text{(set to zero)} \end{aligned}

The derivative includes three components corresponding to the three terms in the variance formula. Setting this derivative to zero identifies a stationary point with no first-order change in variance. For D=σ12+σ22−2ρ12σ1σ2>0D=\sigma_1^2+\sigma_2^2-2\rho_{12}\sigma_1\sigma_2>0, the variance has positive second derivative 2D2D, so the point is its unique unrestricted minimum; any nonzero finite change δ\delta in ww raises variance by Dδ2D\delta^2. Rearranging the first-order condition to isolate ww:

2wσ12+2wσ22−4wρ12σ1σ2=2σ22−2ρ12σ1σ2(group terms with w)w(2σ12+2σ22−4ρ12σ1σ2)=2(σ22−ρ12σ1σ2)(factor out w)w(σ12+σ22−2ρ12σ1σ2)=σ22−ρ12σ1σ2(divide by 2)\begin{aligned} 2w\sigma_1^2 + 2w\sigma_2^2 - 4w\rho_{12}\sigma_1\sigma_2 &= 2\sigma_2^2 - 2\rho_{12}\sigma_1\sigma_2 && \text{(group terms with } w \text{)} \\ w(2\sigma_1^2 + 2\sigma_2^2 - 4\rho_{12}\sigma_1\sigma_2) &= 2(\sigma_2^2 - \rho_{12}\sigma_1\sigma_2) && \text{(factor out } w \text{)} \\ w(\sigma_1^2 + \sigma_2^2 - 2\rho_{12}\sigma_1\sigma_2) &= \sigma_2^2 - \rho_{12}\sigma_1\sigma_2 && \text{(divide by 2)} \end{aligned}

For D=σ12+σ22−2ρ12σ1σ2>0D=\sigma_1^2+\sigma_2^2-2\rho_{12}\sigma_1\sigma_2>0, the unrestricted minimizer is:

w∗=σ22−ρ12σ1σ2σ12+σ22−2ρ12σ1σ2w^* = \frac{\sigma_2^2 - \rho_{12}\sigma_1\sigma_2}{\sigma_1^2 + \sigma_2^2 - 2\rho_{12}\sigma_1\sigma_2}

where:

  • w∗w^*: optimal weight for asset 1 to minimize portfolio variance
  • σ1,σ2\sigma_1, \sigma_2: volatilities of assets 1 and 2
  • ρ12\rho_{12}: correlation between assets 1 and 2

This unrestricted-weight formula requires D=σ12+σ22−2ρ12σ1σ2>0D=\sigma_1^2+\sigma_2^2-2\rho_{12}\sigma_1\sigma_2>0. If D=0D=0, the centered asset returns coincide and every budget allocation has the same variance, so there is no unique variance-minimizing weight. For long-only weights and D>0D>0, clip the unrestricted minimizer to [0,1][0,1]. When correlation is zero, the formula allocates more to the lower-volatility asset.

PythonIn [4]
CollapseExpand
def minimum_variance_weight(sigma1, sigma2, rho):
    """Unrestricted two-asset minimizer; requires a positive variance denominator.

    With identical centered returns, every budget allocation has the same
    variance and this function raises rather than reporting a unique optimum.
    A positive common volatility scale cancels from the weight ratio.
    For a long-only portfolio, clip a nondegenerate result to [0, 1] separately.
    """
    if not np.all(np.isfinite([sigma1, sigma2, rho])):
        raise ValueError("Volatilities and correlation must be finite")
    if sigma1 < 0 or sigma2 < 0 or not -1 <= rho <= 1:
        raise ValueError("Require nonnegative volatilities and correlation in [-1, 1]")
    if sigma1 == sigma2 and (sigma1 == 0 or rho == 1):
        raise ValueError("No unique minimum-variance weight: centered returns coincide")
    scale = max(sigma1, sigma2)
    s1, s2 = sigma1 / scale, sigma2 / scale
    numerator = s2 * (s2 - rho * s1)
    # D / scale², formed only after scaling to avoid overflow and underflow.
    denominator = (s1 - s2) ** 2 + 2 * (1 - rho) * s1 * s2
    if denominator == 0:
        raise ValueError(
            "Positive variance denominator is unresolved at working precision"
        )
    return numerator / denominator


# Example with zero correlation
rho = 0.0
w_mv = minimum_variance_weight(sigma1, sigma2, rho)
mu_mv, sigma_mv = portfolio_stats(w_mv, mu1, mu2, sigma1, sigma2, rho)
ConsoleOut [5]
CollapseExpand
Minimum Variance Portfolio (ρ = 0.0):
  Weight in Asset 1: 0.2215
  Weight in Asset 2: 0.7785
  Expected Return: 0.0689 (6.89%)
  Standard Deviation: 0.0706 (7.06%)

Compare to individual assets:
  Asset 1: σ = 0.1500, Asset 2: σ = 0.0800

For the zero-correlation inputs used here, the minimum-variance portfolio has lower risk than either asset alone. Imperfect correlation by itself does not guarantee a strict reduction below both individual risks; the outcome depends on covariance, volatilities, and permitted weights.

VisualizationOut [6]
CollapseExpand
Risk-return curve for two assets at correlation 0.3, with Asset 1 at 15% risk and 10% return, Asset 2 at 8% risk and 6% return, and the 13%-Asset-1 minimum-variance portfolio marked near 7.8% risk.
Location of the minimum variance portfolio on the two-asset frontier for a correlation of 0.3. The minimum variance portfolio (star) achieves lower risk than either individual asset by allocating approximately 13% to Asset 1 and 87% to Asset 2.

Multi-Asset Portfolio Optimization

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 w\mathbf{w} be the n×1n \times 1 vector of weights, μ\boldsymbol{\mu} the n×1n \times 1 vector of expected returns, and Σ\Sigma the n×nn \times n 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?

min⁡w12w⊤Σwsubject tow⊤μ=μtargetw⊤1=1\begin{aligned} \min_{\mathbf{w}} \quad & \frac{1}{2}\mathbf{w}^\top \Sigma \mathbf{w} \\ \text{subject to} \quad & \mathbf{w}^\top \boldsymbol{\mu} = \mu_{\text{target}} \\ & \mathbf{w}^\top \mathbf{1} = 1 \end{aligned}

where:

  • w\mathbf{w}: vector of portfolio weights
  • Σ\Sigma: covariance matrix of asset returns
  • μ\boldsymbol{\mu}: vector of expected returns
  • μtarget\mu_{\text{target}}: required level of expected return
  • 1\mathbf{1}: vector of ones (sum constraint)

The factor of 12\frac{1}{2} 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:

max⁡ww⊤μ−γ2w⊤Σwsubject tow⊤1=1\begin{aligned} \max_{\mathbf{w}} \quad & \mathbf{w}^\top \boldsymbol{\mu} - \frac{\gamma}{2}\mathbf{w}^\top \Sigma \mathbf{w} \\ \text{subject to} \quad & \mathbf{w}^\top \mathbf{1} = 1 \end{aligned}

where:

  • γ\gamma: risk aversion parameter (γ>0\gamma > 0)
  • w\mathbf{w}: vector of portfolio weights
  • μ\boldsymbol{\mu}: vector of expected returns
  • Σ\Sigma: covariance matrix of asset returns
  • 1\mathbf{1}: vector of ones

The parameter γ\gamma captures how much you dislike risk. If you are highly risk-averse (large γ\gamma), you penalize variance heavily and will choose a conservative, low-volatility portfolio. If you are risk-tolerant (small γ\gamma), 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 γ>0\gamma>0. Varying positive γ\gamma traces the efficient upper branch and approaches the GMV portfolio as γ\gamma tends to infinity.

Analytical Solution: Lagrangian Approach

For the target-return closed forms below, assume that Σ\Sigma is positive definite and that μ\boldsymbol{\mu} is not proportional to 1\mathbf{1}. These conditions make Σ\Sigma invertible and AC−B2>0AC-B^2>0. 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:

L=12w⊤Σw−λ1(w⊤μ−μtarget)−λ2(w⊤1−1)\mathcal{L} = \frac{1}{2}\mathbf{w}^\top \Sigma \mathbf{w} - \lambda_1(\mathbf{w}^\top \boldsymbol{\mu} - \mu_{\text{target}}) - \lambda_2(\mathbf{w}^\top \mathbf{1} - 1)

where:

  • L\mathcal{L}: the Lagrangian function
  • w\mathbf{w}: vector of portfolio weights
  • Σ\Sigma: covariance matrix of asset returns
  • λ1,λ2\lambda_1, \lambda_2: Lagrange multipliers enforcing the return and budget constraints
  • μ\boldsymbol{\mu}: vector of expected returns
  • μtarget\mu_{\text{target}}: target portfolio return
  • 1\mathbf{1}: 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, ∂V/∂μtarget=λ1\partial V/\partial\mu_{\text{target}}=\lambda_1 for the optimal half-variance VV. A finite change is generally only approximated by this rate times the change. Taking the derivative with respect to w\mathbf{w} and setting it to zero:

∂L∂w=Σw−λ1μ−λ21=0\frac{\partial \mathcal{L}}{\partial \mathbf{w}} = \Sigma \mathbf{w} - \lambda_1 \boldsymbol{\mu} - \lambda_2 \mathbf{1} = 0

where:

  • Σ\Sigma: covariance matrix
  • w\mathbf{w}: vector of portfolio weights
  • λ1,λ2\lambda_1, \lambda_2: Lagrange multipliers
  • μ\boldsymbol{\mu}: vector of expected returns
  • 1\mathbf{1}: 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 w\mathbf{w} explicitly:

Σw=λ1μ+λ21(isolate Σw)w=Σ−1(λ1μ+λ21)(pre-multiply by Σ−1)=λ1Σ−1μ+λ2Σ−11(distribute)\begin{aligned} \Sigma \mathbf{w} &= \lambda_1 \boldsymbol{\mu} + \lambda_2 \mathbf{1} && \text{(isolate } \Sigma \mathbf{w} \text{)} \\ \mathbf{w} &= \Sigma^{-1}(\lambda_1 \boldsymbol{\mu} + \lambda_2 \mathbf{1}) && \text{(pre-multiply by } \Sigma^{-1} \text{)} \\ &= \lambda_1 \Sigma^{-1} \boldsymbol{\mu} + \lambda_2 \Sigma^{-1} \mathbf{1} && \text{(distribute)} \end{aligned}

where:

  • w\mathbf{w}: optimal portfolio weight vector
  • Σ−1\Sigma^{-1}: inverse of the covariance matrix
  • μ\boldsymbol{\mu}: vector of expected returns
  • 1\mathbf{1}: vector of ones
  • λ1,λ2\lambda_1, \lambda_2: Lagrange multipliers

The vector Σ−1μ\Sigma^{-1}\boldsymbol{\mu} is a covariance-adjusted return direction, while Σ−11\Sigma^{-1}\mathbf{1} is proportional to the GMV portfolio. Their coefficients and normalization matter: both terms jointly satisfy the target-return and budget constraints, and λ1\lambda_1 can be negative on the lower branch.

The Lagrange multipliers λ1\lambda_1 and λ2\lambda_2 are determined by the constraints. Substituting back:

μtarget=λ1μ⊤Σ−1μ+λ2μ⊤Σ−111=λ11⊤Σ−1μ+λ21⊤Σ−11\begin{aligned} \mu_{\text{target}} &= \lambda_1 \boldsymbol{\mu}^\top \Sigma^{-1} \boldsymbol{\mu} + \lambda_2 \boldsymbol{\mu}^\top \Sigma^{-1} \mathbf{1} \\ 1 &= \lambda_1 \mathbf{1}^\top \Sigma^{-1} \boldsymbol{\mu} + \lambda_2 \mathbf{1}^\top \Sigma^{-1} \mathbf{1} \end{aligned}

where:

  • μtarget\mu_{\text{target}}: target return
  • λ1,λ2\lambda_1, \lambda_2: Lagrange multipliers
  • μ\boldsymbol{\mu}: vector of expected returns
  • Σ−1\Sigma^{-1}: inverse covariance matrix
  • 1\mathbf{1}: vector of ones

These two equations form a linear system in the two unknowns λ1\lambda_1 and λ2\lambda_2. We can solve for λ1\lambda_1 and λ2\lambda_2 in terms of scalar constants derived from the problem parameters:

λ1=Cμtarget−BAC−B2,λ2=A−BμtargetAC−B2\lambda_1 = \frac{C\mu_{\text{target}} - B}{AC - B^2}, \quad \lambda_2 = \frac{A - B\mu_{\text{target}}}{AC - B^2}

where:

  • A=μ⊤Σ−1μA = \boldsymbol{\mu}^\top \Sigma^{-1} \boldsymbol{\mu}
  • B=μ⊤Σ−11=1⊤Σ−1μB = \boldsymbol{\mu}^\top \Sigma^{-1} \mathbf{1} = \mathbf{1}^\top \Sigma^{-1} \boldsymbol{\mu}
  • C=1⊤Σ−11C = \mathbf{1}^\top \Sigma^{-1} \mathbf{1}
  • μtarget\mu_{\text{target}}: target portfolio return

The constants AA, BB, and CC 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 λ1=0\lambda_1 = 0 (ignoring the return target) gives the global minimum variance (GMV) portfolio. This formula does not require distinct expected returns:

wGMV=Σ−111⊤Σ−11\mathbf{w}_{\text{GMV}} = \frac{\Sigma^{-1} \mathbf{1}}{\mathbf{1}^\top \Sigma^{-1} \mathbf{1}}

where:

  • wGMV\mathbf{w}_{\text{GMV}}: weights of the global minimum variance portfolio
  • Σ−1\Sigma^{-1}: inverse of the covariance matrix
  • 1\mathbf{1}: vector of ones

This formula represents risk minimization in its most basic form. The term Σ−11\Sigma^{-1}\mathbf{1} 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 Σ−11\Sigma^{-1}\mathbf{1}; 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.

PythonIn [7]
CollapseExpand
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

The Efficient Frontier

The efficient frontier is the undominated part of the upper-left boundary of the feasible risk-return set. Upper-boundary points on a flat-return segment can still be dominated by lower-risk portfolios with the same return.

To understand the efficient frontier, imagine plotting every possible portfolio in risk-return space. The feasible set is defined by the budget constraint and any position limits. With unrestricted short selling, the budget equality alone does not bound leverage. Some portfolios lie on the boundary of this region, while others lie in the interior. Interior portfolios are dominated by boundary portfolios that offer either higher return for the same risk or lower risk for the same return. The efficient frontier consists of all portfolios that are not dominated by any other portfolio.

Efficient Frontier

A portfolio is efficient if no other feasible portfolio offers at least as high an expected return and no more risk, with at least one strict improvement. The collection of all efficient portfolios forms the efficient frontier.

Two-Fund Separation Theorem

A property of the unrestricted-weight model with positive-definite covariance and expected returns not proportional to 1\mathbf{1} is the two-fund separation theorem: any efficient portfolio can be expressed as a linear combination of two distinct efficient portfolios. The combination must remain on the efficient upper branch; arbitrary proportions need not be efficient. Position limits can invalidate this two-fund representation.

Within those assumptions, two efficiently managed funds span the minimum-variance curve. An investor can select an efficient combination according to risk tolerance, subject to the borrowing or short-selling needed to implement those proportions.

Mathematically, if w1\mathbf{w}_1 and w2\mathbf{w}_2 are two distinct efficient portfolios in this model, then any scalar α\alpha gives another portfolio on the minimum-variance curve:

w=αw1+(1−α)w2\mathbf{w} = \alpha \mathbf{w}_1 + (1 - \alpha) \mathbf{w}_2

where:

  • w\mathbf{w}: the new minimum-variance portfolio
  • α\alpha: weighting scalar
  • w1,w2\mathbf{w}_1, \mathbf{w}_2: two distinct efficient portfolios

The parameter α\alpha determines the combined expected return. When α=1\alpha = 1, we hold only portfolio 1; when α=0\alpha = 0, we hold only portfolio 2. The combination is efficient only when its combined expected return is at least the GMV return. Extrapolating outside 0≤α≤10\le\alpha\le1 requires short selling one fund and can reach either the efficient upper branch or the inefficient lower branch.

Computing the Frontier

Let's compute the minimum-variance curve at exact target returns. Unlike the unrestricted analytical model, allow_short=True below still bounds every asset weight between -1 and 2; False uses [0,1]. The curve includes its inefficient lower branch, and binding bounds can make weight paths piecewise smooth.

PythonIn [8]
CollapseExpand
import numpy as np
from scipy.optimize import minimize


def efficient_frontier(mu, cov_matrix, n_points=50, allow_short=True):
    """Compute a bounded minimum-variance curve, including its lower branch.

    Requires finite 1-D expected returns and a compatible symmetric PSD
    covariance matrix. Each weight is bounded to [-1, 2] when allow_short is
    True, or [0, 1] otherwise; shorting is not unrestricted here.

    n_points is an integer >= 2 specifying the requested exact-return targets.
    If every expected return is exactly equal, the return constraint is
    redundant: return one budget-constrained bounded GMV point instead.

    Returns arrays with shapes (m,), (m,), and (m, n_assets), where m is
    n_points in the nondegenerate case and 1 in the equal-mean case.
    A failed endpoint or target solve raises RuntimeError instead of silently
    omitting portfolios. Feasibility is checked to absolute tolerance 1e-7;
    The variance objective is divided by a positive covariance scale for the
    solver; reported risk still uses the original unscaled covariance. This
    preserves the mathematical minimizer across covariance magnitudes.
    Numerical solver success is not an optimality certificate.
    """
    mu = np.asarray(mu, dtype=float)
    cov_matrix = np.asarray(cov_matrix, dtype=float)
    if mu.ndim != 1 or mu.size == 0 or not np.all(np.isfinite(mu)):
        raise ValueError("mu must be a nonempty finite one-dimensional array")
    n_assets = mu.size
    if cov_matrix.shape != (n_assets, n_assets) or not np.all(np.isfinite(cov_matrix)):
        raise ValueError("cov_matrix must be finite with shape (n_assets, n_assets)")
    if not np.allclose(cov_matrix, cov_matrix.T, rtol=1e-10, atol=1e-12):
        raise ValueError("cov_matrix must be symmetric")
    if np.linalg.eigvalsh(cov_matrix).min() < -1e-12:
        raise ValueError("cov_matrix must be positive semidefinite")
    if (
        isinstance(n_points, (bool, np.bool_))
        or not isinstance(n_points, (int, np.integer))
        or n_points < 2
    ):
        raise ValueError("n_points must be an integer >= 2")

    lower, upper = (-1.0, 2.0) if allow_short else (0.0, 1.0)
    bounds = [(lower, upper)] * n_assets
    x0 = np.full(n_assets, 1.0 / n_assets)
    constraints = [{"type": "eq", "fun": lambda w: np.sum(w) - 1.0}]
    feasibility_tolerance = 1e-7
    options = {"maxiter": 500, "ftol": 1e-10}

    # Scale the entire variance objective by a positive constant.
    # This changes numerical conditioning, not the chosen covariance model.
    objective_scale = float(np.max(np.abs(cov_matrix)))
    if objective_scale == 0:
        objective_scale = 1.0
    optimization_covariance = cov_matrix / objective_scale

    def scaled_portfolio_variance(w):
        return float(w @ optimization_covariance @ w)

    def portfolio_variance(w):
        # Returned variances/risk retain the original units and covariance.
        return float(w @ cov_matrix @ w)

    def checked_weights(result, label, target=None):
        if not result.success:
            raise RuntimeError(f"{label} optimization failed: {result.message}")
        weights = np.asarray(result.x, dtype=float)
        if (
            weights.shape != (n_assets,)
            or not np.all(np.isfinite(weights))
            or abs(weights.sum() - 1.0) > feasibility_tolerance
            or np.any(weights < lower - feasibility_tolerance)
            or np.any(weights > upper + feasibility_tolerance)
            or (
                target is not None
                and abs(float(weights @ mu) - target) > feasibility_tolerance
            )
        ):
            raise RuntimeError(
                f"{label} optimization returned invalid or infeasible weights"
            )
        return weights

    def result_arrays(weights):
        weights = np.stack(weights)
        returns = weights @ mu
        variances = np.array([portfolio_variance(w) for w in weights])
        if not np.all(np.isfinite(variances)) or np.any(variances < -1e-12):
            raise RuntimeError("Frontier optimization returned invalid variances")
        return returns, np.sqrt(np.maximum(variances, 0.0)), weights

    if np.all(mu == mu[0]):
        result = minimize(
            scaled_portfolio_variance,
            x0,
            method="SLSQP",
            bounds=bounds,
            constraints=constraints,
            options=options,
        )
        return result_arrays([checked_weights(result, "Equal-mean GMV")])

    min_result = minimize(
        lambda w: float(w @ mu),
        x0,
        method="SLSQP",
        bounds=bounds,
        constraints=constraints,
        options=options,
    )
    max_result = minimize(
        lambda w: -float(w @ mu),
        x0,
        method="SLSQP",
        bounds=bounds,
        constraints=constraints,
        options=options,
    )
    min_weights = checked_weights(min_result, "Minimum-return endpoint")
    max_weights = checked_weights(max_result, "Maximum-return endpoint")
    min_ret, max_ret = float(min_weights @ mu), float(max_weights @ mu)
    if min_ret > max_ret:
        raise RuntimeError("Frontier endpoint returns are out of order")

    target_returns = np.linspace(min_ret, max_ret, n_points)
    frontier_weights = []
    for index, target in enumerate(target_returns):
        # A convex combination of endpoints is a feasible starting allocation.
        fraction = index / (n_points - 1)
        start = (1 - fraction) * min_weights + fraction * max_weights
        target_constraints = constraints + [
            {"type": "eq", "fun": lambda w, t=target: float(w @ mu) - t}
        ]
        result = minimize(
            scaled_portfolio_variance,
            start,
            method="SLSQP",
            bounds=bounds,
            constraints=target_constraints,
            options=options,
        )
        frontier_weights.append(checked_weights(result, f"Target {index + 1}", target))
    return result_arrays(frontier_weights)

Worked Example: Three-Asset Portfolio

Let's construct an efficient frontier for a portfolio of stocks, bonds, and commodities. This example illustrates how different asset classes with distinct risk-return profiles and correlations combine to form a diversified investment opportunity set:

PythonIn [9]
CollapseExpand
import numpy as np

# Asset parameters (annualized)
# Illustrative annual parameters for stocks, bonds, and commodities
asset_names = ["Stocks", "Bonds", "Commodities"]

# Expected returns
mu = np.array([0.08, 0.03, 0.05])  # 8%, 3%, 5%

# Volatilities
sigma = np.array([0.18, 0.05, 0.20])  # 18%, 5%, 20%

# Correlation matrix
corr = np.array(
    [
        [1.0, 0.1, 0.3],  # Stocks
        [0.1, 1.0, 0.0],  # Bonds
        [0.3, 0.0, 1.0],  # Commodities
    ]
)

# Convert to covariance matrix: Σ = diag(σ) × Corr × diag(σ)
cov_matrix = np.diag(sigma) @ corr @ np.diag(sigma)
ConsoleOut [10]
CollapseExpand
Covariance Matrix:
[[0.0324 0.0009 0.0108]
 [0.0009 0.0025 0.    ]
 [0.0108 0.     0.04  ]]

Asset Statistics:
  Stocks: μ = 8.0%, σ = 18.0%
  Bonds: μ = 3.0%, σ = 5.0%
  Commodities: μ = 5.0%, σ = 20.0%

The covariance matrix confirms the relationships between our assets: stocks and commodities have higher volatility and a moderate positive correlation (0.3), while bonds give stability with low volatility and low correlation to the other assets. The near-zero correlations between bonds and the other asset classes suggest that bonds will play a central role in diversifying portfolio risk.

VisualizationOut [11]
CollapseExpand
Heatmap showing correlation values between stocks, bonds, and commodities.
Correlation matrix heatmap for the three-asset portfolio. Bonds show low or zero correlation with both stocks and commodities, making them useful for diversification. The numerical values inside the cells highlight the low or zero correlation of bonds compared to the moderate 0.3 correlation between stocks and commodities.

Now let's compute and visualize the efficient frontier:

PythonIn [12]
CollapseExpand
# Compute the minimum-variance frontier, including its inefficient lower branch
frontier_returns, frontier_risks, frontier_weights = efficient_frontier(
    mu, cov_matrix, n_points=100, allow_short=True
)

# Find global minimum variance portfolio
gmv_weights = global_minimum_variance_portfolio(cov_matrix)
gmv_return = gmv_weights @ mu
gmv_risk = np.sqrt(gmv_weights @ cov_matrix @ gmv_weights)
VisualizationOut [13]
CollapseExpand
Minimum-variance risk-return curve with a global minimum-variance star near 4.82% risk and 3.25% return, and labeled Stocks, Bonds, and Commodities points.
Minimum-variance curve for the bounded three-asset model. The branch above the GMV return is efficient; the lower branch is inefficient. The star marks the GMV portfolio near 4.82% risk and 3.25% expected return.

The minimum-variance curve gives the lowest risk at each exact target return. Only the branch at or above the GMV return is efficient. The individual assets (red dots) lie inside the frontier, confirming that portfolios combining imperfectly correlated assets offer superior efficiency compared to holding single securities. Notice how the frontier bows outward to the left, showing that diversification creates portfolios with better risk-return characteristics than any individual asset.

ConsoleOut [14]
CollapseExpand
Global Minimum Variance Portfolio:
  Stocks: 2.95%
  Bonds: 92.03%
  Commodities: 5.02%

  Expected Return: 3.25%
  Standard Deviation: 4.82%

The GMV portfolio is heavily weighted toward bonds because of their low volatility. Notice that the GMV portfolio achieves lower risk than any individual asset, showing the power of diversification. Even the lowest-risk asset (bonds at 5% volatility) has higher risk than the optimally diversified GMV portfolio.

Portfolio Composition Along the Frontier

Understanding how portfolio weights change along the efficient frontier provides insight into the risk-return tradeoff. As you move up the frontier seeking higher returns, you must accept more risk, and the portfolio composition shifts accordingly:

VisualizationOut [15]
CollapseExpand
Three-line chart of Stocks, Bonds, and Commodities weights versus target return, including negative weights from short selling and a vertical marker at the global minimum-variance return.
Asset weights along the minimum-variance frontier for a three-asset portfolio when short selling is allowed. As target return increases, the allocation shifts from a short position in stocks toward a large stock allocation, while bond exposure declines. The vertical dashed line marks the bond-heavy global minimum-variance portfolio.

The plotted curve includes targets below the GMV return, on the inefficient lower branch. Near the GMV portfolio, bonds dominate the allocation. Above the GMV return, seeking higher returns along the efficient branch increases risk and shifts weight toward stocks. The bounded model produces piecewise smooth weight paths; kinks occur when a position limit binds.

Quadratic Programming for Portfolio Optimization

For practical applications with many assets and constraints, we use quadratic programming (QP). Quadratic programming is a mathematical optimization technique designed specifically for problems where the objective function is quadratic (involving squared terms) and the constraints are linear. Mean-variance optimization fits this structure perfectly because portfolio variance is a quadratic function of the weights.

The standard QP form is:

min⁡x12x⊤Qx+c⊤xsubject toAeqx=beqAineqx≤bineq\begin{aligned} \min_{\mathbf{x}} \quad & \frac{1}{2}\mathbf{x}^\top Q \mathbf{x} + \mathbf{c}^\top \mathbf{x} \\ \text{subject to} \quad & A_{\text{eq}}\mathbf{x} = \mathbf{b}_{\text{eq}} \\ & A_{\text{ineq}}\mathbf{x} \leq \mathbf{b}_{\text{ineq}} \end{aligned}

where:

  • x\mathbf{x}: vector of decision variables
  • QQ: symmetric matrix (quadratic term)
  • c\mathbf{c}: vector (linear term)
  • Aeq,beqA_{\text{eq}}, \mathbf{b}_{\text{eq}}: matrix and vector defining equality constraints
  • Aineq,bineqA_{\text{ineq}}, \mathbf{b}_{\text{ineq}}: matrix and vector defining inequality constraints

The minimum-variance formulation uses Q=ΣQ = \Sigma and c=0\mathbf{c} = \mathbf{0}. For the defined utility U=w⊤μ−γ2w⊤ΣwU=\mathbf{w}^\top\boldsymbol{\mu}-\frac{\gamma}{2}\mathbf{w}^\top\Sigma\mathbf{w}, minimizing −U-U uses Q=γΣQ = \gamma\Sigma and c=−μ\mathbf{c} = -\boldsymbol{\mu}. Equivalently, dividing the objective by positive γ\gamma gives Q=ΣQ=\Sigma and c=−μ/γ\mathbf{c}=-\boldsymbol{\mu}/\gamma. The analytical exact-target formulation enforces both budget and target return as equalities; the utility formulation does not require a target-return equality. Inequalities can encode position limits and other practical requirements.

Adding Practical Constraints

Real portfolio optimization often includes additional constraints that reflect regulatory requirements, risk management policies, or investment mandates:

  • No short selling: wi≥0w_i \geq 0 for all ii. This constraint prevents the portfolio from taking negative positions, which an investor cannot or chooses not to take.
  • Maximum position size: wi≤wmax⁡w_i \leq w_{\max} (e.g., 10% per asset). This limits single-security concentration and can encourage diversification, but does not guarantee diversified sector or factor exposure.
  • Sector constraints: Total exposure to a sector ≤\leq some limit. This prevents the portfolio from becoming overly exposed to a single industry or market segment.
  • Turnover constraints: Changes from current portfolio are limited. This controls transaction costs and tax consequences by restricting how much trading occurs.

Let's implement a more realistic optimizer using SciPy's SLSQP method. Here target_return is a minimum return floor, imposed as an inequality, rather than the exact-target equality used in the analytical derivation. If the solver reports failure, the function raises an error instead of presenting a fallback allocation as optimal:

This implementation uses the ridge-regularized covariance Σ+10−8I\Sigma+10^{-8}I, so its numerical candidate targets that model, not exactly the supplied unregularized covariance problem. The fixed ridge can matter substantially when covariance entries are small. For tiny objectives, we divide the entire chosen objective by a positive scale to avoid premature termination under an absolute stopping tolerance; this does not change its mathematical minimizer. A successful solver flag is not a proof of global optimality. After thresholding and normalization, we check finite weights, budget, bounds and the return floor to an absolute feasibility tolerance of 10−710^{-7}; this is a feasibility check, not an optimality certificate.

PythonIn [16]
CollapseExpand
import numpy as np
from scipy.optimize import minimize


def mean_variance_optimize(
    mu,
    cov_matrix,
    target_return=None,
    risk_aversion=None,
    max_weight=None,
    min_weight=0.0,
    allow_short=False,
):
    """
    Find an approximate feasible candidate for a ridge-regularized model.

    Requires finite, compatible inputs and a positive-semidefinite covariance;
    the utility branch assumes positive risk_aversion. Uses Sigma + 1e-8 I.
    Tiny entire objectives are positively rescaled; success is not an
    optimality proof. Returned feasibility uses an absolute 1e-7 tolerance.

    Parameters
    ----------
    mu : ndarray
        Expected returns
    cov_matrix : ndarray
        Covariance matrix
    target_return : float, optional
        Minimum portfolio return (a floor for min variance formulation)
    risk_aversion : float, optional
        Risk aversion parameter (for max utility formulation)
    max_weight : float, optional
        Maximum weight per asset
    min_weight : float, optional
        Minimum weight per asset when allow_short=False (default 0).
        Ignored when allow_short=True, which sets the lower bound to -1.
    allow_short : bool
        Use lower bound -1 rather than min_weight; the default upper bound is 1.

    Returns
    -------
    weights : ndarray
        Approximate feasible weights for the ridge-regularized model

    Raises
    ------
    RuntimeError
        If the optimizer reports failure or returned weights fail validation.
    """
    # Convert to numpy arrays and ensure proper shape
    mu_arr = np.asarray(mu).flatten()
    cov_arr = np.asarray(cov_matrix)
    n = len(mu_arr)

    # Fixed ridge changes the supplied covariance model; see the stated scope.
    cov_arr = cov_arr + np.eye(len(mu_arr)) * 1e-8

    if target_return is not None:
        objective = lambda w: float(w @ cov_arr @ w)
    elif risk_aversion is not None:
        objective = lambda w: (
            -float(mu_arr @ w - (risk_aversion / 2) * (w @ cov_arr @ w))
        )
    else:
        objective = lambda w: float(w @ cov_arr @ w)

    objective_scale = float(np.max(np.abs(cov_arr)))
    if target_return is None and risk_aversion is not None:
        objective_scale = max(
            float(np.max(np.abs(mu_arr))), abs(risk_aversion) * objective_scale
        )
    if 0 < objective_scale < 1e-6:
        unscaled_objective = objective
        objective = lambda w: unscaled_objective(w) / objective_scale

    constraints = [{"type": "eq", "fun": lambda w: np.sum(w) - 1.0}]
    if target_return is not None:
        constraints.append(
            {"type": "ineq", "fun": lambda w: float(mu_arr @ w - target_return)}
        )

    if allow_short:
        lower = -1.0
    else:
        lower = min_weight
    upper = 1.0 if max_weight is None else max_weight
    bounds = [(lower, upper) for _ in range(n)]

    x0 = np.full(n, 1.0 / n)
    if not allow_short:
        x0 = np.clip(x0, lower, upper)
        x0 = x0 / x0.sum()

    result = minimize(
        objective,
        x0,
        method="SLSQP",
        bounds=bounds,
        constraints=constraints,
        options={"maxiter": 500, "ftol": 1e-10},
    )

    if not result.success:
        raise RuntimeError(f"Mean-variance optimization failed: {result.message}")
    weights = result.x

    weights = np.asarray(weights, dtype=float)
    if not np.all(np.isfinite(weights)):
        raise RuntimeError("Mean-variance optimization returned invalid weights")
    weights[np.abs(weights) < 1e-10] = 0.0
    total = weights.sum()
    if not np.isfinite(total) or total == 0:
        raise RuntimeError("Mean-variance optimization returned invalid weights")
    weights = weights / total
    feasibility_tolerance = 1e-7
    if (
        abs(weights.sum() - 1.0) > feasibility_tolerance
        or np.any(weights < lower - feasibility_tolerance)
        or np.any(weights > upper + feasibility_tolerance)
        or (
            target_return is not None
            and mu_arr @ weights < target_return - feasibility_tolerance
        )
    ):
        raise RuntimeError("Mean-variance optimization returned infeasible weights")
    return weights
PythonIn [17]
CollapseExpand
# Unconstrained GMV (allows short selling)
w_unconstrained = global_minimum_variance_portfolio(cov_matrix)

# Constrained: no short selling
w_long_only = mean_variance_optimize(mu, cov_matrix, allow_short=False)

# Constrained: max 40% per asset, no short selling
max_pos = 0.4
w_max_40 = mean_variance_optimize(mu, cov_matrix, allow_short=False, max_weight=max_pos)

# Calculate performance metrics
ret_unconstrained = w_unconstrained @ mu
risk_unconstrained = np.sqrt(w_unconstrained @ cov_matrix @ w_unconstrained)

ret_long_only = w_long_only @ mu
risk_long_only = np.sqrt(w_long_only @ cov_matrix @ w_long_only)

ret_max_40 = w_max_40 @ mu
risk_max_40 = np.sqrt(w_max_40 @ cov_matrix @ w_max_40)
ConsoleOut [18]
CollapseExpand
Portfolio Weights Comparison:
------------------------------------------------------------
Asset             Unconstrained       Long-Only         Max 40%
------------------------------------------------------------
Stocks                    2.95%           2.95%          33.78%
Bonds                    92.03%          92.03%          40.00%
Commodities               5.02%           5.02%          26.22%
------------------------------------------------------------

Unconstrained:
  Return: 3.25%, Risk: 4.82%

Long-Only:
  Return: 3.25%, Risk: 4.82%

Max 40%:
  Return: 5.21%, Risk: 9.49%
VisualizationOut [19]
CollapseExpand
Grouped bars with approximately identical unrestricted and long-only allocations near 3% Stocks, 92% Bonds, and 5% Commodities; the 40%-cap allocation is about 34%, 40%, and 26%.
GMV allocations under three constraint regimes. The original-model unrestricted optimum is already long-only; the ridge-regularized numerical long-only candidate agrees to displayed precision. The 40% cap changes the allocation and raises original-covariance volatility from 4.82% to 9.49%.

In the original covariance model, the unrestricted GMV optimum is already long-only, so that constraint is nonbinding. The 40% cap raises volatility substantially, from 4.82% to 9.49%. Adding constraints cannot improve the minimum objective when the objective itself is unchanged. Here the numerical constrained helper also adds a small ridge, so exact equality with the unrestricted calculation is only expected to displayed precision.

The Mathematics of Diversification

Diversification is often called the "free lunch" of finance because combining different exposures can improve risk-return tradeoffs. Common market or economic factors affect many assets with different exposure magnitudes and signs. Specific risk can diminish when holdings become sufficiently granular and residual dependence is weak; simply increasing the count of holdings is not enough.

Variance Decomposition

Consider an equally-weighted portfolio of nn assets with identical variance σ2\sigma^2 and pairwise correlation ρ\rho. While this is a simplification, it reveals the essential mechanics of diversification. The portfolio variance is:

σp2=∑i=1n∑j=1n1n2σij\sigma_p^2 = \sum_{i=1}^n \sum_{j=1}^n \frac{1}{n^2} \sigma_{ij}

where:

  • σp2\sigma_p^2: variance of the portfolio
  • nn: number of assets
  • σij\sigma_{ij}: covariance between asset ii and asset jj

For the diagonal terms (i=ji = j): σii=σ2\sigma_{ii} = \sigma^2

For the off-diagonal terms (i≠ji \neq j): σij=ρσ2\sigma_{ij} = \rho \sigma^2

There are nn diagonal terms and n(n−1)n(n-1) off-diagonal terms. The diagonal terms represent each asset's own variance contribution, while the off-diagonal terms capture the covariance contributions from all pairs of different assets:

σp2=nσ2n2+n(n−1)ρσ2n2=σ2n+n−1nρσ2(simplify fractions)\begin{aligned} \sigma_p^2 &= \frac{n \sigma^2}{n^2} + \frac{n(n-1) \rho \sigma^2}{n^2} \\ &= \frac{\sigma^2}{n} + \frac{n-1}{n} \rho \sigma^2 && \text{(simplify fractions)} \end{aligned}

where:

  • σ2\sigma^2: variance of each individual asset
  • ρ\rho: pairwise correlation between all assets
  • nn: number of assets in the portfolio

The displayed terms are diagonal variance and off-diagonal covariance contributions. For a common-factor interpretation, assume 0≤ρ≤10\leq\rho\leq1 and write centered returns as Ri−μi=σρF+σ1−ρϵiR_i-\mu_i=\sigma\sqrt{\rho}F+\sigma\sqrt{1-\rho}\epsilon_i, where FF and the residuals have unit variance and are mutually uncorrelated. Then σp2=ρσ2+(1−ρ)σ2/n\sigma_p^2=\rho\sigma^2+(1-\rho)\sigma^2/n: common-factor variance is constant, while specific variance declines with nn. The finite equicorrelation matrix permits −1/(n−1)≤ρ≤1-1/(n-1)\leq\rho\leq1 for n>1n>1, but a fixed negative correlation is not valid as nn tends to infinity.

For a family of homogeneous portfolios with fixed 0≤ρ≤10\leq\rho\leq1, as n→∞n\to\infty:

σp2→ρσ2\sigma_p^2 \to \rho \sigma^2

where:

  • σp2\sigma_p^2: limiting portfolio variance
  • ρ\rho: pairwise correlation between assets
  • σ2\sigma^2: variance of individual assets

For fixed 0≤ρ≤10\leq\rho\leq1, the specific component (1−ρ)σ2/n(1-\rho)\sigma^2/n tends to zero, leaving ρσ2\rho\sigma^2. The limit is positive when ρ>0\rho>0 and σ>0\sigma>0; it is zero when ρ=0\rho=0. Common-factor risk remains here because every holding retains the same factor exposure. In a market crash, many stocks can fall together, although individual stocks can move differently.

PythonIn [20]
CollapseExpand
import numpy as np


def calculate_portfolio_variance(n, sigma, rho):
    """Calculate portfolio variance for an equally weighted portfolio."""
    return (sigma**2 / n) + ((n - 1) / n) * rho * sigma**2


# Define parameters for visualization
sigma = 0.25
rho_values = [0.0, 0.2, 0.4, 0.6]
n_assets = np.arange(1, 101)
VisualizationOut [21]
CollapseExpand
Line chart showing portfolio standard deviation decreasing as number of assets increases.
Portfolio risk reduction as the number of assets increases across different correlation levels. The horizontal dashed lines represent systematic risk, which persists as a floor that cannot be eliminated through diversification, regardless of the number of assets held. Higher correlation (rho) raises this floor, limiting the total possible risk reduction.
VisualizationOut [22]
CollapseExpand
Stacked variance chart from 1 to 50 assets. The common-factor component is constant at 187.5 squared percentage points and the specific component declines from 437.5 to 8.75; total variance falls from 625 to 196.25.
Common-factor and specific variance in the equal-loading model with pairwise correlation 0.3. Common-factor variance stays at 187.5 squared percentage points; specific variance declines as 437.5/n, leaving total variance near the common-factor floor.
Systematic vs. Idiosyncratic Risk

Systematic risk comes from common market or economic factors and remains when the portfolio retains exposure to them. Specific risk can approach zero in increasingly granular portfolios with sufficiently weak residual dependence. The equal-loading model above makes these conditions explicit; the CAPM chapter develops the market-factor interpretation further.

How Many Assets Are Enough?

In this equal-weight, equal-variance model, 20 and 30 assets eliminate 95% and 96.7% of diversifiable variance. That normalized fraction is 1−1/n1-1/n, independent of correlation when ρ<1\rho<1; correlation still determines the remaining total variance. Real diversification needs depend on concentration, exposures, dependence, and the chosen risk criterion.

PythonIn [23]
CollapseExpand
# Calculate percentage of diversification benefit captured
sigma = 0.25
rho = 0.3  # Moderate correlation


def pct_diversification(n, sigma, rho):
    """Percentage of diversifiable variance eliminated; n>=1, sigma>0, 0<=rho<1."""
    if not np.all(np.isfinite([n, sigma, rho])):
        raise ValueError("Portfolio size, volatility and correlation must be finite")
    if n < 1 or sigma <= 0 or not 0 <= rho < 1:
        raise ValueError("Require n>=1, sigma>0 and correlation in [0, 1)")
    # Cancel the positive common factor (1-rho)*sigma² before numerical evaluation.
    return 100.0 * (1.0 - 1.0 / n)


# Calculate benefits for various portfolio sizes
asset_counts = [5, 10, 20, 30, 50, 100]
diversification_benefits = {n: pct_diversification(n, sigma, rho) for n in asset_counts}
ConsoleOut [24]
CollapseExpand
Diversification Benefit Captured (ρ = 0.3):
----------------------------------------
    5 assets:  80.00% of diversifiable variance eliminated
   10 assets:  90.00% of diversifiable variance eliminated
   20 assets:  95.00% of diversifiable variance eliminated
   30 assets:  96.67% of diversifiable variance eliminated
   50 assets:  98.00% of diversifiable variance eliminated
  100 assets:  99.00% of diversifiable variance eliminated
VisualizationOut [25]
CollapseExpand
Cumulative diversification curve rising from 0% with one asset to 90% with 10, 95% with 20, and 96.7% with 30, then flattening toward 100%.
Cumulative elimination of diversifiable variance in the homogeneous model. Ten assets remove 90%, 20 remove 95%, and 30 remove 96.7%; these are variance-removal fractions, not standard-deviation reductions or a general holding-count prescription.

The table illustrates diminishing marginal variance reduction in this model. Whether more holdings are worthwhile in practice depends on their distinct exposures, implementation costs, and investor objectives; the model does not calculate those costs or establish a universal sufficient portfolio size.

Practical Implementation with Simulated Return Data

Let's apply mean-variance optimization to a seeded five-asset Gaussian return sample with a specified covariance structure. The 1,260 observations represent five simulated trading years, not historical market observations.

PythonIn [26]
CollapseExpand
import numpy as np

# Simulated daily returns for 5 assets (252 trading days x 5 simulated years)
np.random.seed(42)
n_days = 252 * 5
n_assets = 5
asset_names = ["Large Cap", "Small Cap", "Intl Stocks", "Bonds", "REITs"]

# True parameters for simulation
true_annual_returns = np.array([0.10, 0.12, 0.08, 0.04, 0.09])
true_annual_vols = np.array([0.16, 0.22, 0.18, 0.04, 0.20])

# Correlation structure
true_corr = np.array(
    [
        [1.00, 0.75, 0.65, 0.10, 0.55],
        [0.75, 1.00, 0.60, 0.05, 0.50],
        [0.65, 0.60, 1.00, 0.15, 0.45],
        [0.10, 0.05, 0.15, 1.00, 0.20],
        [0.55, 0.50, 0.45, 0.20, 1.00],
    ]
)

# Convert to daily parameters
daily_returns_mean = true_annual_returns / 252
daily_vols = true_annual_vols / np.sqrt(252)
true_cov_daily = np.diag(daily_vols) @ true_corr @ np.diag(daily_vols)

# Generate returns using Cholesky decomposition
L = np.linalg.cholesky(true_cov_daily)
z = np.random.randn(n_days, n_assets)
returns = daily_returns_mean + z @ L.T
PythonIn [27]
CollapseExpand
# Estimate annualized parameters from simulated daily returns (IID arithmetic scaling)
estimated_mu = returns.mean(axis=0) * 252  # Annualize
estimated_cov = np.cov(returns.T) * 252  # Annualize

# Compute the long-only minimum-variance curve, including its lower branch
frontier_ret, frontier_risk, frontier_w = efficient_frontier(
    estimated_mu, estimated_cov, n_points=100, allow_short=False
)

# Select the best sampled Sharpe-ratio portfolio (approximate tangent), rf = 2%
rf = 0.02
sharpe_ratios = (frontier_ret - rf) / frontier_risk
max_sharpe_idx = np.argmax(sharpe_ratios)
tangent_weights = frontier_w[max_sharpe_idx]
tangent_return = frontier_ret[max_sharpe_idx]
tangent_risk = frontier_risk[max_sharpe_idx]
max_sharpe_ratio = sharpe_ratios[max_sharpe_idx]

# Calculate Capital Allocation Line (CAL)
cml_risks = np.linspace(0, tangent_risk * 1.5, 50)
cml_returns = rf + max_sharpe_ratio * cml_risks
VisualizationOut [28]
CollapseExpand
Simulated-return risk-return chart with five labeled assets, a long-only minimum-variance curve, an approximate tangent star near 16.8% risk and 13.5% return, and a dashed capital-allocation line from the 2% risk-free point.
Minimum-variance curve estimated from seeded simulated returns. The star marks the highest-Sharpe portfolio among 100 target-return grid points, an approximation to continuous tangency. The dashed capital-allocation line combines this fund with a 2% risk-free asset; its extension assumes frictionless borrowing and lending at that same rate.

This chart uses simulated returns. The dashed capital-allocation line combines the 2% risk-free asset with the best Sharpe portfolio found on the finite grid. It approximates the tangency opportunity set in the stated mean-variance model; extending beyond the risky fund assumes borrowing at the same risk-free rate, without trading frictions or additional leverage constraints.

ConsoleOut [29]
CollapseExpand
Approximate Tangent Portfolio (Best Sampled Sharpe Ratio):
--------------------------------------------------
  Large Cap      :  14.49%
  Small Cap      :   0.00%
  Intl Stocks    :   0.00%
  Bonds          :   7.02%
  REITs          :  78.50%
--------------------------------------------------
  Expected Return: 13.45%
  Standard Deviation: 16.79%
  Sharpe Ratio: 0.682
VisualizationOut [30]
CollapseExpand
Donut chart showing the tangent portfolio allocated 78.5% to REITs, 14.5% to Large Cap, and 7.0% to Bonds.
Allocation of the approximate maximum-Sharpe portfolio in this simulated example. The selected long-only grid solution allocates about 78.5% to REITs, 14.5% to Large Cap, and 7.0% to Bonds; Small Cap and International Stocks receive zero weight.

The selected portfolio has the highest Sharpe ratio among the sampled targets. In the frictionless mean-variance model with a suitable tangency portfolio and unrestricted borrowing and lending at the same risk-free rate, efficient allocations combine that risky fund with the risk-free asset. Actual funding limits, objectives, and exposures can change this conclusion. The next chapter connects portfolio choice to CAPM equilibrium.

Limitations of Mean-Variance Optimization

While mean-variance optimization provides a rigorous framework for portfolio construction, several practical challenges limit its direct application.

Estimation Error

A major practical limitation is sensitivity to input-estimation errors. Small changes in expected returns, volatilities, or correlations can change allocations substantially. These parameters must be estimated or forecast, often using historical data alongside models and other information.

Mean-variance optimizers are often called "error maximizers" because favorable estimation errors can attract disproportionate weight. Expected-return forecasts are often noisy, and allocations can be more sensitive to mean errors than covariance errors in relevant settings; this is a sensitivity statement, not a comparison of raw errors measured in different units.

PythonIn [31]
CollapseExpand
import numpy as np

# Demonstrate sensitivity to estimation error
np.random.seed(123)

# Add independent Gaussian mean noise with a one-percentage-point annual-return standard deviation
est_error = 0.01
n_simulations = 50
perturbed_weights = []

for _ in range(n_simulations):
    perturbed_mu = estimated_mu + np.random.normal(0, est_error, n_assets)
    w = mean_variance_optimize(
        perturbed_mu, estimated_cov, target_return=0.08, allow_short=False
    )
    perturbed_weights.append(w)

perturbed_weights = np.array(perturbed_weights)

# Calculate statistics
mean_w = perturbed_weights.mean(axis=0)
std_w = perturbed_weights.std(axis=0)
min_w = perturbed_weights.min(axis=0)
max_w = perturbed_weights.max(axis=0)
VisualizationOut [32]
CollapseExpand
Five box plots of simulated portfolio weights: Large Cap spans roughly 0% to 28%, Bonds 35% to 69%, REITs 27% to 46%, while Small Cap and International Stocks cluster near zero with a few positive outliers.
Portfolio weights across 50 simulations with independent Gaussian annual-mean perturbations of standard deviation one percentage point. Large Cap, Bonds, and REITs show substantial dispersion, while Small Cap and International Stocks remain near zero in most simulations, with some positive outliers.

Large Cap, Bonds, and REITs show substantial allocation dispersion. Small Cap and International Stocks remain at zero in most simulations, with some positive outliers. The experiment illustrates sensitivity to the specified mean perturbations under this constrained, ridge-regularized model.

ConsoleOut [33]
CollapseExpand
Weight Variability Statistics:
------------------------------------------------------------
Asset                 Mean    Std Dev        Min        Max
------------------------------------------------------------
Large Cap            8.93%      7.64%      0.00%     28.09%
Small Cap            0.06%      0.29%      0.00%      1.99%
Intl Stocks          0.08%      0.56%      0.00%      4.02%
Bonds               53.57%      7.57%     34.96%     69.15%
REITs               37.36%      4.72%     26.69%     46.15%

With one-percentage-point standard deviation in the annual-mean perturbations, some allocations vary by more than 10 percentage points. Naive plug-in allocations can be unreliable under estimation error; constraints and appropriately chosen regularization can improve robustness. This experiment already uses long-only constraints and a small fixed ridge.

Solutions to Estimation Error

Several approaches address the estimation error problem:

  • Shrinkage estimators: Combine noisy parameter estimates with structured targets, such as a sample covariance matrix with a constant-correlation target. Shrinking portfolio weights toward a benchmark is a separate procedure.
  • Robust optimization: Explicitly account for parameter uncertainty in the optimization
  • Resampling methods: Generate multiple parameter sets, optimize each, and average the results
  • Constraints: Position limits and other constraints implicitly regularize the optimization
  • Black-Litterman model: Combine market equilibrium returns with your views

We'll explore methods for estimation uncertainty and robust portfolio construction in later chapters of Portfolio Theory and Investment Analysis (Part IX).

Assumptions and Limitations

Beyond estimation error, the mean-variance framework rests on several assumptions worth examining:

  • Quadratic utility or normal returns: These are familiar sufficient settings for mean-variance analysis, subject to the relevant preference and domain conditions; they are not necessary in every possible model. The Stylized Facts of Financial Returns chapter in Part V discusses fat tails and skewness that depart from normality.

  • Single-period framework: The basic model ignores multi-period considerations like rebalancing costs, tax consequences, and changing investment horizons.

  • No transaction costs: Real portfolios face trading costs that mean-variance ignores.

  • Unlimited leverage and short selling: Many investors face constraints that prevent them from implementing the theoretically optimal portfolio.

Despite these limitations, mean-variance optimization remains the foundational framework for portfolio construction. Its insights about diversification, the risk-return tradeoff, and the efficient frontier guide both academic research and practical investment management.

Key Parameters

The key parameters for Mean-Variance Optimization are:

  • μ\boldsymbol{\mu} (Expected Returns): The vector of forecast returns. Errors can strongly affect allocations; their impact relative to covariance errors depends on estimation precision, constraints, and conditioning.
  • Σ\Sigma (Covariance Matrix): Captures the risk of individual assets (diagonal elements) and their co-movements (off-diagonal elements). At fixed long-only weights, increasing a pairwise correlation cannot reduce portfolio variance, within the valid covariance domain; short positions can reverse that response.
  • rfr_f (Risk-Free Rate): The return on a risk-free asset, used to calculate Sharpe ratios and the Capital Market Line.
  • γ\gamma (Risk Aversion): Determines the trade-off between risk and return in the utility maximization formulation (U=w⊤μ−γ2w⊤ΣwU = \mathbf{w}^\top \boldsymbol{\mu} - \frac{\gamma}{2}\mathbf{w}^\top \Sigma \mathbf{w}).
  • w\mathbf{w} (Weights): The decision variables representing the fraction of capital allocated to each asset. Constraints typically require ∑wi=1\sum w_i = 1 and wi≥0w_i \ge 0 (for long-only portfolios).

Summary

This chapter developed MPT as a mathematical framework for analyzing diversification and risk-return tradeoffs.

The key concepts we covered include:

  • Portfolio return and risk: Portfolio expected return is the weighted average of asset returns (μp=w⊤μ\mu_p = \mathbf{w}^\top \boldsymbol{\mu}), while portfolio variance depends on the full covariance structure (σp2=w⊤Σw\sigma_p^2 = \mathbf{w}^\top \Sigma \mathbf{w}).

  • The efficient frontier: Feasible portfolios for which no other feasible portfolio offers at least as high an expected return and no more risk, with at least one strict improvement. A mean-variance investor who prefers higher expected return and lower risk should avoid dominated portfolios.

  • Global minimum variance portfolio: The portfolio with the lowest possible variance, given by wGMV=Σ−11/(1⊤Σ−11)\mathbf{w}_{\text{GMV}} = \Sigma^{-1}\mathbf{1} / (\mathbf{1}^\top \Sigma^{-1}\mathbf{1}).

  • Two-fund separation: In the stated unrestricted-weight model, two distinct efficient portfolios span the minimum-variance curve. Their combination is efficient only on the upper branch, at or above the GMV return.

  • Diversification benefits and limits: At fixed long-only weights, lowering correlation cannot increase variance; a combination need not have lower risk than both individual assets. In the identical-variance, common-positive-correlation example, the limiting variance is ρσ2\rho\sigma^2, rather than zero.

  • Practical optimization: Quadratic programming enables efficient frontier computation with realistic constraints on short selling, position sizes, and sector exposures.

  • Estimation error: Mean-variance optimization is highly sensitive to input estimation errors, particularly in expected returns. This sensitivity motivates the regularization techniques and robust methods covered in later chapters.

The framework developed here sets up the Capital Asset Pricing Model in the next chapter, where we'll see how equilibrium considerations determine the pricing of risk in the market portfolio.

Quiz

Ready to test your understanding? Take this quick quiz to reinforce what you've learned about Modern Portfolio Theory and mean-variance optimization.

Modern Portfolio Theory and Mean-Variance Optimization

Question 1 of 80 of 8 completed
What is the expected return of a portfolio with weights w\mathbf{w} and expected asset returns μ?\boldsymbol{\mu}?
Join the discussionAsk a question or share what you learned.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

A different angle
All writing
Quantitative Finance · Vol. 3

Portfolio Construction: Black-Litterman and Risk Parity

Covers Black-Litterman models, robust optimization, practical constraints, and risk parity for institutional portfolio management.

54 min read
Quantitative Finance · Vol. 3

Performance Attribution: Measuring Alpha and Beta Sources

Covers Brinson attribution for sector allocation and selection effects, plus factor-based methods to separate investment alpha from systematic beta exposures.

44 min read
Quantitative Finance · Vol. 3

Portfolio Performance Measurement: Risk-Adjusted Returns

Covers Sharpe ratio, Sortino ratio, information ratio, and maximum drawdown metrics. Evaluate portfolios with Python implementations.

50 min read

About the author

Reference

Citation details

Cite or share this article.

BIBTEXAcademic
@misc{brenndoerfer2025modernportfolio, author = {Michael Brenndoerfer}, title = {Modern Portfolio Theory and Mean-Variance Optimization}, year = {2025}, url = {https://mbrenndoerfer.com/writing/modern-portfolio-theory-mean-variance-optimization}, organization = {mbrenndoerfer.com}, note = {Accessed: 2026-11-13} }
APAAcademic
Michael Brenndoerfer (2025). Modern Portfolio Theory and Mean-Variance Optimization. Retrieved from https://mbrenndoerfer.com/writing/modern-portfolio-theory-mean-variance-optimization
MLAAcademic
Michael Brenndoerfer. "Modern Portfolio Theory and Mean-Variance Optimization." 2026. Web. November 13, 2026. <https://mbrenndoerfer.com/writing/modern-portfolio-theory-mean-variance-optimization>.
CHICAGOAcademic
Michael Brenndoerfer. "Modern Portfolio Theory and Mean-Variance Optimization." Accessed November 13, 2026. https://mbrenndoerfer.com/writing/modern-portfolio-theory-mean-variance-optimization.
HARVARDAcademic
Michael Brenndoerfer (2025) 'Modern Portfolio Theory and Mean-Variance Optimization'. Available at: https://mbrenndoerfer.com/writing/modern-portfolio-theory-mean-variance-optimization (Accessed: November 13, 2026).
SimpleBasic
Michael Brenndoerfer (2025). Modern Portfolio Theory and Mean-Variance Optimization. https://mbrenndoerfer.com/writing/modern-portfolio-theory-mean-variance-optimization
Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy