Tutorials › VEE Accounting and Finance › Portfolio Risk With A Covariance Matrix

VEE Accounting and Finance · Portfolio Diversification · Tutorial 538 of 996

Portfolio Risk With A Covariance Matrix

Represent portfolio risk compactly with a covariance matrix, then use portfolio weights to calculate variance and standard deviation.

Intermediate 9 min read

What You'll Learn

  • Define each entry of a return covariance matrix and identify its diagonal and off-diagonal values.
  • Calculate portfolio variance using the matrix quadratic form.
  • Expand the quadratic form to see how variances and covariances contribute.
  • Convert standard deviations and correlations into covariance-matrix entries.
  • Handle negative portfolio weights and distinguish variance units from standard-deviation units.

Why Use a Covariance Matrix?

For a portfolio with several assets, risk depends not only on each asset’s individual variance but also on how pairs of asset returns vary together. A covariance matrix organizes all of this information in one place. Combining that matrix with the portfolio weights gives a compact calculation of portfolio variance that works for any number of assets.

The method is useful when a portfolio contains three or more assets, when some weights are negative, or when the inputs are supplied as a table of covariances. The central discipline is to match the order of the assets in the weight vector to the order of the rows and columns in the matrix.

Definition: For \(n\) assets with random returns \(R_1,\ldots,R_n\), the covariance matrix \(\boldsymbol{\Sigma}\) is the \(n \times n\) matrix whose entry in row \(i\), column \(j\) is \(\operatorname{Cov}(R_i,R_j)\). A diagonal entry is an asset’s return variance, \(\operatorname{Var}(R_i)\). An off-diagonal entry is the covariance between two assets. The portfolio weight vector is \(\mathbf{w}=(w_1,\ldots,w_n)^{\mathsf T}\), with each weight matched to the same asset order used in the matrix.

The Matrix Formula

Assume the asset returns are random variables with finite variances and covariances measured over the same period and on the same return scale. Treat the portfolio weights as fixed over that period. The portfolio return is the weighted sum \(R_P=\sum_{i=1}^n w_iR_i\). Under these conditions, its variance is:

$$ \operatorname{Var}(R_P)=\mathbf{w}^{\mathsf T}\boldsymbol{\Sigma}\mathbf{w}. $$

The transpose \(\mathbf{w}^{\mathsf T}\) turns the column vector of weights into a row vector. The matrix product can be calculated in two steps: first find \(\boldsymbol{\Sigma}\mathbf{w}\), then multiply that result on the left by \(\mathbf{w}^{\mathsf T}\). Alternatively, expand the formula into variances and covariances:

$$ \operatorname{Var}(R_P) = \sum_{i=1}^n w_i^2\operatorname{Var}(R_i) + 2\sum_{1\le i<j\le n}w_iw_j\operatorname{Cov}(R_i,R_j). $$

The first sum contains each asset’s variance contribution. The second sum contains each distinct asset pair once, with a factor of 2. The factor appears because a symmetric covariance matrix includes both the entry for asset \(i\) with asset \(j\) and the entry for asset \(j\) with asset \(i\).

Why the Quadratic Form Gives Portfolio Variance

The formula follows from applying the variance of a sum to the weighted asset returns. For any two random variables \(X\) and \(Y\), \(\operatorname{Var}(X+Y)=\operatorname{Var}(X)+\operatorname{Var}(Y)+2\operatorname{Cov}(X,Y)\). Applying the corresponding result to \(n\) weighted returns gives:

$$ \begin{aligned} \operatorname{Var}(R_P) &=\operatorname{Var}\left(\sum_{i=1}^{n}w_iR_i\right)\\ &=\sum_{i=1}^{n}\sum_{j=1}^{n}w_iw_j\operatorname{Cov}(R_i,R_j). \end{aligned} $$

The weights can be taken outside the covariance because they are fixed constants, and \(\operatorname{Cov}(R_i,R_i)=\operatorname{Var}(R_i)\). By the definition of matrix multiplication, the double sum is exactly \(\mathbf{w}^{\mathsf T}\boldsymbol{\Sigma}\mathbf{w}\). For each distinct pair \(i,j\), the double sum contains both \(w_iw_j\operatorname{Cov}(R_i,R_j)\) and \(w_jw_i\operatorname{Cov}(R_j,R_i)\). Covariance is symmetric, so these terms are equal and combine to give the factor of 2 in the expanded formula.

Key result: Portfolio variance is a scalar: multiply the covariance matrix on both sides by the weight vector, using the transpose on the left. Portfolio standard deviation is the square root of that variance. If returns are entered as decimals, the variance is in squared decimal-return units and the standard deviation is in decimal-return units.

Worked Calculations

Worked Example: Applying the Matrix to Three Asset Weights

A hypothetical portfolio holds three assets with weights \(0.50\), \(0.30\), and \(0.20\). The annual return covariance matrix, using decimal returns, is:

