Calculate the Portfolio Variance for a portfolio of assets given their individual weights, variances, and the covariance matrix. Portfolio variance measures the total risk of a weighted combination of assets.
Portfolio variance is w^T * Sigma * w where w is the weight vector and Sigma is the covariance matrix.
This accounts for both individual asset variances (diagonal of Sigma) and pairwise covariances (off-diagonal).
Diversification benefit: if assets are not perfectly correlated, portfolio variance is less than the weighted sum of individual variances.
Example: for two assets with weights [0.6, 0.4], variances [0.04, 0.09], and correlation 0.5, the covariance matrix is [[0.04, 0.03], [0.03, 0.09]], and portfolio variance is 0.6^20.04 + 20.60.40.03 + 0.4^2*0.09 = 0.0432.
Complexity
Time: O(n^2) where n is the number of assets (matrix-vector multiplication)