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

The efficient frontier and the capital market line

Lesson 3 of 8 · 1 min read

The lesson "Diversification and correlation" showed how the expected return and volatility of a portfolio follow from the weights, volatilities and correlations of its assets. This lesson asks which of those portfolios are worth holding. It first sorts the risky portfolios into good and bad ones, then adds a risk-free asset, which turns the choice into a single line: the capital market line.

Mean–variance preferences

Throughout the lesson we assume that investors judge a portfolio only by its expected return μ\muμ and its volatility σ\sigmaσ over one period. They prefer a higher μ\muμ when σ\sigmaσ is the same, and a lower σ\sigmaσ when μ\muμ is the same. A portfolio dominates another if it is at least as good in both respects and strictly better in one. Investors may differ in how much extra return they demand for extra risk, but no one holds a dominated portfolio.

Short sales

A short sale means borrowing an asset, selling it, and buying it back later to return it. It gives a negative weight. With wA=−0.5w_A = -0.5wA​=−0.5 and wB=1.5w_B = 1.5wB​=1.5 the investor sells A worth half of the own capital and invests one and a half times the capital in B. The formulas of the previous lesson still apply, since they never required the weights to be positive:

μp=−0.5×6%+1.5×12%=15%,σp2=0.25×0.0225+2.25×0.09−2×0.75×0.009=0.194625.\mu_p = -0.5 \times 6\% + 1.5 \times 12\% = 15\%, \qquad \sigma_p^2 = 0.25 \times 0.0225 + 2.25 \times 0.09 - 2 \times 0.75 \times 0.009 = 0.194625.μp​=−0.5×6%+1.5×12%=15%,σp2​=0.25×0.0225+2.25×0.09−2×0.75×0.009=0.194625.

This is for the assets of the previous lesson (μA=6%\mu_A = 6\%μA​=6%, σA=15%\sigma_A = 15\%σA​=15%, μB=12%\mu_B = 12\%μB​=12%, σB=30%\sigma_B = 30\%σB​=30%, ρ=0.2\rho = 0.2ρ=0.2, so σAB=0.009\sigma_{AB} = 0.009σAB​=0.009), and gives σp≈44.1%\sigma_p \approx 44.1\%σp​≈44.1%. Short selling extends the curve of attainable portfolios beyond the two assets in both directions.

The attainable set and the efficient frontier

Letting the weight w=wBw = w_Bw=wB​ run over all real numbers traces a curve in the (σ,μ)(\sigma, \mu)(σ,μ) plane: the set of attainable portfolios for two assets. With more assets it becomes a region whose left edge has the same shape. The leftmost point is the minimum-variance portfolio from the previous lesson, here wB∗≈0.143w_B^{*} \approx 0.143wB∗​≈0.143 with σ≈14.34%\sigma \approx 14.34\%σ≈14.34% and μ≈6.86%\mu \approx 6.86\%μ≈6.86%.

The minimum-variance portfolio splits the curve into two branches. Every point on the lower branch is dominated by the point on the upper branch with the same volatility. Example: at σ=20%\sigma = 20\%σ=20% the lower branch has wB≈−0.31w_B \approx -0.31wB​≈−0.31 and μ≈4.14%\mu \approx 4.14\%μ≈4.14%, while the upper branch has wB≈0.60w_B \approx 0.60wB​≈0.60 and μ≈9.58%\mu \approx 9.58\%μ≈9.58%. Nobody would choose the first.

The efficient frontier is the upper branch of the attainable set, from the minimum-variance portfolio upwards. Every portfolio on it gives the highest expected return available for its volatility.

Adding a risk-free asset

Now add a risk-free asset with return rfr_frf​, for example a short government bill held to maturity. Its volatility is zero and its covariance with every risky asset is zero. Put a fraction yyy of the money in a risky portfolio P and 1−y1 - y1−y in the risk-free asset. By the formulas of the previous lesson

μ=(1−y) rf+y μP=rf+y (μP−rf),σ=y σP(y≥0).\mu = (1-y)\,r_f + y\,\mu_P = r_f + y\,(\mu_P - r_f), \qquad \sigma = y\,\sigma_P \quad (y \ge 0).μ=(1−y)rf​+yμP​=rf​+y(μP​−rf​),σ=yσP​(y≥0).

