2

I've been trying to compute the following integral, but I havent been able to. Mathematica gives me an answer, but I would like to know how to get to that answer. For reference, this is the CDF of first time passage of a brownian motion with drift.

$$\int_0^t\frac{1}{\sqrt{x^3}} e^{-\frac{(a-bx)^2}{2x}} dx$$

The answer according to Mathematica is:

$$ \sqrt{\frac{\pi}{2}} \frac{1}{a} \operatorname{erfc}\left(\frac{a - bt}{\sqrt{2t}}\right) + \sqrt{\frac{\pi}{2}} \frac{1}{a} e^{2ab}\operatorname{erfc}\left(\frac{a + bt}{\sqrt{2t}}\right) $$

where $\operatorname{erfc}$ is the complementary error function. I've been trying to solve this for weeks, without any success.
Here's a link to a similar question, but the integrals are from $0$ to $\infty$ which helps, but doesn't lead to an answer.

Hints would be useful as well, since I want to be able to solve this integral.

dleal
  • 271
  • 1
    Since you already know the answer, you could just check it (i) vanishes at $t=0$ & (ii) has the right derivative. – J.G. Mar 16 '20 at 20:01
  • thank you @J.G. I just want to know how to get to the answer for the integral. Ive tried many changes of variables with no success – dleal Mar 16 '20 at 20:30
  • 1
    What is the definition of $\operatorname{erfc}(x)$ used by Mathematica? I'm pretty sure the final result looks quite similar up to some constants factor, e.g. a $\sqrt{\pi}$ missing. Also, are you familiar with Feynman's trick? (that's the only way I see how to obtain the result spitted by the computer). – Zacky Mar 16 '20 at 21:31
  • hello @Zacky . Mathematica defines erfc (complementary error function) as $erfc(x) = 1 - erf(x)$ where $erf(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-u^2} du$. I am not quite sure what the Feynman trick is, but would be happy to use it. – dleal Mar 16 '20 at 21:37
  • @dleal perhaps the alternative terminology of Leibniz Rule: https://en.wikipedia.org/wiki/Leibniz_integral_rule or Differentiation under the integral sign is more familiar? See also here: https://kconrad.math.uconn.edu/blurbs/analysis/diffunderint.pdf – Zacky Mar 16 '20 at 21:40
  • @Zacky , just to make sure I understand what you suggest. The trick would be to use Leibniz rule and take the derivative with respect to some variable in the integrand, so that the result is maybe something friendlier. Then, integrating with respect to that variable? – dleal Mar 16 '20 at 21:51
  • @dleal yes. For the case $\int_0^\infty$ the substitution $x\to \frac{1}{x}$ was used, then two integrals we're added and the derivative of the exponential argument was obtained, aka $(a+b/x^2)$. After adjusting your integral and taking a derivative (w.r.t. b) a similar term is obtained. I obtained that the integral is equal to $\sqrt{2\pi}\int_{-\infty}^b e^{2ax}\operatorname{erfc}\left(\frac{a+x t}{\sqrt {2t}}\right)dx$ (doesn't look that friendly) but now integrating by parts followed by completing the square should finish the integral by the way it looks (hopefully). – Zacky Mar 16 '20 at 21:57
  • 1
    @Zacky thank you. I will try as you suggest and see where I get! thanks again, – dleal Mar 16 '20 at 22:25

1 Answers1

5

