We often say that risk and return are two sides of the same coin. You can’t discuss one without the other. In the previous post, we showed you how to calculate the return on a portfolio of assets. In this post, we explain the formula for portfolio risk. We also offer an easy-to-use portfolio risk calculator.

Learning objectives

- Understand why covariance matters when considering the risk of a portfolio.
- Calculate portfolio risk.

## The formula for portfolio risk

In the previous post, we explained that the portfolio return is simply a weighted average of the returns of assets that constitute the portfolio. And, the weights are simply the investment weights (i.e., the proportions invested in each asset). This led us to the formula for portfolio return *R _{P}*:

*R _{P}*

*= ∑w*

_{i}R_{i}where *w _{i}* is the investment weight for asset

*i*and

*R*is the realized return for asset

_{i}*i*. Moreover, we discussed that the variance of returns on a single asset (let’s denote that as

*σ*for asset

_{i}^{2}*i*) is a measure of risk in an earlier post. Could we then calculate the variance of returns on a portfolio

*as a weighted average of the variance of assets in that portfolio? In other words, would the following equation be the correct formula for the variance of portfolio returns?*

*σ*_{P}^{2}*σ*_{P}^{2} = ∑w_{i} *σ*_{i}^{2}

The answer is no. When calculating * σ_{P}^{2}*, we need to consider not only the variance of each asset but also the

**covariance**between each pair of assets. Why? It is because the interactions between assets affect

*. Imagine a portfolio with two assets only. Suppose that when the price of one asset goes up, the price of the other tends to go down. These opposite movements would partially cancel out each other within the portfolio, and, thus, would reduce the volatility of portfolio returns. So, the correct formula for the variance of portfolio returns is*

*σ*_{P}^{2}*σ*_{P}^{2} = ∑w_{i} *w _{j}* σ

_{ij}

where *w _{i}* is the investment weight for asset

*i*,

*w*is the investment weight for asset

_{j}*j*, and

*σ*is the covariance between assets

_{ij}*i*and

*j*.

### Important properties of covariance

We need to discuss important properties of covariance before we can give more specific examples of calculating portfolio risk. First, an asset’s covariance with itself is equal to its variance:

*σ _{ii}* =

*σ*_{i}^{2}Second, the covariance between asset *i* and asset *j* is the same as the covariance between asset *j* and asset *i*:

*σ _{ij}* =

*σ*

_{ji}Finally, covariance can take any value between minus infinity and plus infinity. Researchers sometimes use **correlation** as an alternative way of measuring the strength of the relationship between returns of two assets. It’s because, by definition, correlation takes values between −1 and +1 only. The relation between the correlation coefficient *ρ*_{i}*_{j}* and the covariance is defined as follows:

*ρ*_{i}*_{j}* =

*σ*/ (

_{ij}

*σ*_{i}*)*

*σ*_{j}where * σ_{i}* and

*are the standard deviation of returns (i.e., return volatility) of asset*

*σ*_{j}*i*and asset

*j*, respectively. This means that the variance of portfolio returns can also be written as:

*σ*_{P}^{2}* = ∑w*_{i}* **w _{j}*

*ρ*

_{i}

*σ*_{j}_{i}σ_{j}### A portfolio with two assets

We can now discuss portfolio risk with more specific examples. Let us first consider a portfolio with two assets only. In this case, we have

* σ_{P}^{2} = ∑w_{i} w_{j} σ_{ij}* =

*w*+

_{1}*w*σ_{1}_{11}*w*+

_{1}*w*σ_{2}_{12}*w*+

_{2}*w*σ_{1}_{21}*w*

_{2}*w*σ_{2}_{22}This simplifies into:

*σ*_{P}^{2} = w_{1}^{2} *σ*_{1}^{2} + *w _{2}*

^{2}

*σ*

_{2}

^{2}+ 2

*w*

_{1}*w*

_{2}*σ*

_{12}Why? It’s because *σ _{ii}* =

*and*

*σ*_{i}^{2}*σ*=

_{ij}*σ*as we discussed above. So, in a two asset portfolio,

_{ji}*depends on:*

*σ*_{P}^{2}- The variance of returns for each asset (
*σ*_{1}^{2}and*σ*_{2}^{2}). - The covariance between the returns of asset 1 and asset 2 (
*σ*)._{12} - And, the investment weights (
*w*and_{1}*w*)._{2}

Here’s a numerical example. Suppose you invest 20% of your funds in an asset that has a variance of 36 and the remaining 80% in another asset that has a variance of 121. Moreover, the covariance between the returns of these two assets is −33. Then, the variance of returns for your portfolio would be:

*σ*_{P}^{2} = 0.2^{2} * 36^{2} + 0.8^{2} * 121^{2} + 2 ** 0.2 * 0.8 * (*−33) = 68.32

And, the standard deviation of portfolio returns would be:

* σ_{P}* = √(68.32) = 8.27

### A portfolio with three assets

How about the risk of a portfolio with three assets? If we again use the portfolio variance formula, we will get:

*σ*_{P}^{2} = w_{1}^{2} *σ*_{1}^{2} + *w _{2}*

^{2}

*σ*

_{2}

^{2}

*+ 2*

*+ w*_{3}^{2}σ_{3}^{2}*w*

_{1}*w*

_{2}*σ*

_{12}

*+ 2 w*_{1}w_{3}σ_{13}

*+ 2 w*_{2}w_{3}σ_{23}Then, with three assets, * σ_{P}^{2} *depends on:

- The variance of returns for each asset (
*σ*_{1}^{2},*σ*_{2}^{2}, and*σ*_{3}^{2}). - The covariance between each pair of assets (
*σ*,_{12}*σ*, and_{13}*σ*)._{23} - And, the investment weights (
*w*,_{1}*w*, and_{2}*w*)._{3}

This general structure applies to portfolios with any number of assets. In other words, you always need the variance of returns for each asset, the covariance between each pair of assets, and the investment weights.

## Portfolio risk calculator

##### Instructions

You can use the portfolio risk calculator below to calculate the variance and standard deviation of portfolio returns for portfolios containing up to three assets. Please note the following instructions:

- The calculator allows for both positive investment weights and negative investment weights (i.e., short selling).
- Make sure that investment weights add up to 100% (see the “sum of weights (%)” in the last row of the calculator).
- For Asset 1, enter the variance of Asset 1 (
), the covariance between Asset 1 and Asset 2 (σ*σ*_{1}^{2}), and the covariance between Asset 1 and Asset 3 (_{12}*σ*)._{13} - For Asset 2, enter the variance of Asset 2 (
*σ*) and the covariance between Asset 2 and Asset 3 (_{2}^{2}*σ*)._{23} - Finally, for Asset 3, enter the variance of Asset 3 (
*σ*) only._{3}^{2} - If your portfolio consists of 2 assets only, you can of course still use the calculator by leaving 0s in the fields that you don’t need.

##### Calculator

### Wrapping up

While portfolio return is a weighted average of each asset’s return, the variance of portfolio returns is not a weighted average of each asset’s variance of returns. This is because the interactions between pairs of assets, captured by covariances, affect portfolio risk as well. This was recognized by the celebrated economist Harry Markowitz. His pioneering work on the modern portfolio theory led to a share of a Nobel prize in 1990.

##### What is next?

This post is part of our free course on investments. We will make a distinction between efficient portfolios and inefficient portfolios in our next post. This will lead to the concept of an efficient frontier. In the previous post, we explained how to calculate portfolio returns and offered an online calculator.

If you found this post helpful, feel free to share it on social media. Also, if you have any questions or suggestions, you are more than welcome to leave a comment below.