Quant Sandbox
DerivativesPortfolio & RiskFixed IncomeCorporate FinanceStochastic ModelsGuide
Guide
Derivatives pricing
01Forwards, calls and puts02Combining positions03Arbitrage and the forward price04Put–call parity05The one-step binomial model06Risk-neutral probabilities07Multi-step trees and backward induction08American options and early exercise09Delta and hedging10Geometric Brownian motion11The Black–Scholes formula12The Greeks: gamma, vega, theta and rho13Implied volatility and the volatility smile14Stochastic volatility and the Heston model15Static replication: Breeden–Litzenberger and Carr–Madan16Exotic options: barriers, Asians and digitals
Portfolio & risk
01Returns and volatility02Diversification and correlation03The efficient frontier and the capital market line04Risk aversion and the optimal complete portfolio05CAPM, beta and the security market line06Performance measures: Sharpe, Treynor, Jensen and information ratio07Factor models and systematic risk08Value at Risk and expected shortfall
Fixed income
01Bond prices and yields02Duration and convexity03Immunization and duration matching04Spot rates, forward rates and the yield curve05Bond futures and the cheapest-to-deliver06Interest rate swaps07Callable bonds and negative convexity08Credit risk: default probabilities and credit spreads
Corporate finance
01Interest, compounding and discounting02Annuities, perpetuities and loan amortization03Net present value and internal rate of return04The weighted average cost of capital05Capital structure and the Modigliani–Miller theorems06Discounted cash flow valuation07Relative valuation with multiples08Real options: the value of flexibility
Stochastic models
01Random walks and Brownian motion02Probability spaces, σ-algebras and random variables03Filtrations, adapted processes and stopping times04Conditional expectation and martingales05Properties of Brownian motion06The reflection principle and first passage times07The Brownian bridge08The Itô integral09Itô's lemma10Kolmogorov equations and the Feynman–Kac formula11Change of measure and Girsanov's theorem12Monte Carlo option pricing13Simulating SDEs: the Euler–Maruyama scheme14Mean reversion: Ornstein–Uhlenbeck and Vasicek15Jumps and the Merton jump-diffusion model
Knowledge graph

© 2026 Quant Sandbox · A study aid for quantitative finance

Privacy & dataNo cookies

This site does not use cookies and asks for no personal data. It keeps a few small settings in your browser's local storage — your chosen theme and language, the sidebar layout, and your progress and answers in the Guides — so it remembers them on your next visit. This data never leaves your device; clearing your browser storage removes it. Inputs you change can also be captured in the page URL, so you can share or bookmark a specific setup. The site uses Vercel Web Analytics, a privacy-friendly, cookieless service that records only anonymous, aggregated usage (such as page views) without identifying you or tracking you across other sites.

Guide/Portfolio & risk

Diversification and correlation

Lesson 2 of 8 · 1 min read

The lesson "Returns and volatility" described a single asset by two numbers, its expected return μ\muμ and its volatility σ\sigmaσ. This lesson puts several assets into one portfolio. The expected return of the portfolio is simply an average, but its volatility is not: it depends on how the assets move together, measured by their correlation. That is the source of diversification.

Portfolio weights and portfolio return

A portfolio splits an amount of money across assets. The weight wiw_iwi​ is the fraction of the money invested in asset iii, so the weights add up to one: w1+⋯+wN=1w_1 + \cdots + w_N = 1w1​+⋯+wN​=1. In this lesson every weight lies between 0 and 1, which means no short sales.

Here a return means the simple return of one period, R=S1/S0−1R = S_1/S_0 - 1R=S1​/S0​−1, from the previous lesson. With simple returns the portfolio return is exactly the weighted average of the asset returns, because each part of the money grows by its own factor:

Rp=w1R1+w2R2+⋯+wNRN.R_p = w_1 R_1 + w_2 R_2 + \cdots + w_N R_N.Rp​=w1​R1​+w2​R2​+⋯+wN​RN​.

Log returns do not have this property exactly, which is why portfolio theory works with simple returns. Taking expectations of a sum gives the sum of expectations, so the expected portfolio return is the same weighted average:

μp=E[Rp]=∑i=1Nwi μi.\mu_p = \mathbb{E}[R_p] = \sum_{i=1}^{N} w_i\,\mu_i.μp​=E[Rp​]=i=1∑N​wi​μi​.

