Covariance & Correlation Matrices

The cornerstone of portfolio theory.

Theory

Defining Covariance Matrices

Imagine a scatter plot of returns for two stocks. If the cloud of points is tilted upwards, the stocks tend to move together (positive covariance). If it's tilted downwards, they move oppositely (negative covariance). A circular cloud means no relationship (zero covariance).

A covariance matrix, often denoted as Σ\Sigma, is a square matrix that summarizes this relationship for a set of assets. For two assets, it looks like this:

Σ=(σ12σ12σ21σ22)\Sigma = \begin{pmatrix} \sigma_1^2 & \sigma_{12} \\ \sigma_{21} & \sigma_2^2 \end{pmatrix}
  • The diagonal elements (σ12\sigma_1^2, σ22\sigma_2^2) are the variances of each asset—a measure of their individual risk or volatility.
  • The off-diagonal elements (σ12\sigma_{12}, σ21\sigma_{21}) are the covariances between the assets. Since σ12=σ21\sigma_{12} = \sigma_{21}, the matrix is always symmetric.

A positive covariance σ12\sigma_{12} means the assets tend to move in the same direction. A negative covariance means they move in opposite directions. The covariance matrix doesn't just give us numbers; it geometrically describes the shape and tilt of our data cloud.


Defining Correlation Matrices

Covariance is useful, but its magnitude depends on the volatility of the assets, making it hard to compare. A covariance of 100 might be huge for two low-volatility stocks but tiny for two high-volatility ones. To fix this, we normalize the covariance to get the correlation coefficient, ρ\rho (rho).

ρ12=σ12σ1σ2\rho_{12} = \frac{\sigma_{12}}{\sigma_1 \sigma_2}

The correlation is always between -1 and +1, giving us a standardized measure of the linear relationship. A correlation matrix is simply the covariance matrix where every element has been normalized in this way:

R=(1ρ12ρ211)R = \begin{pmatrix} 1 & \rho_{12} \\ \rho_{21} & 1 \end{pmatrix}

The diagonal is always 1 because an asset is perfectly correlated with itself.


Calculating Portfolio Variance

This is where the covariance matrix becomes the engine of portfolio theory. The variance (risk) of a portfolio is not just the average of the individual asset risks. The interaction between assets—their covariance—is critical. For a portfolio with weights w=(w1w2)\mathbf{w} = \begin{pmatrix} w_1 \\ w_2 \end{pmatrix}, the portfolio variance is given by matrix multiplication:

σp2=wTΣw\sigma_p^2 = \mathbf{w}^T \Sigma \mathbf{w}

This elegant equation shows that by combining assets with low or negative covariance, we can build a portfolio where the total risk is lower than the sum of its parts. This is the mathematical heart of diversification.

Interactive Demo