Portfolio Theory, CAPM, and Arbitrage Pricing Explained Simply
The second half of Chapter 5 in Artificial Intelligence in Finance covers three theories that shaped how Wall Street thinks about investing. Mean-Variance Portfolio theory, the Capital Asset Pricing Model, and Arbitrage Pricing Theory. These ideas have been in every finance course since the 1960s. Hilpisch walks through them with actual Python code instead of just abstract math.
Mean-Variance Portfolio Theory: The Markowitz Revolution
In 1952, Harry Markowitz published a paper called “Portfolio Selection.” It changed how people think about investing.
Before Markowitz, investors picked stocks one at a time. Good company? Buy it. Bad company? Skip it. Markowitz said forget individual stocks. Think about the whole portfolio. Think about how stocks move together.
His idea boils down to this. Investors care about two things: expected return (how much money they expect to make) and variance (how much that return bounces around). Return is good. Variance is bad. That’s the whole theory at its core.
You assign weights to each stock in your portfolio and calculate the combined expected return and variance. The math involves covariance matrices, but the concept is simple. Some stocks zig when others zag. Mix them right and you get decent returns with less risk than holding any single stock alone.
This is diversification. Your parents told you not to put all your eggs in one basket. Markowitz proved it mathematically.
The Efficient Frontier: Where the Magic Happens
If you randomly generate thousands of portfolio combinations and plot each one with risk on the x-axis and return on the y-axis, you get a bullet-shaped cloud. Finance people love this chart.
The top edge of that bullet is the efficient frontier. Any portfolio on that line gives you maximum return for a given level of risk. Portfolios below it are inefficient. You could do better without taking on more risk. No rational investor should hold one. At least, that’s what the theory says.
Hilpisch shows this with Python. He generates random portfolio weights, plots the bullet, then uses optimization to find two special portfolios: the minimum volatility portfolio (least risk possible) and the maximum Sharpe ratio portfolio (best risk-adjusted return).
The Sharpe ratio is basically return divided by volatility. Higher means more return per unit of risk. William Sharpe introduced it in 1966, and it’s still one of the most common ways to judge portfolio performance.
CAPM: One Model to Rule Them All
The Capital Asset Pricing Model came from Sharpe (1964) and Lintner (1965). It builds on Markowitz’s work and asks a bigger question. If everyone uses mean-variance optimization, what does the market look like in equilibrium?
The answer is clean. Every investor holds the same portfolio of risky assets: the market portfolio. Think of it as the S&P 500 or a total market index fund. Each investor then mixes it with a risk-free asset (like treasury bills) based on their risk tolerance. More aggressive? More market portfolio. More cautious? More treasuries. This is the two fund separation theorem.
The line connecting the risk-free asset to the market portfolio in risk-return space is the capital market line. Every optimal portfolio sits on it.
Now for the famous formula:
Expected return = risk-free rate + beta * (market return - risk-free rate)
Beta measures how much a stock moves with the market. Beta of 1 means it moves in lockstep. Beta of 2 means it swings twice as hard. Beta of 0 means no response to market movements.
The term (market return minus risk-free rate) is the market risk premium, the extra return investors demand for taking market risk instead of parking money in safe bonds.
The key insight: CAPM says only systematic risk matters. That’s market-wide risk you can’t diversify away. Company-specific risk? Doesn’t count. You can eliminate it by holding enough stocks. When the whole market drops, there’s nowhere to hide. That’s the risk investors get paid for.
The Assumptions Are… Optimistic
I want to pause here and be honest about something. These theories are built on assumptions that don’t hold up in the real world.
MVP theory works best when returns are normally distributed. Real stock returns are not. They have fat tails, meaning extreme events happen way more often than a bell curve predicts. The 2008 financial crisis, the 2020 COVID crash. A normal distribution says those should basically never happen. They keep happening.
CAPM assumes all investors have the same information, can borrow at the risk-free rate, and trade without costs. None of that is true. It also assumes investors only care about one period of returns. Real people have multi-year horizons, taxes, and mortgages.
Hilpisch actually flags this tension. He points out that MVP theory is not really compatible with standard expected utility theory (covered in the first half of this chapter). To make them consistent, you either need normally distributed returns (not realistic) or a specific type of quadratic utility function (which has its own problems). Neither solution is elegant.
Despite all this, these models are still taught everywhere and used in practice. That tells you something about how powerful a simple, intuitive model can be, even when it’s technically wrong.
Arbitrage Pricing Theory: CAPM’s Upgrade
Stephen Ross proposed Arbitrage Pricing Theory in the 1970s as an alternative to CAPM. His main critique? Why should the market portfolio be the only thing that drives stock returns?
APT says there are multiple risk factors that affect a stock’s return. These could be things like:
- Overall market movements
- Company size (small cap vs large cap)
- Value vs growth characteristics
- Momentum (stocks that went up tend to keep going up)
- Interest rates, inflation, GDP growth
The model is a linear regression with multiple factors. Each stock has different “loadings” on each factor. Some stocks are more sensitive to interest rates, others respond more to market-wide movements.
Hilpisch demonstrates this with a numerical example. He tries to replicate a new asset’s payoff using two risk factors. It doesn’t work perfectly because two factors can’t fully explain three possible states. But add a third factor and the replication becomes exact. The residual drops to zero. From those factor loadings, you can calculate an arbitrage-free price for the new asset.
The core idea: if you can replicate an asset’s payoff using other traded assets, its price must match the replicating portfolio’s cost. If it doesn’t, there’s a free lunch. Arbitrageurs will trade until that opportunity disappears.
What This All Means for AI in Finance
All three models assume linear relationships. CAPM is a linear equation. APT is multivariate linear regression. Portfolio returns are linear combinations of asset returns.
Hilpisch makes an important point in his conclusion. These theories are mathematically clean but have barely any meaningful empirical support. Returns aren’t normal. Relationships aren’t linear. And we now have the data and computational power to build models without these simplifying assumptions.
That’s where AI enters the picture. Neural networks don’t assume linearity. They can find patterns that regression would miss. Whether they actually do a better job at predicting markets is the question the rest of the book tries to answer.
But you need to know the old models first. Not because they’re correct, but because they’re the benchmark. Every new approach gets judged against them.
This post is part of a series reviewing “Artificial Intelligence in Finance” by Yves Hilpisch (O’Reilly, 2020, ISBN 978-1-492-05543-3).