$$\mathcal J(a,b)=\int_0^t\frac{1}{\sqrt{x^3}} \exp\left({-\frac{(a-bx)^2}{2x}}\right) dx\overset{\sqrt x\to \frac{1}{x}}=2\int_\frac{1}{\sqrt t}^\infty \exp\left(-\frac12 \left(ax-b/x\right)^2\right)dx$$ $$\frac{d}{db}\mathcal J(a,b)=2\int_\frac{1}{\sqrt t}^\infty \exp\left(-\frac12 \left(ax-b/x\right)^2\right)\left(a-\frac{b}{x^2}\right)dx$$ The reason why we differentiated with respect to $b$ is to produce the additional term of $a-\frac{b}{x^2}$, differentiating w.r.t. $a$ would have added $b-ax^2$ which doesn't really help. Now similarly to the linked integral we will adjust things by using $(ax-b/x)^2=(ax+b/x)^2+4ab$ which yields: $$\frac{d}{db}\mathcal J(a,b)=2e^{2ab}\int_\frac{1}{\sqrt t}^\infty \exp\left(-\frac12 (ax+b/x)^2\right)\left(a-\frac{b}{x^2}\right)dx$$ $$\overset{ax+b/x\to x}=2e^{2ab}\int_{\frac{a}{\sqrt t}+b\sqrt t}^\infty \exp{\left(-\frac{x^2}{2}\right)}dx=2e^{2ab}\sqrt{\frac{\pi}{2}}\operatorname{erfc}\left(\frac{\frac{a}{\sqrt t}+b\sqrt t}{\sqrt 2}\right)$$ $$\mathcal J(a,-\infty)=0\Rightarrow \mathcal J(a,b)=\sqrt{2\pi}\int_{-\infty}^b e^{2ax}\operatorname{erfc}\left(\frac{\frac{a}{\sqrt t}+x\sqrt t}{\sqrt 2}\right)dx$$ $$\overset{IBP}=\frac{\sqrt{\pi}}{\sqrt 2a}e^{2ax}\operatorname{erfc}\left(\frac{\frac{a}{\sqrt t}+x\sqrt t}{\sqrt 2}\right)\bigg|_{-\infty}^b+\frac{\sqrt t}{a}\int_{-\infty}^b e^{2ax}\exp\left(-\frac{(a+xt)^2}{2t}\right)dx$$ $$=\sqrt{\frac{\pi}{2}}\frac{1}{a}e^{2ab}\operatorname{erfc}\left(\frac{\frac{a}{\sqrt t}+b\sqrt t}{\sqrt 2}\right)+\frac{\sqrt t}{a}\int_{-\infty}^b \exp\left(-\frac12\left(x\sqrt{t}-\frac{a}{\sqrt{t}}\right)^2\right)dx$$ $$\overset{x\sqrt t-\frac{a}{\sqrt t}\to -x}=\sqrt{\frac{\pi}{2}}\frac{1}{a}e^{2ab}\operatorname{erfc}\left(\frac{\frac{a}{\sqrt t}+b\sqrt t}{\sqrt 2}\right)+\frac{1}{a}\int^{\infty}_{\frac{a}{\sqrt t}-b\sqrt t}\exp\left(-\frac{x^2}{2}\right)dx $$ $$=\sqrt{\frac{\pi}{2}}\frac{1}{a}\left(e^{2ab}\operatorname{erfc}\left(\frac{\frac{a}{\sqrt t}+b\sqrt t}{\sqrt 2}\right)+\operatorname{erfc}\left(\frac{\frac{a}{\sqrt t}-b\sqrt t}{\sqrt 2}\right)\right)$$

Zacky
  • 27,674
  • 1
    this is a wonderful answer, I hadn't thought about using Leibniz's rule this way, I really appreciate it! I'll look into the $\sqrt{\pi}$ and compare it with Mathematica to see what's going on – dleal Mar 17 '20 at 15:57
  • 1
    Thaks for the compliment! I just remembered about this post, well the answer given by Mathematica got that $\sqrt \pi$ in this case. – Zacky Mar 17 '20 at 22:11
  • you are right, it's my mistake, I put an extra term in Mathematica that cancelled out the $\sqrt{\pi}$. I will correct the question. – dleal Mar 17 '20 at 22:27
  • @dleal Nice! Are you sure there isn't a $\frac{1}{a}$ term missing too from the Mathematica result? – Zacky Mar 17 '20 at 22:32
  • 1
    yes! you are right again, I made the changes, thanks for your help! – dleal Mar 17 '20 at 22:40