A desk that holds an option is mindful that its P&L should not depend on where the stock happens to go. If it does nothing, it is carrying a directional bet. The page asks: how can that exposure be removed, and what remains afterwards?

The answer is delta hedging. Hold shares against the option and rebalance them through time so the option's first-order exposure to stock moves is cancelled. The page measures what that buys: the hedge removes direction and, with it, drift; the remaining spread shrinks as rebalancing becomes more frequent. For a forward, where Γ=0\Gamma = 0, the hedge is exact.

What is left is the important part. The hedge does not remove curvature. The remaining P&L comes from gamma acting on realised quadratic variation. When realised and implied variance are the same, that residual is centred near zero and its spread falls with more rebalancing. When they differ, the hedger earns or loses an amount proportional to

(σr2−σi2)∑e−rt⋅12ΓS2 dt,(\sigma_r^2 - \sigma_i^2) \sum e^{-rt} \cdot \tfrac12\Gamma S^2 \,\dt,

with the gamma integral itself varying from path to path.

So the reader leaves with a change of viewpoint: after delta hedging, the option is no longer primarily a directional position. First-order exposure to direction and drift has been removed; what remains is a gamma-weighted exposure to realised variance. The PDE is the mathematical statement of that transformation.

What this page shows, and how

A hedger who holds an option faces three practical decisions: how often to rebalance, what to do about the stock's drift, and which volatility to hedge at. This page answers all three with measurements first and theory afterwards.

How often should you rebalance? The page runs the same paths with different rebalance counts and measures the final hedged P&L. The reader sees the spread shrink as rebalancing becomes more frequent, while a forward remains exact at every rebalance count. The wrong answers are "hedging makes the P&L exactly zero" and "the spread falls like 1/N1/N".

What should you do about the drift? The page reruns the hedge under strongly negative, zero and strongly positive drifts. The reader sees the unhedged option depend heavily on drift, while the hedged book becomes effectively drift-blind once rebalancing is reasonably frequent. The wrong answer is "a hedger needs a view on where the stock is going".

Which volatility should you hedge at? The page prices and hedges at one volatility while the stock moves at another. The reader sees that the hedge earns when realised variance exceeds the variance assumed in the price, and loses when it falls short. The wrong answers are "the hedge removes all risk" and "the P&L is proportional to volatility itself".

Only after those measurements does the page explain why. The derivation shows how delta hedging removes first-order exposure to stock moves and drift, derives the Black–Scholes PDE, and checks both the PDE and the hedge's bookkeeping directly against the measured results.

The experiment — what was done

The experiment starts from 2.6's stock model and steps the stock exactly using the closed-form Geometric Brownian motion (GBM) step, never an Euler approximation. A single set of 4,000 Brownian paths is generated on a 4,096-step grid, and those same paths are then hedged at eight rebalance frequencies, N=1,2,4,16,64,256,1024,4096N = 1, 2, 4, 16, 64, 256, 1024, 4096, so that only the hedging frequency changes and the underlying paths do not. N=1N = 1 is a static hedge, set once at inception and never updated.

The base case uses S0=K=100S_0 = K = 100, T=1T = 1, r=0.05r = 0.05, μ=0\mu = 0, and σ=0.4\sigma = 0.4. The option is a European call with initial value V0=18.02V_0 = 18.02. At inception the reader buys one call, shorts Δ=∂V/∂S\Delta = \partial V/\partial S shares, the option's delta, and places the cash balance in the risk-free account. At each rebalance date the cash accrues interest, the share position is reset to the new Δ\Delta, and the cost of the adjustment is taken from or added to cash. At expiry the option pays off, the shares are bought back, and the remaining cash is the hedge's P&L.

Three further experiments change one thing at a time. The drift is rerun at μ=−0.2\mu = -0.2 and μ=+0.3\mu = +0.3 to test whether the hedge depends on the stock's expected direction. The volatility is rerun with the stock moving at σ=0.3\sigma = 0.3 and σ=0.5\sigma = 0.5 while the option is still priced and hedged at σ=0.4\sigma = 0.4, to test what happens when realised and implied variance differ. Alongside every call hedge, a forward is hedged on the same paths using Δ=1\Delta = 1, providing a linear-payoff control.

