Lesson 4 of 15

Minimum Variance Portfolio

Minimum Variance Portfolio

The minimum variance portfolio (MVP) is the portfolio that achieves the lowest possible variance for a given set of assets — regardless of expected return.

For two assets, the optimal weight in asset 1 that minimizes portfolio variance has a closed-form solution:

w1=σ22σ1σ2ρ12σ12+σ222σ1σ2ρ12w_1^* = \frac{\sigma_2^2 - \sigma_1 \sigma_2 \rho_{12}}{\sigma_1^2 + \sigma_2^2 - 2 \sigma_1 \sigma_2 \rho_{12}}

And w₂ = 1 − w₁.

Intuition

  • The numerator captures how much of asset 2's risk can be offset by holding asset 1
  • When ρ = 0, the formula simplifies: w₁ = σ₂² / (σ₁² + σ₂²) — you hold more of the lower-volatility asset

N-Asset Generalization

For N assets, the minimum variance portfolio requires solving a constrained optimization. Given the covariance matrix Σ (an N×N matrix), the MVP weights are:

w=Σ111TΣ11\mathbf{w}^* = \frac{\Sigma^{-1} \mathbf{1}}{\mathbf{1}^T \Sigma^{-1} \mathbf{1}}

where 1 is a vector of ones. This can be implemented without matrix inversion using a system of linear equations.

For the simple case of diagonal covariance (uncorrelated assets), this simplifies to inverse-variance weighting:

w_i = (1 / sigma_i^2) / sum(1 / sigma_j^2 for all j)

Your Task

Implement:

  • min_var_portfolio_2(s1, s2, corr) — returns w₁ for the 2-asset minimum variance portfolio
  • min_var_n_uncorrelated(sigmas) — returns a list of minimum variance weights for N uncorrelated assets (inverse-variance weighting), each rounded to 4 decimal places
Python runtime loading...
Loading...
Click "Run" to execute your code.