$$ \boldsymbol{\Sigma}= \begin{pmatrix} 0.040 & 0.012 & -0.008\\ 0.012 & 0.090 & 0.018\\ -0.008 & 0.018 & 0.160 \end{pmatrix}, \qquad \mathbf{w}= \begin{pmatrix} 0.50\\ 0.30\\ 0.20 \end{pmatrix}. $$

Calculate the portfolio variance and standard deviation. The method is to multiply the matrix by the weight vector, then take the weighted sum of the resulting entries.

First calculate each row of \(\boldsymbol{\Sigma}\mathbf{w}\):

$$ \begin{aligned} (\boldsymbol{\Sigma}\mathbf{w})_1 &=0.040(0.50)+0.012(0.30)-0.008(0.20)\\ &=0.020+0.0036-0.0016=0.0220,\\ (\boldsymbol{\Sigma}\mathbf{w})_2 &=0.012(0.50)+0.090(0.30)+0.018(0.20)\\ &=0.006+0.027+0.0036=0.0366,\\ (\boldsymbol{\Sigma}\mathbf{w})_3 &=-0.008(0.50)+0.018(0.30)+0.160(0.20)\\ &=-0.004+0.0054+0.032=0.0334. \end{aligned} $$

Now take the dot product with the weights:

$$ \begin{aligned} \operatorname{Var}(R_P) &=0.50(0.0220)+0.30(0.0366)+0.20(0.0334)\\ &=0.0110+0.01098+0.00668\\ &=0.02866. \end{aligned} $$

The standard deviation is \(\sqrt{0.02866}=0.169292\ldots\). Rounded only at the final step to two decimal places as a percentage, the portfolio standard deviation is 16.93%. The calculation avoids omitting the off-diagonal covariances: all three distinct pairs are included through the matrix multiplication.

Worked Example: A Portfolio With a Short Position

A hypothetical investor has weights \(0.60\), \(0.50\), and \(-0.10\) in three assets. The negative weight represents a short position. The annual covariance matrix is:

$$ \boldsymbol{\Sigma}= \begin{pmatrix} 0.010 & 0.006 & -0.003\\ 0.006 & 0.040 & 0.012\\ -0.003 & 0.012 & 0.090 \end{pmatrix}, \qquad \mathbf{w}= \begin{pmatrix} 0.60\\ 0.50\\ -0.10 \end{pmatrix}. $$

The weights sum to \(0.60+0.50-0.10=1.00\). Compute \(\boldsymbol{\Sigma}\mathbf{w}\) row by row:

$$ \begin{aligned} (\boldsymbol{\Sigma}\mathbf{w})_1 &=0.010(0.60)+0.006(0.50)-0.003(-0.10)\\ &=0.006+0.003+0.0003=0.0093,\\ (\boldsymbol{\Sigma}\mathbf{w})_2 &=0.006(0.60)+0.040(0.50)+0.012(-0.10)\\ &=0.0036+0.020-0.0012=0.0224,\\ (\boldsymbol{\Sigma}\mathbf{w})_3 &=-0.003(0.60)+0.012(0.50)+0.090(-0.10)\\ &=-0.0018+0.006-0.009=-0.0048. \end{aligned} $$

Take the dot product, preserving the negative third weight:

$$ \begin{aligned} \operatorname{Var}(R_P) &=0.60(0.0093)+0.50(0.0224)-0.10(-0.0048)\\ &=0.00558+0.01120+0.00048\\ &=0.01726. \end{aligned} $$

Thus \(\sqrt{0.01726}=0.131377\ldots\), or 13.14% to two decimal places. The short position does not mean the third weight should be made positive in the calculation. Its sign affects both the matrix multiplication and the final dot product. This example also illustrates why some intermediate entries of \(\boldsymbol{\Sigma}\mathbf{w}\) can be negative even though the portfolio variance is positive.

Worked Example: Building the Matrix From Correlations

A hypothetical portfolio has weights \(0.20\), \(0.50\), and \(0.30\). The annual return standard deviations are \(10\%\), \(20\%\), and \(15\%\). The pairwise correlations are \(\rho_{12}=0.25\), \(\rho_{13}=-0.20\), and \(\rho_{23}=0.40\). Find its variance and standard deviation.

First square each standard deviation to obtain the diagonal variances: \(0.10^2=0.0100\), \(0.20^2=0.0400\), and \(0.15^2=0.0225\). Convert each correlation to covariance using \(\operatorname{Cov}(R_i,R_j)=\rho_{ij}\sigma_i\sigma_j\):

$$ \begin{aligned} \operatorname{Cov}(R_1,R_2)&=0.25(0.10)(0.20)=0.005,\\ \operatorname{Cov}(R_1,R_3)&=-0.20(0.10)(0.15)=-0.003,\\ \operatorname{Cov}(R_2,R_3)&=0.40(0.20)(0.15)=0.012. \end{aligned} $$