The option price and delta are taken from the closed-form formula derived in 2.9, but on this page that formula is treated only as a candidate pricing function. Its derivatives are substituted into the Black–Scholes PDE and checked numerically on the paths and on a grid. The hedge therefore uses the formula because it passes the PDE test, not because the derivation has yet been accepted.

Throughout the page the position is described from the buyer's side. A seller would see exactly the same results with every P&L sign reversed. The hedge mechanics, the PDE, and the measured errors are unchanged.

D5Delta-hedging simulator

seed 20261101 · 4,000 paths · μ = 0 · σ_r = 0.4 · σ_i = 0.4 · S₀ = K = 100 · r = 0.05

V₀, at σ_i
18.02
fitted slope, N ≥ 4
−0.488
hedged mean, N = 256
−0.01 ± 0.01
hedged sd, N = 256
0.874sd × √N = 14.0
unhedged mean
−3.11 ± 0.47closed form −3.10
unhedged sd
29.6closed form 29.8
discounted hedged mean
−0.01 ± 0.01(σ_r² − σ_i²) × gamma integral: +0.00 × 46.8 = +0.00
forward: max |P&L|
2e−12Δ = 1, N = 256
live sample: hedged mean
+0.01 ± 0.03781 paths, this site’s generator
live sample: hedged sd
0.8870 off the bins
committed bars
N = 2560 past ±20
unhedged, past the axis
5.0 %beyond 60
Source
Drift μ
Realised vol σ_r

The experiment’s first five paths, hedged at N = 256, at μ = 0 and σ_r = σ_i = 0.4, whatever is set above.

path 1: S_T
75.11
path 1: P&L at T
+1.37
path 2: P&L at T
+0.14
path 3: P&L at T
+1.07
path 4: P&L at T
−0.46
path 5: P&L at T
−0.74

The ladder, the bars and the readouts above the live sample are the committed experiment: 4,000 paths drawn once at 4,096 steps and hedged at each N, P&L at T unless marked discounted. The experiment kept its histograms at N = 1, 256 and 4096; the line is a fresh sample on this site’s generator, which is not numpy’s. The fitted slope is −0.488 against a theoretical −½.

How often should you rebalance?

Hedged P&L by rebalance count

The same 4,000 paths at every NN: S0=K=100S_0 = K = 100, r=0.05r = 0.05, μ=0\mu = 0, σ=0.4\sigma = 0.4, T=1T = 1, P&L at TT. N=1N = 1 is the static hedge. Seed 20261101, from the committed experiments/2_7_delta_hedging.json: results.scenarios.base.per_N[*].call.{hedged_pnl_T,sd_times_sqrtN,unhedged_pnl_T} and .forward.pnl_T_max_abs. The forward's column is rounded to one figure.

NNhedged P&L: sd⁡\sdsd⁡×N\sd \times \sqrt{N}hedged mean ± s.e.unhedged P&L: sd⁡\sdforward: max ∣P&L∣\lvert \text{P\&L} \rvert
1 (static)11.811.8+0.30 ± 0.1929.63×10−143 \times 10^{-14}
28.8612.5+0.25 ± 0.1429.63×10−143 \times 10^{-14}
46.5013.0+0.19 ± 0.1029.63×10−143 \times 10^{-14}
163.4113.6+0.05 ± 0.0529.62×10−132 \times 10^{-13}
641.7213.8+0.00 ± 0.0329.63×10−133 \times 10^{-13}
2560.87414.0−0.01 ± 0.0129.62×10−122 \times 10^{-12}
10240.44014.1−0.002 ± 0.00729.67×10−127 \times 10^{-12}
40960.22214.2−0.002 ± 0.00429.64×10−114 \times 10^{-11}

The table shows the same 4,000 paths hedged at eight rebalance frequencies. As NN increases from 4 to 4096 the spread of the hedged P&L falls from 6.50 to 0.22 while sd⁡×N\sd \times \sqrt{N} stays near 13–14: each fourfold increase in rebalancing roughly halves the spread, so more trading buys a narrower distribution, not a different centre. The centre is already close to zero and, from N=64N = 64 onward, is zero within standard error. What rebalancing reduces is not a bias but the uncertainty left by discrete hedging; the wrong expectation is "enough hedging makes the P&L exactly zero", and the measurement is that it makes the distribution progressively tighter around zero.

