Capital Market Theory - CAPM and the Efficient Frontier › The Capital Market Line and Market Portfolio
Quantitative FinanceAll chapters Capital Market Theory - CAPM and the Efficient Frontier › The Capital Market Line and Market PortfolioOne section · Sections in this chapter4 / 14 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Given that combinations with the risk-free asset create straight lines, which risky portfolio should you choose? The answer is the portfolio that creates the steepest possible line, since this provides the highest expected return per unit of risk. This observation leads us to one of CAPM's most important conclusions: you should hold the same risky portfolio.
The Capital Market Line (CML) is the straight line extending from the risk-free rate through the tangency portfolio on the efficient frontier. It represents the highest achievable Sharpe ratio and dominates all other capital allocation lines.
To understand why the tangency portfolio is optimal, imagine drawing multiple straight lines from the risk-free rate, each passing through a different risky portfolio on the efficient frontier. Each line represents a Capital Allocation Line for that particular risky portfolio. The line with the steepest slope offers the best risk-return tradeoff because you get more expected return for each unit of risk you bear. Geometrically, the steepest line is the one that is tangent to the efficient frontier, touching it at exactly one point without crossing it.
Graphically, the optimal risky portfolio is found by drawing a line from the risk-free rate tangent to the efficient frontier of risky assets. This tangency portfolio, combined with the risk-free asset, dominates all other portfolio combinations. Any other risky portfolio would create a capital allocation line with a lower slope, meaning inferior risk-adjusted returns. Choosing any other risky portfolio would leave money on the table, accepting less expected return for the same amount of risk.
In equilibrium under CAPM assumptions, all investors hold the same tangency portfolio because they all have homogeneous expectations and face the same risk-free rate. Since markets must clear (all assets must be held by someone), this tangency portfolio must be the market portfolio, the value-weighted portfolio of all risky assets in the economy. This is the aggregation insight of CAPM: when we combine our portfolios, we must get the total market. If all investors hold the same risky portfolio, that portfolio must contain all risky assets in proportion to their market values.
The market portfolio contains all risky assets in the economy, with each asset weighted by its market capitalization relative to total market capitalization. In theory, this includes stocks, bonds, real estate, human capital, and all other investable assets. In practice, broad market indices like the S&P 500 or MSCI World serve as proxies.
The Capital Market Line equation describes the risk-return relationship for efficient portfolios, which are portfolios that lie on the CML:
where:
- : expected return of an efficient portfolio
- : risk-free rate
- : expected return of the market portfolio
- : standard deviation of the market portfolio
- : standard deviation of the efficient portfolio
This equation tells us that for portfolios along the CML, expected return increases linearly with total risk (standard deviation). The rate of exchange between risk and return is determined by the market's risk-return characteristics.
The slope of the CML is:
where:
- : expected return of the market
- : risk-free rate
- : market volatility
This is the market's reward-to-variability ratio, or Sharpe ratio. It represents the equilibrium price of risk in the market and indicates how much additional expected return you receive for taking on one additional unit of total risk. Named after William Sharpe, one of CAPM's developers, this ratio has become the standard measure for evaluating risk-adjusted performance. When the Sharpe ratio is 0.5, for example, investors earn 0.5% additional expected return for each 1% of additional volatility they accept.
import numpy as np
from scipy.optimize import minimize
# Generate random assets and efficient frontier
np.random.seed(42)
n_assets = 30
expected_returns = np.random.uniform(0.04, 0.14, n_assets)
volatilities = np.random.uniform(0.10, 0.35, n_assets)
# Generate correlation matrix and covariance matrix
correlations = np.random.uniform(0.2, 0.6, (n_assets, n_assets))
correlations = (correlations + correlations.T) / 2
np.fill_diagonal(correlations, 1.0)
cov_matrix = np.outer(volatilities, volatilities) * correlations
# Find efficient frontier through optimization
def portfolio_return(weights, returns):
return np.dot(weights, returns)
def portfolio_volatility(weights, cov_matrix):
return np.sqrt(weights @ cov_matrix @ weights)
def neg_sharpe_ratio(weights, returns, cov_matrix, rf):
ret = portfolio_return(weights, returns)
vol = portfolio_volatility(weights, cov_matrix)
return -(ret - rf) / vol
# Find tangency portfolio (maximum Sharpe ratio)
rf = 0.03
constraints = {"type": "eq", "fun": lambda w: np.sum(w) - 1}
bounds = tuple((0, 1) for _ in range(n_assets))
initial_weights = np.ones(n_assets) / n_assets
result = minimize(
neg_sharpe_ratio,
initial_weights,
args=(expected_returns, cov_matrix, rf),
method="SLSQP",
bounds=bounds,
constraints=constraints,
)
tangency_weights = result.x
tangency_return = portfolio_return(tangency_weights, expected_returns)
tangency_vol = portfolio_volatility(tangency_weights, cov_matrix)
# Generate efficient frontier
target_returns = np.linspace(0.04, 0.13, 50)
frontier_vols = []
for target in target_returns:
constraints = [
{"type": "eq", "fun": lambda w: np.sum(w) - 1},
{
"type": "eq",
"fun": lambda w, t=target: (
portfolio_return(w, expected_returns) - t
),
},
]
result = minimize(
portfolio_volatility,
initial_weights,
args=(cov_matrix,),
method="SLSQP",
bounds=bounds,
constraints=constraints,
)
frontier_vols.append(result.fun)
frontier_vols = np.array(frontier_vols)The following plot displays the efficient frontier and the Capital Market Line, which shows the tangency portfolio.

The figure shows how the CML dominates the efficient frontier of risky assets alone. Any point on the CML (except the tangency point itself) offers either higher return for the same risk or lower risk for the same return compared to the efficient frontier. This dominance is the geometric representation of the benefit from adding a risk-free asset to the investment opportunity set. The CML essentially "lifts" investors above the constraints imposed by the curved efficient frontier; it has better combinations at every risk level except at the tangency point itself.