Black-Scholes-Merton: hedging, PDE and change of measure
Derive Black-Scholes from self-financing hedging and a change of measure, interpret its probabilities, and connect PDEs with pricing under alternative numeraires.
After this lesson you can
- Derive the Black-Scholes PDE using Itô's lemma and a self-financing riskless portfolio.
- Apply Girsanov's theorem and market price of risk to obtain risk-neutral dynamics.
- Calculate the lognormal Black-Scholes expectation and interpret N(d₁) and N(d₂).
- Use Feynman-Kac to connect the pricing PDE with risk-neutral expectation.
- Generalize to continuous dividends, currencies and changes of numeraire.
Before you start
- 28Risk-neutral measureOne-period replicationCox-Ross-Rubinstein binomial treeConvergence of the binomial treeForward contract
- 26Itô's lemmaGeometric Brownian motionThe Itô integral as a martingaleItô integralGirsanov theoremNovikov conditionFeynman-Kac formula
- 04Heavy-tailed distributionsMoment generating function
- 03Heat equationClassification and well-posedness of PDEs
A hedge that removes the noise
In the previous lesson’s tree we replicated two payoffs by adjusting stock and bond at each node. In the continuous limit the same idea gives a differential equation. Assume a costless market with borrowing and short sales at constant rate , continuous trading, a positive stock and constant volatility . Under physical measure ,
For now there are no dividends. For a sufficiently regular European derivative , Itô’s lemma gives
Sell an option and hold shares. The random term in vanishes. The portfolio also includes a financing account; on rebalancing, position changes are paid from that account rather than external contributions. No arbitrage requires its instantaneous return to be . Equating terms and canceling yields the Black-Scholes PDE:
The disappearance of does not mean beliefs cannot affect stock price or that real risk vanishes. Given , , and these assumptions, replication fixes price without an additional risk premium. A call payoff has a kink at the strike; under these conditions the solution is smooth for , though not at maturity.
The account matters. If a replicating portfolio has wealth , its self-financing condition without dividends is . Changing requires transferring the cost to the account; writing only without that financing introduces terms that do not represent a free strategy. If the asset pays , the stock portfolio receives that flow and the PDE changes the coefficient of from to .
Change the measure, keep the paths
Let be the market price of risk per unit of volatility. For constants and a finite horizon, the density
is positive and has expectation one. Novikov’s condition holds for constant ; for general processes it or another sufficient condition must be checked. Girsanov identifies as Brownian motion under , so
changes path weights, not possible paths. In this complete model without dividends, is a martingale under and the stochastic discount factor is under . The change does not say that expected physical return is .
Equivalence matters: almost surely, so an event impossible under one measure remains impossible under the other. The bond acts as numeraire. In a market with untraded risk sources, hedging may not exist and no arbitrage may allow multiple risk-neutral measures; this construction alone then does not determine a unique price.
With independent weights, , so the asymptotic effective-size ratio is . Physical drift far from risk-neutral drift concentrates weights: the expectation identity remains true, but naive simulation may have high variance. The lab quantifies that difference without treating approximate agreement as exact sample equality.
The formula and its probabilities
With continuous dividend and time remaining , ex-dividend dynamics under have drift . Write
The Black-Scholes-Merton formula for European calls and puts is
To obtain it, separate from . The logarithm of is normal; completing the square in the first integral shifts its mean by . Thus the second term contains and the first . The first is a stock-weighted expectation, not merely a probability under .
More explicitly, for , and exercise is equivalent to . The identity transforms the weighted integral to . Discounting gives . The put follows from parity, which can also be constructed with stock, bond and both options.
With , and is the probability of the same event under the measure whose numeraire is the stock. It is also call delta. With continuous dividends, delta is ; the appropriate numeraire is the total-return portfolio reinvesting dividends, not the unadjusted ex-dividend stock.
Use annual and in years. At maturity return the payoff directly; for return the discounted deterministic payoff without dividing by zero. The formula should not price an American option with early exercise without checking its conditions.
From the PDE to expectation and other numeraires
Feynman-Kac connects both routes: under suitable regularity and growth, discounted expectation solves the PDE with terminal condition. Conversely, applying Itô to under removes drift if satisfies the PDE; with integrability, the resulting martingale recovers the expectation. With , replace by .
The change and converts into a second derivative with constant coefficient. A translation of removes drift and an exponential factor removes the discount term, leaving the heat equation. Gaussian convolution smooths the payoff for ; it does not remove the kink at .
Specifically, if , then . With and , . For the call, the relevant boundary is and, as , . The finite surface window does not literally represent those infinite limits.
Numeraire pricing uses a positive traded asset : . Discount and measure must change together. For currencies, treating the foreign rate as gives Garman-Kohlhagen, with domestic . For forward lognormal under the maturity-bond measure, Black gives with . These are dynamics assumptions, not automatic substitution of every futures contract by a forward.
To exchange one asset for another without dividends, Margrabe’s (1978) formula uses the second asset as numeraire: , with relative volatility and . If relative volatility is zero take the deterministic limit. These formulas share replication logic, but not the same units of account.
Lab: three routes to price
The formula uses SciPy’s normal CDF, the tree is CRR and Monte Carlo simulates directly under . Seed and path count make the comparison reproducible; the interval measures only sampling error in this model.
import numpy as np
from scipy.special import ndtr
def bs_price(S,K,r,q,sigma,T,kind='call'):
S,K,r,q,sigma,T=np.broadcast_arrays(*[np.asarray(x,dtype=float) for x in (S,K,r,q,sigma,T)])
if np.any(S<=0) or np.any(K<=0) or np.any(T<0) or np.any(sigma<0) or kind not in ('call','put'): raise ValueError('Parámetros inválidos')
a=sigma*np.sqrt(T); safe=np.where(a>0,a,1.); d1=(np.log(S/K)+(r-q+.5*sigma*sigma)*T)/safe; d2=d1-a
c=np.where(a>0,S*np.exp(-q*T)*ndtr(d1)-K*np.exp(-r*T)*ndtr(d2),np.maximum(S*np.exp(-q*T)-K*np.exp(-r*T),0))
return c if kind=='call' else c-S*np.exp(-q*T)+K*np.exp(-r*T)
def tree(S,K,r,q,sigma,T,n):
dt=T/n; u=np.exp(sigma*np.sqrt(dt)); d=1/u; p=(np.exp((r-q)*dt)-d)/(u-d)
if not 0<p<1: raise ValueError('Árbol con arbitraje')
j=np.arange(n+1); v=np.maximum(S*u**(2*j-n)-K,0)
for i in range(n-1,-1,-1): v=np.exp(-r*dt)*((1-p)*v[:-1]+p*v[1:])
return v[0]
S,K,r,q,sigma,T=100.,105.,.03,0.,.25,.5
exact=bs_price(S,K,r,q,sigma,T); put=bs_price(S,K,r,q,sigma,T,'put')
g=np.random.default_rng(281101); z=g.standard_normal(200000); terminal=S*np.exp((r-q-.5*sigma*sigma)*T+sigma*np.sqrt(T)*z)
pay=np.exp(-r*T)*np.maximum(terminal-K,0); mc=pay.mean(); se=pay.std(ddof=1)/np.sqrt(len(pay))
print('BS call',float(exact),'put',float(put),'residuo paridad',float(exact-put-S*np.exp(-q*T)+K*np.exp(-r*T)))
print('CRR 100 y 500',[tree(S,K,r,q,sigma,T,n) for n in (100,500)])
print('MC',mc,'intervalo normal 95 %', (mc-1.96*se,mc+1.96*se))In this run, the formula gives 5.575977, CRR with 100 and 500 steps gives 5.590523 and 5.574481, and Monte Carlo gives 5.626326 with approximate interval [5.580827, 5.671824]. Here the interval misses the reference: a 95% interval can fail in a particular sample. The tree also oscillates with step count. Parity is an identity of formulas with the same units and inputs; a near-zero residual checks implementation, not whether the model describes the market.
S,K,r,sigma,T=100.,100.,.03,.25,1.; g=np.random.default_rng(281102); z=g.standard_normal(200000)
for mu in (.03,.13,.33):
theta=(mu-r)/sigma; wt=np.sqrt(T)*z; weight=np.exp(-theta*wt-.5*theta*theta*T)
st=S*np.exp((mu-.5*sigma*sigma)*T+sigma*wt); sample=np.exp(-r*T)*weight*np.maximum(st-K,0)
ess=weight.sum()**2/np.sum(weight**2); se=sample.std(ddof=1)/np.sqrt(len(sample))
print('mu',mu,'valor',round(sample.mean(),5),'EE',round(se,5),'media peso',round(weight.mean(),5),'ESS/N',round(ess/len(sample),4),'límite',round(np.exp(-theta*theta*T),4))
print('referencia BS',float(bs_price(S,K,r,0,sigma,T)))Weights are the exact density and are not renormalized to calculate expectation. ESS uses normalized weights only as a diagnostic; as grows, a few observations can dominate and sample mean weight can move away from one. In this run relative ESS moves from 1 to 0.2423 as varies from 0.03 to 0.33; the call reference is 11.34848. Variance of a particular weighted payoff need not increase with weight variance: in this example payoff standard error decreases. Comparing with the formula and standard error helps detect weight deterioration but does not correct variance.
Exercises
Step 1 of 3. What number of shares eliminates dW?
Step 1 of 3. How is the payoff separated?
def bs_price(S,K,r,q,sigma,T,kind):
raise NotImplementedError()Ideas to remember
Hedging and change of measure yield the same price under common assumptions. The PDE describes local evolution; risk-neutral expectation describes terminal payoff. The numeraire changes both measure and units. With real data, discrete trading, costs, jumps and variable volatility limit the ideal replication of Black and Scholes (1973).