The unhedged spread of 29.6 is not another point on the same curve. A static hedge at N=1N = 1 already removes the option's linear exposure and reduces the spread to 11.8; rebalancing then attacks the remaining curvature, shrinking 11.8 to 6.50, 3.41, 1.72 and eventually 0.22. The unhedged number answers a different question: what happens if the option is never hedged at all?

Beside the call sits the forward. Hedged with Δ=1\Delta = 1, its P&L is zero to rounding error, never exceeding 5×10−115 \times 10^{-11} on any path at any NN. Because a forward has Γ=0\Gamma = 0, its linear exposure can be removed once and exactly, and in a sense that is the point of the whole course: linear payoffs need no continuous-time machinery; curvature is what makes hedging and the PDE necessary. At the coarsest grids a small positive mean remains visible (+0.19 ± 0.10 at N=4N = 4), the trace left by a hedge that is only reset once per quarter; by N=64N = 64 that trace is lost in the measurement noise.

What should you do about the drift?

Hedged and unhedged P&L by drift

Three fresh sets of 4,000 paths, σ=0.4\sigma = 0.4, hedged at 0.4, P&L at TT, from results.scenarios.{drift_down,base,drift_up}.per_N[*].call.{hedged_pnl_T,unhedged_pnl_T,unhedged_closed_form}. The figure in brackets is the closed form under μ\mu, not a measurement.

μ\muhedged mean, N=4N = 4hedged mean, N=64N = 64hedged mean, N=4096N = 4096hedged sd⁡\sd, N=64N = 64hedged sd⁡\sd, N=4096N = 4096unhedged mean (closed form)unhedged sd⁡\sd
−0.2+0.69 ± 0.09+0.02 ± 0.03−0.004 ± 0.0031.630.208−11.67 (−11.86)19.6
0+0.19 ± 0.10+0.00 ± 0.03−0.002 ± 0.0041.720.222−3.11 (−3.10)29.6
+0.3+0.72 ± 0.11+0.07 ± 0.03−0.002 ± 0.0031.690.209+22.07 (+22.06)51.5

The table shows three different stocks: one that drifts down (μ=−0.2\mu = -0.2), one that does not drift (μ=0\mu = 0), and one that drifts strongly up (μ=0.3\mu = 0.3). For each, it reports the hedged P&L at three rebalance frequencies and compares it with the unhedged option. The question is simple: does a hedger need a view on where the stock is going?

The unhedged position clearly does. As μ\mu moves from −0.2 to +0.3, the mean P&L moves from −11.7 to +22.1, and the spread grows from 19.6 to 51.5. The stock's drift changes both what the option expects to earn and how uncertain that outcome is.

The hedged book behaves differently. From N=64N = 64 onward, the mean is zero and the spread is unchanged across all three drifts, within five standard errors — the tolerance every check on this page uses. A short share position does not "bleed in a rally", because the option it is held against gains what the shares lose, to first order in the stock move. What remains is the part of the hedge that depends on curvature rather than direction.

This is what the derivation means when it says that μ\mu disappears. It vanishes from the hedged book, not from the stock. The stock still drifts; the hedge is arranged so that the portfolio's first-order exposure to that drift is continually removed.

The static hedge shows why the word "continually" matters. With N=1N = 1, the share position is set once and never updated. At μ=0.3\mu = 0.3 its spread is 17.6 rather than 11.8, and its mean is +3.5 ± 0.3. A delta that was right at inception becomes stale as the stock moves away from where it was set. Rebalancing is what keeps removing the exposure that drift keeps trying to reintroduce.

At the coarsest rebalanced grid, N=4N = 4, a strong drift still leaves a visible trace: the mean is +0.72 ± 0.11 at μ=0.3\mu = 0.3 against +0.19 ± 0.10 at μ=0\mu = 0, but that trace shrinks with more frequent rebalancing and is within five standard errors of zero by N=64N = 64.

Which volatility should you hedge at?

Discounted hedged P&L by realised vol

The option priced and hedged at σi=0.4\sigma_i = 0.4, the stock moving at σr\sigma_r, μ=0\mu = 0, N=4096N = 4096, every P&L discounted to today, from results.scenarios.{vol_low,base,vol_high}.realised_vol.mean and .per_N[7].call.{hedged_pnl_discounted,gamma_dt_mean,gamma_dt_se}. The gamma integral's sd⁡\sd is gamma_dt_se × 4000\sqrt{4000}.

