Modern Portfolio Theory and Mean-Variance Optimization › The Two-Asset Case

Michael BrenndoerferDecember 13, 202510 min read
Quantitative FinanceAll chapters
Part 9 of 15Portfolio Theory and Investment Analysis
Chapter 46Modern Portfolio Theory and Mean-Variance Optimization › The Two-Asset Case
Reading section 3 of 12 · The Two-Asset Case · 10 minSection 3 of 12 · 10 min

Book contents

Section 3 of 12 · 10 min read

Modern Portfolio Theory and Mean-Variance Optimization › The Two-Asset CaseOne section · Sections in this chapter3 / 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

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:

In[2]:
Code
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)
Out[3]:
Visualization
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.

In[4]:
Code
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)
Out[5]:
Console
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.

Out[6]:
Visualization
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.