# Derivatives of Brownian motion or Box Options Greeks

Here's the probability (I think) that a particle in Brownian motion (w/ standard deviation $\sqrt{t}$) will exceed $m$ between times $t_1$ and $t_2$:

$$\frac1{2\sqrt{2\pi}}\int_{-\infty }^m \frac1{\sqrt{t_1}}e^{-\frac{x^2}{2t_1}}\left(1+\mathrm{erf}\left(\frac{m-x}{2\sqrt{t_2-t_1}}\right)\right)\mathrm{d}x$$

or, in Mathematica (slightly different form):

p[m_,t1_,t2_] := Integrate[
PDF[NormalDistribution[0,Sqrt[t1]]][x]*
CDF[NormalDistribution[x, Sqrt*Sqrt[t2-t1]]][m],
{x,-Infinity,m}, Assumptions -> {
t2 >= t1 >= 0, Element[m,Reals], Element[t2, Reals], Element[t1, Reals]}
]


Mathematica can numerically integrate this for specific values of m, t1, and t2, but it's not superfast.

I now want to find the partial derivatives of p[] with respect to each of its variables. Ideally in closed-form (Mathematica can't find one), but a good approximation if not.

I've tried power series and a few other techniques, but I've found nothing good enough for a wide range of values for m, t1, and t2.

Solving this problem will calculate the "Greeks" for box options:

https://money.stackexchange.com/questions/4312/calculating-fair-value-of-an-oanda-com-box-option

• Perhaps, there is something wrong in your expression for that probability. I will post an answer soon. – Shai Covo Nov 18 '10 at 23:38
• You do know the error function is built-in in Mathematica as Erf[]? – J. M. is a poor mathematician Nov 19 '10 at 0:22
• Yes, I used Mathematica to generate the TeX. I'm not sure why I didn't use it in the Mathematica code, but it shouldn't affect Mathematica's ability to integrate. – barrycarter Nov 19 '10 at 17:42

In view of your previous post, the probability you are considering is actually $$\bar P(m,t_1,t_2) = 1 - \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x},\;\; m \in {\bf R}.$$ This is the complement of the probability considered in your previous post. So, we may consider instead the partial derivatives of $$P(m,t_1,t_2) = \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x}.$$ Now, erf(x) has derivative ${\rm erf}'(x)= \frac{2}{{\sqrt \pi }}e^{ - x^2 }$, $x > 0$. Then, the partial derivative with respect to $t_2$ is obtained as follows: $$\frac{{\partial}}{{\partial t_2 }}P(m,t_1 ,t_2 ) = \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {\frac{\partial }{{\partial t_2 }}{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x},$$ and explicitly, $$\frac{{\partial}}{{\partial t_2 }}P(m,t_1 ,t_2 ) = \frac{{ - 1}}{{\sqrt {8 \pi ^2 t_1 (t_2 - t_1 )^3 } }}\int_{ - \infty }^m {\exp \bigg[ - \frac{{(m - x)^2 }}{{4(t_2 - t_1 )}} - \frac{{x^2 }}{{2t_1 }}\bigg](m - x){\rm d}x}.$$ (The probability that the maximum is smaller than $m$ decreases as $t_2$ increases, hence the minus sign in this equation.) To find the partial derivative with respect to $m$ corresponds to taking the derivative of a convolution, according to the rule $(f * g)' = f' * g$. Specifically, this says that $$\frac{{\partial}}{{\partial m }}P(m,t_1 ,t_2 ) = \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {\frac{\partial }{{\partial m }}{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x},$$ and explicitly, $$\frac{{\partial}}{{\partial m }}P(m,t_1 ,t_2 ) = \frac{{1}}{{\sqrt {2 \pi ^2 t_1 (t_2 - t_1 ) } }}\int_{ - \infty }^m {\exp \bigg[ - \frac{{(m - x)^2 }}{{4(t_2 - t_1 )}} - \frac{{x^2 }}{{2t_1 }}\bigg]{\rm d}x}.$$ Maybe you can simplify further. The partial derivative with respect to $t_1$ is apparently a quite complicated expression.
• The partial derivative with respect to $m$ is equivalent to $\frac{m^2}{\sqrt{2\pi(2t_2-t_1)}}\exp\left(-\frac{m^2}{2(2t_2-t_1)}\right)\left(1+\mathrm{erf}\left(m\sqrt{\frac{t_2-t_1}{t_1(2t_2-t_1)}}\right)\right)$ . The other one looks quite complicated. – J. M. is a poor mathematician Nov 19 '10 at 2:36