σr\sigma_rrealised vol, measuredmean hedged P&L ± s.e.(σr2−σi2)×E[∑e−rt⋅12ΓS2 dt](\sigma_r^2 - \sigma_i^2) \times \E[\sum e^{-rt} \cdot \tfrac12\Gamma S^2 \,\dt]hedged P&L: sd⁡\sdgamma integral: sd⁡\sd
0.30.3000−3.76 ± 0.02−0.07×53.7=−3.76-0.07 \times 53.7 = -3.761.2517.6
0.40.39990.00 ± 0.0030×46.8=00 \times 46.8 = 00.2118.0
0.50.5000+3.74 ± 0.03+0.09×41.6=+3.74+0.09 \times 41.6 = +3.741.6217.7

The table isolates the one assumption the hedge cannot remove: the volatility used to price and hedge the option. In all three runs the option is priced and delta-hedged at σi=0.4\sigma_i = 0.4; only the stock changes, moving with realised volatility σr=0.3\sigma_r = 0.3, 0.4, or 0.5. The question is what a hedger earns once direction and drift have largely been removed. The P&Ls in this section are discounted to today, because that is the form in which the prediction below is exact.

The answer is: the hedger is paid for variance the stock delivers above what the option price assumed, and pays for variance it fails to deliver. With realised volatility 0.5 the hedged position earns +3.74 ± 0.03; with realised volatility 0.3 it loses 3.76 ± 0.02; when realised and implied volatility agree, the mean P&L is zero within error. The sign comes directly from the variance gap. More realised variance than the price budgeted for produces a gain; less produces a loss.

The quantity that matters is variance, not volatility. The prediction is

(σr2−σi2)⋅E[∑e−rt⋅12ΓS2 dt],(\sigma_r^2 - \sigma_i^2) \cdot \E\left[\sum e^{-rt} \cdot \tfrac12\Gamma S^2 \,\dt\right],

and the measurements match it: −0.07×53.7=−3.76-0.07 \times 53.7 = -3.76, 0×46.8=00 \times 46.8 = 0, and 0.09×41.6=+3.740.09 \times 41.6 = +3.74. The hedge is therefore exposed to a difference in variances, σr2−σi2\sigma_r^2 - \sigma_i^2, not to volatility itself.

The other quantity in the formula is the gamma integral,

∑e−rt⋅12ΓS2 dt,\sum e^{-rt} \cdot \tfrac12\Gamma S^2 \,\dt,

which measures how much gamma the path actually delivered. It varies from path to path because gamma is large near the strike and small far from it. A path that spends most of the year near KK accumulates a great deal of gamma; a path that quickly runs far in or out of the money accumulates much less. In the σr=0.5\sigma_r = 0.5 run the gamma integral has mean 41.6 but standard deviation 17.7 across the 4,000 paths.

That variation explains the spread that remains even with almost continuous hedging. At N=4096N = 4096, where the ordinary hedging error has been reduced to 0.21, the volatility-mismatch runs still have spreads of 1.25 and 1.62. The gamma integral's standard deviation of 17.7, multiplied by the variance gap 0.09, predicts a spread of 1.60; the measured value is 1.62. The remaining uncertainty is therefore not hedging error. It is the uncertainty in how much gamma this particular path happened to deliver.

A useful preview of 2.10 is that the hedge removes the stock's direction but not its activity. Once direction and drift are gone, the option's P&L becomes a statement about realised variance interacting with gamma.

Why — from dV to the PDE

The derivation begins where 2.6 ended: with the option value treated as a function V(t,S)V(t, S) of both time and stock price. Applying Itô's lemma to that function gives

dV=(∂V∂t+μS⋅∂V∂S+12σ2S2⋅∂2V∂S2)dt+σS⋅∂V∂S dW.\begin{aligned} \dd V = {} & \left( \frac{\partial V}{\partial t} + \mu S \cdot \frac{\partial V}{\partial S} \right. \\ & \quad \left. {} + \tfrac12\sigma^2 S^2 \cdot \frac{\partial^2 V}{\partial S^2} \right) \dt \\ & {} + \sigma S \cdot \frac{\partial V}{\partial S} \,\dW. \end{aligned}