The variance has no cross term because the covariance is zero. Eliminating y=σ/σPy = \sigma/\sigma_Py=σ/σP​ gives a straight line from the point (0,rf)(0, r_f)(0,rf​) through P:

μ=rf+μP−rfσP σ.\mu = r_f + \frac{\mu_P - r_f}{\sigma_P}\,\sigma.μ=rf​+σP​μP​−rf​​σ.

Points between (0,rf)(0, r_f)(0,rf​) and P mean lending at rfr_frf​ (0≤y≤10 \le y \le 10≤y≤1). Points beyond P mean borrowing at rfr_frf​ to invest more than one's own capital in P (y>1y > 1y>1); here we assume one can borrow at the same rate.

The Sharpe ratio and the tangency portfolio

The slope of that line is the Sharpe ratio of P,

SRP=μP−rfσP,\text{SR}_P = \frac{\mu_P - r_f}{\sigma_P},SRP​=σP​μP​−rf​​,

the excess return over rfr_frf​ per unit of volatility. A steeper line gives more expected return at every level of volatility, so the investor wants the risky portfolio with the largest Sharpe ratio. Rotating the line upward around (0,rf)(0, r_f)(0,rf​), the last attainable portfolio it touches is where it is tangent to the efficient frontier. This is the tangency portfolio T.

Write ei=μi−rfe_i = \mu_i - r_fei​=μi​−rf​ for the excess returns. Maximising SR\text{SR}SR over the weights (setting the derivative with respect to wBw_BwB​ to zero) gives weights proportional to

wA∝σB2 eA−σAB eB,wB∝σA2 eB−σAB eA,w_A \propto \sigma_B^2\, e_A - \sigma_{AB}\, e_B, \qquad w_B \propto \sigma_A^2\, e_B - \sigma_{AB}\, e_A,wA​∝σB2​eA​−σAB​eB​,wB​∝σA2​eB​−σAB​eA​,

scaled so that they add up to one. With NNN assets the same result reads w∝Σ−1(μ−rf1)w \propto \Sigma^{-1}(\mu - r_f\mathbf{1})w∝Σ−1(μ−rf​1), where Σ\SigmaΣ is the covariance matrix.

Worked example

Take the assets above with rf=2%r_f = 2\%rf​=2%, so eA=0.04e_A = 0.04eA​=0.04 and eB=0.10e_B = 0.10eB​=0.10:

wA∝0.09×0.04−0.009×0.10=0.0027,wB∝0.0225×0.10−0.009×0.04=0.00189.w_A \propto 0.09 \times 0.04 - 0.009 \times 0.10 = 0.0027, \qquad w_B \propto 0.0225 \times 0.10 - 0.009 \times 0.04 = 0.00189.wA​∝0.09×0.04−0.009×0.10=0.0027,wB​∝0.0225×0.10−0.009×0.04=0.00189.

Normalising, wB=0.00189/0.00459≈0.412w_B = 0.00189 / 0.00459 \approx 0.412wB​=0.00189/0.00459≈0.412 and wA≈0.588w_A \approx 0.588wA​≈0.588. The tangency portfolio has

μT≈0.588×6%+0.412×12%≈8.47%,σT=0.027405≈16.55%,\mu_T \approx 0.588 \times 6\% + 0.412 \times 12\% \approx 8.47\%, \qquad \sigma_T = \sqrt{0.027405} \approx 16.55\%,μT​≈0.588×6%+0.412×12%≈8.47%,σT​=0.027405​≈16.55%,

and a Sharpe ratio of (8.47%−2%)/16.55%≈0.391(8.47\% - 2\%)/16.55\% \approx 0.391(8.47%−2%)/16.55%≈0.391. This beats both assets on their own: A has 0.04/0.15≈0.2670.04/0.15 \approx 0.2670.04/0.15≈0.267 and B has 0.10/0.30≈0.3330.10/0.30 \approx 0.3330.10/0.30≈0.333.