The covariance matrix is therefore:

$$ \boldsymbol{\Sigma}= \begin{pmatrix} 0.0100 & 0.005 & -0.003\\ 0.005 & 0.0400 & 0.012\\ -0.003 & 0.012 & 0.0225 \end{pmatrix}. $$

Use the expanded quadratic form. The diagonal terms are:

$$ (0.20)^2(0.0100)+(0.50)^2(0.0400)+(0.30)^2(0.0225) =0.0004+0.0100+0.002025=0.012425. $$

The three distinct cross terms before multiplying by 2 are:

$$ \begin{aligned} (0.20)(0.50)(0.005)&=0.000500,\\ (0.20)(0.30)(-0.003)&=-0.000180,\\ (0.50)(0.30)(0.012)&=0.001800. \end{aligned} $$

Their sum is \(0.000500-0.000180+0.001800=0.002120\), so the cross-term contribution is \(2(0.002120)=0.004240\). The portfolio variance is \(0.012425+0.004240=0.016665\). Its standard deviation is \(\sqrt{0.016665}=0.12909\ldots\), or 12.91% to two decimal places. Converting the correlations first avoids treating a correlation coefficient as though it were a covariance.

Interpreting the Inputs and Avoiding Traps

A covariance matrix must use a consistent asset order, return period, and scale. If the first weight represents Asset A, the first row and first column must also represent Asset A. If the matrix contains annual covariances, the weights must correspond to the same portfolio return period; weights themselves are proportions and have no time unit.

Covariance and variance are not in the same units as standard deviation. If returns are decimal fractions, such as \(0.10\) for \(10\%\), a variance such as \(0.04\) is in squared decimal-return units. Taking its square root gives \(0.20\), or \(20\%\). Do not report a variance as a standard deviation or apply a square root before the complete portfolio variance has been calculated.

A frequent exam error is to use only diagonal entries and calculate \(\sum_i w_i^2\operatorname{Var}(R_i)\). That omits every covariance term, which is generally incorrect unless the relevant covariances are zero. Another error is to add all off-diagonal terms once without the factor of 2 when using the expanded form. In matrix multiplication, both symmetric entries are already present; in the expanded formula, each distinct pair is listed once and therefore needs the factor of 2.

Common mistake: For a pair of assets, using \(w_1w_2\operatorname{Cov}(R_1,R_2)\) only once understates or overstates the cross-term contribution by a factor of 2. The correct two-asset expression is \(w_1^2\operatorname{Var}(R_1)+w_2^2\operatorname{Var}(R_2)+2w_1w_2\operatorname{Cov}(R_1,R_2)\). In the full matrix calculation, both symmetric covariance entries supply that factor automatically.

The covariance-matrix approach is aligned with the SOA VEE Accounting and Finance syllabus because it expresses portfolio risk for multiple assets in a form that is concise, systematic, and easy to extend. For reliable calculations, preserve the asset order, retain the signs of all weights and covariances, and take the square root only after obtaining the full variance.

Check Your Understanding

For each problem, calculate the requested portfolio risk using the stated return period and units.

  1. A two-asset portfolio has weights \(0.70\) and \(0.30\), variances \(0.0225\) and \(0.0400\), and covariance \(0.0090\). Find the portfolio variance and standard deviation. (Answer: variance \(0.018405\); standard deviation \(13.57\%\).)
  2. A portfolio has weights \(0.50, 0.25, 0.25\), and covariance matrix \(\begin{pmatrix}0.040&0.006&-0.003\\0.006&0.010&0.004\\-0.003&0.004&0.0225\end{pmatrix}\). Find its variance and standard deviation. (Answer: variance \(0.01328125\); standard deviation \(11.52\%\).)
  3. Two assets have annual standard deviations \(8\%\) and \(12\%\), with correlation \(-0.25\). A portfolio invests \(0.40\) and \(0.60\) in them, respectively. Convert the correlation to covariance, then find the portfolio variance and standard deviation. (Answer: covariance \(-0.0024\); variance \(0.005056\); standard deviation \(7.11\%\).)
  4. A portfolio has weights \(0.80, 0.40, -0.20\) and covariance matrix \(\begin{pmatrix}0.0225&0.0075&-0.006\\0.0075&0.0625&0.010\\-0.006&0.010&0.0400\end{pmatrix}\). Find its variance and standard deviation, retaining the short position’s negative weight. (Answer: variance \(0.03112\); standard deviation \(17.64\%\).)
  5. Two assets have monthly return variances \(0.0025\) and \(0.0064\), with monthly covariance \(0.0010\). A portfolio has weights \(0.60\) and \(0.40\). Find the monthly portfolio variance and standard deviation; do not annualize. (Answer: monthly variance \(0.002404\); monthly standard deviation \(4.90\%\).)
Clinical Biostats