The new feature is that the option changes not only because the stock moves but because time passes.

Next comes the hedged portfolio,

Π=V−ΔS,\Pi = V - \Delta S,

where Δ\Delta is the number of shares held short against the option.

Over a single hedge interval, Δ\Delta is held fixed. That is what "rebalance" means: choose a Δ\Delta, hold it through the step, then reset it at the next grid point. With Δ\Delta fixed over the step,

dΠ=dV−Δ dS.\dd\Pi = \dd V - \Delta \,\dS.

Substituting the stock process

dS=μS dt+σS dW\dS = \mu S \,\dt + \sigma S \,\dW

and collecting terms gives

dΠ=(∂V∂t+12σ2S2⋅∂2V∂S2)dt+(∂V∂S−Δ)⋅μS dt+(∂V∂S−Δ)⋅σS dW.\begin{aligned} \dd\Pi = {} & \left( \frac{\partial V}{\partial t} + \tfrac12\sigma^2 S^2 \cdot \frac{\partial^2 V}{\partial S^2} \right) \dt \\ & {} + \left( \frac{\partial V}{\partial S} - \Delta \right) \cdot \mu S \,\dt \\ & {} + \left( \frac{\partial V}{\partial S} - \Delta \right) \cdot \sigma S \,\dW. \end{aligned}

The important observation is that both the drift term and the noise term enter through the same factor,

(∂V∂S−Δ).\left( \frac{\partial V}{\partial S} - \Delta \right).

Choosing

Δ=∂V∂S\Delta = \frac{\partial V}{\partial S}

therefore removes both together. The dW\dW term disappears, and the μ\mu term disappears with it. What remains is

dΠ=(∂V∂t+12σ2S2⋅∂2V∂S2)dt.\dd\Pi = \left( \frac{\partial V}{\partial t} + \tfrac12\sigma^2 S^2 \cdot \frac{\partial^2 V}{\partial S^2} \right) \dt.

This is the crucial point: the result is not zero. The hedge removes the stock's noise and drift, leaving a portfolio whose evolution is known over the next instant.

A locally risk-free portfolio must earn the risk-free rate on the capital tied up in it. The amount invested in the hedge is

V−ΔS,V - \Delta S,

so

dΠ=r(V−ΔS) dt.\dd\Pi = r(V - \Delta S) \,\dt.

Equating the two expressions for dΠ\dd\Pi gives

∂V∂t+12σ2S2⋅∂2V∂S2=r(V−S⋅∂V∂S),\frac{\partial V}{\partial t} + \tfrac12\sigma^2 S^2 \cdot \frac{\partial^2 V}{\partial S^2} = r\left(V - S \cdot \frac{\partial V}{\partial S}\right),

or, rearranged,

∂V∂t+12σ2S2⋅∂2V∂S2+rS⋅∂V∂S−rV=0.\frac{\partial V}{\partial t} + \tfrac12\sigma^2 S^2 \cdot \frac{\partial^2 V}{\partial S^2} + rS \cdot \frac{\partial V}{\partial S} - rV = 0.

That is the Black–Scholes PDE. The stock's drift μ\mu has disappeared; the quantities that remain are rr, σ\sigma, and the option's sensitivities.

On a discrete hedge grid there is one further step. A second-order Taylor expansion gives

δV≈Θ dt+Δ⋅δS+12Γ(δS)2,\delta V \approx \Theta \,\dt + \Delta \cdot \delta S + \tfrac12\Gamma(\delta S)^2,

where δV\delta V and δS\delta S are the changes over one step of the grid (written with a lower-case δ\delta on this page, because Δ\Delta is the hedge ratio).

Using the PDE removes the deterministic dt\dt contribution, leaving the hedged P&L per step approximately

12ΓS2⋅[(δS/S)2−σ2 dt].\tfrac12\Gamma S^2 \cdot \left[(\delta S/S)^2 - \sigma^2 \,\dt\right].

That is the quantity measured throughout the page. It is zero on average when realised and implied variance agree, positive when realised variance exceeds what the price assumed, negative when it falls short, and its fluctuations generate the 1/N1/\sqrt{N} hedging-error law.

The PDE checked, and what the hedger is left with

