Modern Portfolio Theory and Mean-Variance Optimization › The Two-Asset Case
Quantitative FinanceAll chapters 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 in asset 1 and in asset 2.
The expected return is:
where:
- : expected return of the portfolio
- : weight invested in asset 1
- : expected returns of assets 1 and 2
This formula shows that expected return varies linearly with the weight . As we shift allocation from asset 2 toward asset 1, expected return moves along a straight line between (when ) and (when ). There are no surprises here: return blending is straightforward.
The variance, however, tells a richer story:
where:
- : variance of the portfolio
- : weight invested in asset 1
- : standard deviations (volatility) of assets 1 and 2
- : 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 , lowering correlation cannot increase portfolio variance; it decreases when both weights and volatilities are positive: . 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:
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)Matplotlib is building the font cache; this may take a moment.

The figure reveals several key insights about how correlation shapes investment opportunities:
- Perfect positive correlation (): 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 ; unequal volatilities permit a zero-variance long-short hedge.
- Imperfect correlation (): 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 alone. At fixed long-only weights, lowering correlation cannot increase variance.
- Perfect negative correlation (): A risk-free portfolio exists. When , 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 with respect to and set the result to zero:
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 , the variance has positive second derivative , so the point is its unique unrestricted minimum; any nonzero finite change in raises variance by . Rearranging the first-order condition to isolate :
For , the unrestricted minimizer is:
where:
- : optimal weight for asset 1 to minimize portfolio variance
- : volatilities of assets 1 and 2
- : correlation between assets 1 and 2
This unrestricted-weight formula requires . If , 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 , clip the unrestricted minimizer to . When correlation is zero, the formula allocates more to the lower-volatility asset.
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)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.