The figure shows the two-asset curve for weights in B from −0.5-0.5−0.5 to 1.51.51.5, so short positions are included, together with the line from (0,rf)(0, r_f)(0,rf​) through the tangency portfolio. Markers show A, B, the minimum-variance portfolio and the tangency portfolio. Raise rfr_frf​ and note that the tangency point slides up the frontier towards B. Lower ρ\rhoρ and note that the curve moves left and the Sharpe ratio in the readouts rises.

Efficient frontier and capital market lineOpen in Portfolio Optimization →
0.20
-0.90.95
2.00%
00.05
Attainable portfoliosCapital market lineAssetsTangency and minimum-variance portfolios
Tangency weight in B
41.2%
Tangency μ
8.47%
Tangency σ
16.55%
Sharpe ratio
0.391

The capital market line

The line through the tangency portfolio is the capital market line (CML):

μ=rf+μT−rfσT σ.\mu = r_f + \frac{\mu_T - r_f}{\sigma_T}\,\sigma.μ=rf​+σT​μT​−rf​​σ.

Apart from the single point T, it lies above the efficient frontier. Once a risk-free asset is available, every risky-only portfolio other than T is dominated by some point on the CML. At σ=20%\sigma = 20\%σ=20%, for example, the CML gives 2%+0.391×20%≈9.82%2\% + 0.391 \times 20\% \approx 9.82\%2%+0.391×20%≈9.82%, more than the 9.58%9.58\%9.58% of the frontier portfolio with the same volatility.

Two-fund separation

Every efficient choice is therefore a mix of two funds: the risk-free asset and the tangency portfolio. Investors differ only in the proportion yyy, not in the composition of their risky holdings. This result is called two-fund separation. Think of a kitchen that serves one soup in different portion sizes, topped up with water to taste: the recipe is the same for everyone.

At the numbers above, a cautious investor who accepts σ=10%\sigma = 10\%σ=10% holds y=10/16.55≈0.604y = 10/16.55 \approx 0.604y=10/16.55≈0.604 in T and 0.3960.3960.396 in the risk-free asset, for μ≈5.91%\mu \approx 5.91\%μ≈5.91%. Without the risk-free asset this volatility would not be reachable at all, since the minimum is 14.34%. A bolder investor who accepts σ=20%\sigma = 20\%σ=20% holds y≈1.208y \approx 1.208y≈1.208, borrowing about 20.8% of the capital at rfr_frf​, for μ≈9.82%\mu \approx 9.82\%μ≈9.82%. Both hold A and B in the same ratio of 58.8 to 41.2.

Summary

  • With short sales allowed, the attainable portfolios form a curve whose upper branch, from the minimum-variance portfolio up, is the efficient frontier.
  • Mixing a risky portfolio P with a risk-free asset gives a line from (0,rf)(0, r_f)(0,rf​) through P with slope equal to the Sharpe ratio (μP−rf)/σP(\mu_P - r_f)/\sigma_P(μP​−rf​)/σP​.
  • The tangency portfolio maximises the Sharpe ratio; in the example wB≈0.412w_B \approx 0.412wB​≈0.412, μT≈8.47%\mu_T \approx 8.47\%μT​≈8.47%, σT≈16.55%\sigma_T \approx 16.55\%σT​≈16.55%, SR≈0.391\text{SR} \approx 0.391SR≈0.391.
  • The capital market line μ=rf+SRT σ\mu = r_f + \text{SR}_T\,\sigmaμ=rf​+SRT​σ dominates every other risky portfolio.
  • Two-fund separation: every investor holds the risk-free asset and the tangency portfolio, only in different proportions.

The next lesson, "Risk aversion and the optimal complete portfolio", shows which point on the capital market line a given investor picks. After it, "CAPM, beta and the security market line" assumes all investors reason this way and derives what that implies for the expected return of each single asset.

Try itBuild efficient frontiers from many assets in the Efficient Frontier lab →
← PreviousDiversification and correlationNext →Risk aversion and the optimal complete portfolio
Connections
The efficient frontier and the capital m…
Open the full graph →
Labs for this lesson
Portfolio OptimizationPortfolio Lab