Skip to content
LeetQuant
F6 Linear Algebra and Optimisation

F6 · Linear Algebra and Optimisation · Lesson 2 of 5

Covariance Matrices & Portfolio Risk

Portfolio variance as a quadratic form, why covariance matrices are PSD, diversification limits and Cholesky simulation.

25 min

Portfolio variance is a quadratic form

For a vector of returns XX with covariance matrix Σ\Sigma and portfolio weights ww,

Var⁡(w⊤X)=w⊤Σ w=∑i,jwiwjΣij.\operatorname{Var}(w^\top X) = w^\top\Sigma\,w = \sum_{i,j} w_iw_j\Sigma_{ij} .

Because a variance is never negative, w⊤Σw≥0w^\top\Sigma w \ge 0 for every ww: every covariance matrix is PSD. A matrix that is not PSD (which can happen when correlations are estimated pairwise, with missing data, or adjusted by hand) implies some portfolio has negative variance, and optimisers will happily exploit it.

The correlation matrix is R=D−1ΣD−1R = D^{-1}\Sigma D^{-1}, where DD is the diagonal matrix of volatilities.

Worked example

a two-asset portfolio

Asset 1 has volatility 10%, asset 2 has 20%, and their correlation is 0.5. What is the volatility of a 50/50 portfolio?

Show solution
σp2=0.52(0.01)+0.52(0.04)+2(0.5)(0.5)(0.5)(0.1)(0.2)=0.0025+0.01+0.005=0.0175,\sigma_p^2 = 0.5^2(0.01) + 0.5^2(0.04) + 2(0.5)(0.5)(0.5)(0.1)(0.2) = 0.0025 + 0.01 + 0.005 = 0.0175 ,

so σp≈13.2%\sigma_p \approx 13.2\%, less than the 15% average of the two volatilities. Diversification helps whenever ρ<1\rho < 1.

The limits of diversification

Take nn assets with the same volatility σ\sigma and the same pairwise correlation ρ\rho, held equally. Then

σp2=σ2(ρ+1−ρn)  ⟶  ρ σ2(n→∞).\sigma_p^2 = \sigma^2\Big(\rho + \frac{1 - \rho}{n}\Big) \;\longrightarrow\; \rho\,\sigma^2 \quad (n \to \infty) .

Idiosyncratic risk diversifies away; the common component does not. With σ=30%\sigma = 30\% and ρ=0.2\rho = 0.2, even a huge portfolio has volatility 30%×0.2≈13.4%30\% \times \sqrt{0.2} \approx 13.4\%.

The same algebra bounds correlations. The equicorrelation matrix (1−ρ)I+ρJ(1 - \rho)I + \rho J has eigenvalues 1+(n−1)ρ1 + (n - 1)\rho and 1−ρ1 - \rho, so it is PSD only when −1n−1≤ρ≤1-\tfrac{1}{n-1} \le \rho \le 1.

Simulating correlated variables

To draw X∼N(μ,Σ)X \sim N(\mu, \Sigma), factor Σ=LL⊤\Sigma = LL^\top with LL lower triangular (the Cholesky decomposition), draw independent standard normals ZZ, and set X=μ+LZX = \mu + LZ. Then Cov⁡(LZ)=LL⊤=Σ\operatorname{Cov}(LZ) = LL^\top = \Sigma.

In two dimensions with unit variances and correlation ρ\rho:

L=(10ρ1−ρ2),X1=Z1,X2=ρZ1+1−ρ2 Z2.L = \begin{pmatrix} 1 & 0 \\ \rho & \sqrt{1 - \rho^2} \end{pmatrix}, \qquad X_1 = Z_1, \quad X_2 = \rho Z_1 + \sqrt{1 - \rho^2}\,Z_2 .

Cholesky fails on a matrix that is not positive definite, which makes it a quick numerical test.

Knowledge check

You hold 100 uncorrelated assets in equal weights, each with 20% volatility. What is the portfolio's volatility?

Knowledge check

Z1Z_1 and Z2Z_2 are independent standard normals. Which variable has correlation 0.80.8 with Z1Z_1 and unit variance?

Knowledge check

Many equally weighted assets each have 25% volatility and pairwise correlation 0.36. What volatility does the portfolio approach as the number of assets grows?

Practice problems

Finished reading?

Answer the 3 knowledge checks to complete this lesson (0 done).