The first check is straightforward: take the closed form from 2.9, compute its own Θ\Theta, Δ\Delta and Γ\Gamma, and substitute them into the PDE. The residual is 6.6×10−156.6 \times 10^{-15} on a grid S∈[50,200]S \in [50, 200], t∈[0,0.9]t \in [0, 0.9], and never exceeds 2×10−132 \times 10^{-13} at any point the hedges actually visit. To numerical precision, the candidate function satisfies the PDE everywhere it was tested.

The second check removes the analytic derivatives altogether. Using only the option values V(t,S)V(t, S), the Greeks are estimated by central differences and substituted into the PDE. The residual falls from 0.0286 to 0.00718, 0.00180, and 0.000449 as the step size is halved from 4 % to 0.5 % of SS and τ\tau. The measured slope is 1.998: second-order convergence, exactly the rate a central-difference scheme should have. That is the benchmark against which 3.3's grid pricer will later be tested.

The hedge itself is checked in two stages. First, there is a bookkeeping identity:

discounted P&L=∑e−rt⋅[δV−Δ⋅δS−(V−ΔS)(er dt−1)],\begin{aligned} & \text{discounted P\&L} \\ & \quad {} = \sum e^{-rt} \cdot \Big[ \delta V - \Delta \cdot \delta S \\ & \qquad {} - (V - \Delta S)\left(e^{r \,\dt} - 1\right) \Big], \end{aligned}

which is just the cash ledger written out. No model enters. Path by path, it reproduces the hedge P&L to about 10−1210^{-12}.

Then δV\delta V is replaced by its second-order Itô/Taylor expansion. The resulting approximation reproduces the hedge increasingly well as the grid is refined. Over the first half of the option's life the remainder falls almost exactly like 1/N1/N, with measured slope −1.005. That is the regime where the option is smooth and the second-order expansion behaves exactly as the lemma predicts.

The near-expiry result deserves a brief mention. The measured slope in the second half of the life is about −0.77 rather than −1, because the payoff's kink at the strike is where the smoothness assumptions behind the expansion begin to wear thin. The key point is not the exact exponent. The key point is that the remainder still falls faster than the hedging P&L itself, which falls like 1/N1/\sqrt{N}. The approximation gets better faster than the hedge does.

Three takeaways:

  1. The closed form satisfies the PDE to machine precision.
  2. Numerical Greeks satisfy it at the expected h2h^2 rate.
  3. The hedge's P&L is exactly the bookkeeping sum, and almost all of it is explained by the per-step term 12ΓS2⋅[(δS/S)2−σ2 dt]\tfrac12\Gamma S^2 \cdot [(\delta S/S)^2 - \sigma^2 \,\dt]; what is left shrinks roughly like 1/N1/N while the option remains smooth and somewhat more slowly near expiry, where the payoff's kink is felt.

Into 2.8

Now that μ\mu has disappeared from the PDE, a natural question remains: if the price no longer depends on the stock's real-world drift, what drift should be used to value the option? 2.8 approaches the problem from the opposite direction. Instead of starting with a hedge and deriving a PDE, it asks what happens if the stock is priced as if it drifted at the risk-free rate rr, giving

V=e−rT⋅EQ[payoff],V = e^{-rT} \cdot \E^Q[\text{payoff}],

under a new probability measure QQ. The link between that expectation and the PDE is the Feynman–Kac theorem, named but not proved. The experiment is simple: simulate the option under the rr-drift and compare the discounted average payoff with the PDE price. They should agree within Monte Carlo error. Repeat the same calculation under the stock's real-world drift μ\mu, and they should not. The question for 2.8 is why the "wrong" drift produces the right price.

Check

You hold a call and short Δ = ∂V/∂S shares, rebalancing N times; the stock moves at the σ the price assumed. The final P&L is:

Same hedge, but the stock now drifts at μ = +0.3 instead of 0. What changes?

You price and hedge at an implied vol of 0.4; the stock turns out to move at 0.5. Your hedged P&L, on average, is:

You hedge a forward contract, V = S − Ke^(−rτ), the same way: short Δ = ∂V/∂S = 1 share per forward, rebalancing N times. Its P&L is:

Π = V − ΔS with Δ = ∂V/∂S, and dS = μS dt + σS dW. Which term cancels in dΠ, and what is left?