Covariance and correlation

To describe how two returns move together we use the covariance

σAB=Cov⁡(RA,RB)=E[(RA−μA)(RB−μB)].\sigma_{AB} = \operatorname{Cov}(R_A, R_B) = \mathbb{E}\big[(R_A - \mu_A)(R_B - \mu_B)\big].σAB​=Cov(RA​,RB​)=E[(RA​−μA​)(RB​−μB​)].

It is positive when the two returns tend to be above their means at the same time, and negative when one tends to be high while the other is low. Its size depends on the units and on the volatilities, so it is normalised into the correlation

ρ=σABσA σB,−1≤ρ≤1,soσAB=ρ σAσB.\rho = \frac{\sigma_{AB}}{\sigma_A\,\sigma_B}, \qquad -1 \le \rho \le 1, \qquad \text{so} \quad \sigma_{AB} = \rho\,\sigma_A\sigma_B.ρ=σA​σB​σAB​​,−1≤ρ≤1,soσAB​=ρσA​σB​.

ρ=1\rho = 1ρ=1 means the two returns move in exact lockstep (one is a positive linear function of the other), ρ=−1\rho = -1ρ=−1 means they move exactly opposite, and ρ=0\rho = 0ρ=0 means there is no linear relation. The covariance of an asset with itself is its variance: σAA=σA2\sigma_{AA} = \sigma_A^2σAA​=σA2​.

Variance of a two-asset portfolio

Take two assets A and B with weights wA=1−ww_A = 1 - wwA​=1−w and wB=ww_B = wwB​=w. The variance of a sum of two random variables is the sum of the variances plus twice the covariance, and constants come out squared:

σp2=Var⁡(wARA+wBRB)=wA2σA2+wB2σB2+2 wAwB ρ σAσB.\sigma_p^2 = \operatorname{Var}(w_A R_A + w_B R_B) = w_A^2\sigma_A^2 + w_B^2\sigma_B^2 + 2\,w_A w_B\,\rho\,\sigma_A\sigma_B.σp2​=Var(wA​RA​+wB​RB​)=wA2​σA2​+wB2​σB2​+2wA​wB​ρσA​σB​.

The first two terms are the risk each asset brings on its own. The third term is where correlation enters. Everything else being equal, a lower ρ\rhoρ gives a lower portfolio variance.

Three cases of correlation

With ρ=1\rho = 1ρ=1 the expression is a perfect square:

σp2=(wAσA+wBσB)2⇒σp=wAσA+wBσB.\sigma_p^2 = (w_A\sigma_A + w_B\sigma_B)^2 \quad\Rightarrow\quad \sigma_p = w_A\sigma_A + w_B\sigma_B.σp2​=(wA​σA​+wB​σB​)2⇒σp​=wA​σA​+wB​σB​.

Volatility is then the weighted average of the two volatilities, exactly like the expected return. Mixing the assets gives no risk reduction at all.

With ρ<1\rho < 1ρ<1 the cross term is smaller than in the perfect-square case, so

σp<wAσA+wBσB(0<w<1).\sigma_p < w_A\sigma_A + w_B\sigma_B \qquad (0 < w < 1).σp​<wA​σA​+wB​σB​(0<w<1).

The portfolio is less risky than the average of its parts, while its expected return is still the average. This gap is the benefit of diversification.

With ρ=−1\rho = -1ρ=−1 the expression is again a square, σp=∣wAσA−wBσB∣\sigma_p = |w_A\sigma_A - w_B\sigma_B|σp​=∣wA​σA​−wB​σB​∣, and it is zero when wAσA=wBσBw_A\sigma_A = w_B\sigma_BwA​σA​=wB​σB​, that is at wB=σA/(σA+σB)w_B = \sigma_A/(\sigma_A + \sigma_B)wB​=σA​/(σA​+σB​). Two perfectly opposite assets can be combined into a riskless portfolio. A fair picture is an umbrella seller and an ice-cream seller on the same beach: whatever the weather, one of them has a good day.

The minimum-variance portfolio

Among all mixes of A and B there is one with the smallest variance. Write σp2\sigma_p^2σp2​ as a function of w=wBw = w_Bw=wB​ and set its derivative to zero:

dσp2dw=−2(1−w)σA2+2wσB2+2(1−2w)σAB=0.\frac{d\sigma_p^2}{dw} = -2(1-w)\sigma_A^2 + 2w\sigma_B^2 + 2(1-2w)\sigma_{AB} = 0.dwdσp2​​=−2(1−w)σA2​+2wσB2​+2(1−2w)σAB​=0.

Collecting the terms in www gives the minimum-variance weight

wB∗=σA2−σABσA2+σB2−2σAB,wA∗=1−wB∗.w_B^{*} = \frac{\sigma_A^2 - \sigma_{AB}}{\sigma_A^2 + \sigma_B^2 - 2\sigma_{AB}}, \qquad w_A^{*} = 1 - w_B^{*}.wB∗​=σA2​+σB2​−2σAB​σA2​−σAB​​,wA∗​=1−wB∗​.

If the formula gives a value outside [0,1][0, 1][0,1], the minimum without short sales lies at the nearer end point, that is in a single asset. This happens for instance at ρ=1\rho = 1ρ=1, where the least risky choice is to hold only the less volatile asset. For the two assets below it happens whenever ρ>σA/σB=0.5\rho > \sigma_A/\sigma_B = 0.5ρ>σA​/σB​=0.5.

Worked example

Asset A has μA=6%\mu_A = 6\%μA​=6% and σA=15%\sigma_A = 15\%σA​=15%; asset B has μB=12%\mu_B = 12\%μB​=12% and σB=30%\sigma_B = 30\%σB​=30%; the correlation is ρ=0.2\rho = 0.2ρ=0.2. The covariance is σAB=0.2×0.15×0.30=0.009\sigma_{AB} = 0.2 \times 0.15 \times 0.30 = 0.009σAB​=0.2×0.15×0.30=0.009.

A 50/50 portfolio has μp=9%\mu_p = 9\%μp​=9% and

σp2=0.25×0.0225+0.25×0.09+2×0.25×0.009=0.032625,σp≈18.06%.\sigma_p^2 = 0.25 \times 0.0225 + 0.25 \times 0.09 + 2 \times 0.25 \times 0.009 = 0.032625, \qquad \sigma_p \approx 18.06\%.σp2​=0.25×0.0225+0.25×0.09+2×0.25×0.009=0.032625,σp​≈18.06%.

The weighted average of the volatilities is 22.5%22.5\%22.5%, so diversification removes about 4.4 percentage points of volatility at no cost in expected return.

The minimum-variance weight is

wB∗=0.0225−0.0090.0225+0.09−0.018=0.01350.0945≈0.143.w_B^{*} = \frac{0.0225 - 0.009}{0.0225 + 0.09 - 0.018} = \frac{0.0135}{0.0945} \approx 0.143.wB∗​=0.0225+0.09−0.0180.0225−0.009​=0.09450.0135​≈0.143.

This portfolio has μp≈6.86%\mu_p \approx 6.86\%μp​≈6.86% and σp≈14.34%\sigma_p \approx 14.34\%σp​≈14.34%. Adding a little of the riskier asset B to A lowers the volatility below that of A alone, while raising the expected return.

The figure plots expected return against volatility for all mixes of A and B with weights from 0 to 1 at the chosen correlation (thick curve). The dashed straight line is the case ρ=1\rho = 1ρ=1 and the dotted V is the case ρ=−1\rho = -1ρ=−1; markers show A and B. Move the correlation slider and note that the curve bends further to the left as ρ\rhoρ falls, reaching the vertical axis at ρ=−1\rho = -1ρ=−1. The readouts give the minimum-variance weight in B, the minimum volatility, the volatility and expected return of the 50/50 portfolio and, for comparison, the 22.5% average of the two volatilities. Above ρ=0.5\rho = 0.5ρ=0.5 the weight readout turns negative, and the minimum volatility shown is that of A alone.

Mixes of two assets in risk–return spaceOpen in Portfolio Lab →
0.20
-11
ρ = 1ρ = −1Mixes of A and BAssets
Minimum-variance weight in B
14.3%
Minimum volatility
14.34%
Volatility of the 50/50 portfolio
18.06%
Average of the two volatilities
22.50%
Expected return of the 50/50 portfolio
9.0%

Many assets and systematic risk

Now take NNN assets in equal weights wi=1/Nw_i = 1/Nwi​=1/N. The portfolio variance is a sum over all pairs:

