# A bug in delta hedging, when for a certain step dS=0

Suppose we are doing a delta hedging simulation according to Black Scholes, where the initial condition are [stockPrice, strike, timeToExpire ,riskFreeRate, dividend, sigma, isCall] = [100, 100, 1, 0, 0, 0.2, True]. Let's say they are denoted as [S, K, t, r, q, $\sigma$, ] in Black Scholes. Hence particularly we haver=0 Black Scholes is usually written as

$r\frac{\partial V}{\partial S}S+\frac{1}{2}\sigma^2S^2\frac{\partial^2 V}{\partial S^2}+ \frac{\partial V}{\partial t}-rV=0$

where V is the value of option. Rewriting it gives

$rdt(V-\frac{\partial V}{\partial S}S)=(\frac{1}{2}\sigma^2S^2\frac{\partial^2 V}{\partial S^2}+\frac{\partial V}{\partial t})dt$

By assumption of Geometric Brownian Motion and approximations of Wiener process we have

$\frac{1}{2}\frac{\partial^2 V}{\partial S^2}(dS)^2=\frac{1}{2}\frac{\partial^2 V}{\partial S^2}\sigma^2S^2$

where

$dS=\mu Sdt+\sigma SdW$

Hence equivalently,

$rdt(V-\frac{\partial V}{\partial S}S)=(\frac{1}{2}\frac{\partial^2 V}{\partial S^2}(dS)^2+\frac{\partial V}{\partial t})dt------(1)$

By no arbitrage assumption,

$rdt(V-\frac{\partial V}{\partial S}S)=dV-\frac{\partial V}{\partial S}dS ------(2)$

Now let's say on a certain step of hedging, we found that

$dS=0$

such that

$\frac{1}{2}\frac{\partial^2 V}{\partial S^2}(dS)^2=0$

And it always holds that $\frac{\partial V}{\partial t}<0$, by (1) and (2) (or simply Itō's lemma) we have

$dV-\frac{\partial V}{\partial S}dS = (\frac{1}{2}\frac{\partial^2 V}{\partial S^2}(dS)^2+\frac{\partial V}{\partial t})dt<0$

Whereas since $r=0$, we have $rdt(V-\frac{\partial V}{\partial S}S)=0$. By (2) we have

$dV-\frac{\partial V}{\partial S}dS=rdt(V-\frac{\partial V}{\partial S}S)=0$

Looking at the above two equations we find a contradiction. So what's the problem out there?

This is a common misunderstanding. Note that $(dS_t)^2$ is just a short hand or heuristic notation for $d[S, S]_t$. Here $[S, S]_t$ is the quadratic variation. You should not literally take $(dS_t)^2$ as the algebraic product of $dS$ and $dS$. In fact, note that \begin{align*} d[S, S]_t = \sigma^2 S^2 dt. \end{align*} Then, even if $dS=0$, it does not mean $d[S, S]_t=0$.