Black-Scholes Derivation: From Replicating Portfolio to Closed Form
A complete derivation of the Black-Scholes formula via the replicating portfolio argument. From the stochastic differential equation to the boundary conditions to the d1, d2 closed form.
If you have ever opened a derivatives textbook, the first thing you saw was almost certainly the Black-Scholes formula. It is printed on mugs, embroidered on quants’ jackets, and quoted in every options explainer written since 1973. Most of those explainers treat it like scripture. This article treats it like a derivation that two guys figured out in a few weeks, because that is what it is.
Fischer Black and Myron Scholes published their model in 1973, and Robert Merton extended it the same year (Hull, 2018, Ch. 15). The paper is fifteen pages long and does not pull a PDE out of thin air. It pulls the PDE out of the observation that you can replicate an option payoff with a dynamic portfolio of the underlying and a risk-free bond. From there the rest is algebra.
The Setup
Let be the price of a non-dividend-paying stock at time , and let be the price of a derivative paying off at time . Assume:
- The stock follows geometric Brownian motion:
where is the drift, is the volatility, and is a standard Brownian motion under the physical measure.
- There is a constant risk-free rate , available for both borrowing and lending.
- Trading is continuous. No bid-ask spread. No transaction costs. You can go short.
- The stock pays no dividends.
The last three assumptions are how the model sells its soul to make the math clean. Drop any one and the closed form disappears (Hull, 2018, Ch. 15.1).
What we want is . We do not care about , and the fact that we will not need it is the entire trick.
The Replicating Portfolio
Construct a portfolio consisting of one short derivative and a position in the underlying stock:
The cash from selling the derivative finances the position. Over an infinitesimal time , the portfolio changes by:
By Itô’s lemma (Luenberger, 2013, Ch. 12), has a stochastic differential:
Subtract :
Now choose:
This makes the coefficient vanish. The diffusion risk is gone. Over , the portfolio is deterministic:
Because the portfolio is now riskless, it must earn the risk-free rate (otherwise arbitrage). If it earned more, you would borrow infinitely; less, you would short it:
Equate the two:
This is the Black-Scholes PDE. Note three things.
First, is gone. Drift does not enter the option price. This is the central point of the model and the foundation of risk-neutral pricing. It does not matter whether the market expects the stock to rise 20% per year or fall 5%; the option’s value is the same.
Second, the PDE has only one state variable () and three parameters (). Anything you change about the market’s view on drift is irrelevant. Volatility is the only nonlinear input you have to nail down.
Third, this is a backward heat equation in reverse time. It is parabolic and becomes explosively unstable if run forward. We solve it backward, from the payoff at to the present.
Boundary Conditions
For a European call paying , the terminal condition at is:
Two spatial boundaries. As , the call becomes worthless:
As , the call behaves like the stock minus the discounted strike:
This is the deep-ITM limit where exercise is essentially certain. For a put, the boundaries flip (Wilmott, 2007, Vol. 1, Ch. 5).
The Change of Variables
To solve the PDE, you could fire a finite-difference solver at it. Black and Scholes chose the brutal path of analytic solution, and we still benefit. They used the substitution:
which transforms the PDE into the canonical heat equation. More common in modern textbooks (Hull, 2018, Ch. 15.4) is to flatten first with:
Substituting, the discount factor’s -dependent terms cancel, and satisfies:
The terminal condition for is the same payoff as .
Now set , so . The PDE becomes:
This is the heat equation with a constant drift in the -direction. It has a known Green function, a Gaussian kernel, and integrating that kernel against the terminal payoff gives the solution.
The Characteristic Function Argument
The PDE on is symmetric in if you tilt by . The trick is to add a velocity to remove the drift, which means looking at in a moving frame.
Define , then in becomes:
The bonus term from the chain rule cancels the first-order derivative in the transformed PDE, and we’re left with the standard heat equation:
whose solution starting from terminal condition is convolution with a Gaussian:
For a call, , which equals zero for and for . Substituting and grinding through the algebra (it really is just grinding) gives (Hull, 2018, eq. 15.20):
where
and is the standard normal CDF.
This is the formula that appears on most pricing screens. Merton and Scholes received the Nobel Prize for this work; Black had died before the award.
The Put via Put-Call Parity
For a European put on the same underlying and same strike:
You can derive this directly or get it for free from put-call parity:
which holds identically for European options because you can replicate a forward by buying a call and selling a put (Hull, 2018, Ch. 11).
Interpreting the formula
Look at the call price .
The first term is the expected value of conditional on , in risk-neutral terms. The second term is the strike you pay, also in risk-neutral terms. Intuitively, the call is a probability-weighted stock value minus a probability-weighted strike. This is the discounted expectation of the payoff under the risk-neutral measure:
and are probabilities in the risk-neutral world. is the probability that the call finishes ITM. is the option’s delta, or hedge ratio.
This is the risk-neutral pricing interpretation and is mathematically equivalent to the PDE argument. Cox and Ross (1976) and Harrison and Kreps (1979) showed the general result: in a complete market, any derivative price equals the discounted expectation under the unique risk-neutral measure (Wilmott, 2007, Vol. 1, Ch. 7).
Numerical Sanity Check
A small implementation confirms that the math translates into code and that the price requires only one norm.cdf call once and are known.
from math import erf, log, sqrt
from scipy.stats import norm
def bs_call(S, K, r, sigma, T):
if T <= 0:
return max(S - K, 0.0)
d1 = (log(S / K) + (r + 0.5 * sigma**2) * T) / (sigma * sqrt(T))
d2 = d1 - sigma * sqrt(T)
return S * norm.cdf(d1) - K * exp(-r * T) * norm.cdf(d2)
Try , , , , . You should get . The corresponding delta is . If your hedge book is short 10,450 contracts worth of calls, you are long 6,400 shares. Discrepancies from that ratio show up immediately as P&L moves that scale 1-for-1 with the stock, meaning you are under- or over-hedged.
Where the Derivation Breaks
The PDE holds as long as you can replicate continuously with no friction. When you violate one of those assumptions, the closed form stops holding exactly:
- Discrete trading. Hedging at intervals leaves residual variance. Hull calls the discrete-hedge P&L the “volatility drag”: realized variance is slightly different from the pathwise variance of the stock, and hedging P&L depends on the time interval.
- Transaction costs. Every rebalance costs money; the optimal hedge now involves a tradeoff between tracking error and cost (Luenberger, 2013, Ch. 14).
- Jumps. When the stock can gap, your hedge fails between trades. Merton’s (1976) jump-diffusion handles this.
- Stochastic volatility. When is itself random, you cannot fully hedge. Volatility becomes a second source of risk.
Each of these is a separate research paper, and most of them are on the syllabus for a quant interview.
How to Read the Formula Two Other Ways
Once you have the closed form, several equivalent views help build intuition.
The Straddle Decomposition
Adding a put and a call at the same strike recovers the famous straddle pricing formula for an ATM strike (or, more cleanly, adjusting for carry):
Wait, that’s not quite right. The correct formula for an ATM straddle using put-call parity:
For , this simplifies to , which for small is approximately . That’s the famous formula: ATM straddle price equals approximately . For S&P at 4500 with and , that’s 4500 \cdot 0.20 \cdot \sqrt{2/12\pi} \cdot 0.4 \approx \83$, which matches the one-month ATM straddle price you see on the screen.
The Hedged-Payoff View
Consider a trader who is long a call and short shares. By Black-Scholes, . The position has a modified payoff, meaning the instantaneous P&L from holding the hedged position over a short period. The expected value of this modified payoff over is:
Integrating over the option’s life gives the cost of the hedge, which equals the option premium. This is sometimes called the “Black-Scholes gain diagram” and is useful for thinking about where the option premium comes from. Most of the premium is collected early in the option’s life, when gamma is highest.
The Distribution View
The price is, again:
where is the lognormal density with mean and variance . Computing the integral:
Verifying Black-Scholes makes the broader point: the price depends only on the distribution of , not on the dynamics. This is why risk-neutral pricing works. The option price summarizes the market’s view of the future spot distribution. You can invert this in principle: observed option prices imply a risk-neutral distribution (Breeden-Litzenberger, 1978), which can be compared with your model-implied distribution.
A Slightly Deeper Look at the Discounted Expectation
The risk-neutral pricing formula:
is more than just a way to write Black-Scholes. It is the operational version: if you can compute expected payoffs under the risk-neutral measure, you can price any European option (Hull, 2018, Ch. 15.6; Wilmott, 2007, Vol. 1, Ch. 7).
The risk-neutral measure is defined by the Radon-Nikodym derivative:
where is the physical Brownian motion. Under , the stock drift becomes rather than . This is Girsanov’s theorem: measure change to a numeraire, applied to the stock.
Practically, this means two things. First, when you run Monte Carlo under the risk-neutral measure, using as the drift, you get the option price directly. You do not need to know . Second, when you calibrate to historical stock returns to estimate , that estimate is irrelevant for option pricing. You need historical and the current term structure.
The catch: matters for hedging effectiveness. When you construct a delta-hedge, your realized P&L depends on the realized stock returns vs. the implied . So historical enters the backtest but not the price.
Common Numerical Pitfalls
When you implement Black-Scholes, several numerical details cause trouble more often than they should.
d1 and d2 need to be computed as floats with care. Floating-point rounding in for exactly produces and breaks some software. Defensive code:
d1 = math.log(S / K) + (r + 0.5 * sigma * sigma) * T
d1 /= sigma * math.sqrt(T)
Explicit max(S, 1e-12) at the start of the function avoids crashes. Use math.log(S / K) instead of math.log(S) - math.log(K) if you care about monotonicity in .
Near expiry. As , the formula approaches , but floating-point division can produce nonsense. Most production code guards with and returns intrinsic.
Far OTM puts or calls. For deep OTM options, and are tiny. Their difference can lose 6-7 digits of precision. Use log-space implementations:
Standard libraries like scipy handle this internally, but if you’re writing your own normal CDF from scratch, check the tail behavior against scipy.
A Useful Cross-Check: Put-Call Parity
For European options on the same underlying with the same and :
The right-hand side doesn’t depend on volatility. This is a non-trivial fact. If your code produces prices with depending on , something is wrong.
For multiple strikes and the same , plot versus . It should be a linear function with slope and intercept . A deviation from linearity is your visual diagnostic for a coding error.
A Brief Historical Note
In 1900, Louis Bachelier published Théorie de la Spéculation, a PhD thesis at the Sorbonne. It modeled the French bond market as Brownian motion, five years before Einstein’s famous paper on the same subject. Bachelier derived a formula for the price of options on French bonds. The Bachelier call formula is:
where is the standard normal PDF. Equivalently, with :
The first term is the intrinsic-value-weighted moneyness probability; the second is the diffusion term that captures expected additional movement in the underlying between today and expiry. Without that diffusion term, the formula collapses to intrinsic value at expiry and produces nonsense. The credit is missing on every options textbook. Bachelier’s teacher Henri Poincaré was interested, but no one in finance picked it up.
Black and Scholes knew of Bachelier’s work. They improved it by using log-returns (which are stationary, not levels) and adding a discount factor. Merton’s contribution was to recognize that the result generalized to a much wider class of payoffs under no-arbitrage. Their trio won the 1997 Nobel Prize (Black having died in 1995).
The story is worth knowing because it’s the rare case where the academic version of a quantitative model came out after market practice. Bond traders and dealers were running option-like strategies on equities for decades before 1973. The CBOE opened in 1973 partly because the formula gave dealers a way to quote fair prices consistently.
What You Should Be Able to Derive From Scratch
After absorbing this article, you should be able to:
- From the replicating portfolio argument, derive the Black-Scholes PDE.
- Show the time-to-expiry direction in the heat equation transformation.
- Connect the PDE solution to the closed-form via the risk-neutral expectation.
- Verify the put-call parity and the relationship .
- Justify the formula’s validity under the frictionless market assumption.
If you can’t do at least four of these on a scratch sheet, you should re-read the article before proceeding.
Why This Derivation Is the Right Place to Start
Every other model in this module, including local volatility, stochastic volatility, and jump-diffusion, is either a modification of the Black-Scholes PDE or a generalization of the risk-neutral pricing argument. The closed form is a special case of a broader class of results. Once you have the derivation above, later derivations look like variations on the same theme.
The main point is that the Black-Scholes formula is not a fact about markets. It is a logical consequence of a small set of assumptions: continuous trading, no transaction costs, no dividends, and a single risky asset following geometric Brownian motion. When people argue about whether the formula “is true,” they are usually arguing about whether those assumptions hold. They do not, and that is what the rest of this module addresses.
Reading list. Hull, Options, Futures, and Other Derivatives, 10th ed., Ch. 13-15 (2018). Wilmott, Paul Wilmott on Quantitative Finance, 2nd ed., Vol. 1, Ch. 5-8 (2007). Luenberger, Investment Science, 2nd ed., Ch. 12-14 (2013). Press et al., Numerical Recipes, 3rd ed., Ch. 20 (2007) for the PDE discretization that connects this to finite differences.