σp2=∑i=1N∑j=1Nwiwj σij=1N2∑i=1Nσi2+1N2∑i≠jσij.\sigma_p^2 = \sum_{i=1}^{N}\sum_{j=1}^{N} w_i w_j\,\sigma_{ij} = \frac{1}{N^2}\sum_{i=1}^{N}\sigma_i^2 + \frac{1}{N^2}\sum_{i \ne j}\sigma_{ij}.σp2​=i=1∑N​j=1∑N​wi​wj​σij​=N21​i=1∑N​σi2​+N21​i=j∑​σij​.

There are NNN variance terms and N(N−1)N(N-1)N(N−1) covariance terms. Write σ2‾\overline{\sigma^2}σ2 for the average variance and σ‾ij\overline{\sigma}_{ij}σij​ for the average covariance between different assets. Then

σp2=1N σ2‾+(1−1N)σ‾ij  ⟶  σ‾ij(N→∞).\sigma_p^2 = \frac{1}{N}\,\overline{\sigma^2} + \Big(1 - \frac{1}{N}\Big)\overline{\sigma}_{ij} \;\longrightarrow\; \overline{\sigma}_{ij} \quad (N \to \infty).σp2​=N1​σ2+(1−N1​)σij​⟶σij​(N→∞).

The individual variances are diversified away, but the average covariance stays. Example: every asset has σ=30%\sigma = 30\%σ=30% and every pair has ρ=0.3\rho = 0.3ρ=0.3, so σ‾ij=0.3×0.09=0.027\overline{\sigma}_{ij} = 0.3 \times 0.09 = 0.027σij​=0.3×0.09=0.027. One asset has a volatility of 30%, ten assets about 18.2%, a hundred assets about 16.6%, and the limit is 0.027≈16.4%\sqrt{0.027} \approx 16.4\%0.027​≈16.4%.

Risk that is specific to single assets disappears in a large portfolio. Risk that comes from common movements, measured by the average covariance, remains. This remaining part is called systematic (market) risk.

Moving the two assets

The figure below lets you place the two assets yourself. Drag A or B to any point of the risk–return plane and pick a correlation. With ρ=0.9\rho = 0.9ρ=0.9 the mixes lie close to the straight line between the two points, so mixing buys little. With ρ=−0.5\rho = -0.5ρ=−0.5 the curve bends far to the left of both assets. Move B straight up and note that the minimum-variance weight does not change: it depends only on the volatilities and the correlation, not on the expected returns.

Drag the assets around the risk–return planeOpen in Portfolio Lab →

Grab A or B and drag it: the curve of their mixes and the minimum-variance point follow.

Mixes of A and BMinimum varianceAssets
A
6.0% / 15.0%
B
12.0% / 30.0%
Minimum-variance weight in B
20.0%
Minimum volatility
13.42%

Summary

  • Portfolio return is the weighted average of asset returns: μp=∑iwiμi\mu_p = \sum_i w_i\mu_iμp​=∑i​wi​μi​.
  • Portfolio variance depends on covariances: σp2=wA2σA2+wB2σB2+2wAwBρσAσB\sigma_p^2 = w_A^2\sigma_A^2 + w_B^2\sigma_B^2 + 2w_Aw_B\rho\sigma_A\sigma_Bσp2​=wA2​σA2​+wB2​σB2​+2wA​wB​ρσA​σB​.
  • With ρ=1\rho = 1ρ=1 volatility is the weighted average; with ρ<1\rho < 1ρ<1 it is lower; with ρ=−1\rho = -1ρ=−1 it can be zero.
  • The minimum-variance weight is wB∗=(σA2−σAB)/(σA2+σB2−2σAB)w_B^{*} = (\sigma_A^2 - \sigma_{AB})/(\sigma_A^2 + \sigma_B^2 - 2\sigma_{AB})wB∗​=(σA2​−σAB​)/(σA2​+σB2​−2σAB​).
  • In a large equally weighted portfolio the variance tends to the average covariance: systematic risk cannot be diversified away.

The next lesson, "The efficient frontier and the capital market line", allows short sales and a risk-free asset, and asks which of these portfolios an investor should actually choose.

Try itCombine assets and watch the portfolio volatility change in the Portfolio lab →
← PreviousReturns and volatilityNext →The efficient frontier and the capital market line
Connections
Diversification and correlation
Open the full graph →
Labs for this lesson
Portfolio LabRisk & Return