Integration of Exponential with Polynomial in its Exponent I seek to solve the following integral:
$$
\int_0^T dt \frac{1}{\sqrt{4 \pi s^2 t}}\cdot \exp\left({-\frac{(x-vt)^2}{4 s^2t}}\right)
$$
My first idea was to substitute $1/\sqrt{t}$ using $u=\frac{1}{2} \sqrt{t}$ and $du = dt \frac{1}{\sqrt{t}}$, yielding
$$
\int_0^{\sqrt{T}/2} du \exp \left(- \frac{(x - 4u^2 v)^2}{16 s^2 u^2}\right)
$$
From there, I thought about expanding the term according to the binomial formula and obtain three exponential terms, one that has $u^2$ in its power, one with $u^0$ that I can pull out of the integral and one with $u^{-2}$.
However, partially integrating the $u^2$ term using further substitutions did not work out, and in the end everything cancels and yields 0.
I am aware that the error function is involved with the following term: $\int_0^b du \exp(-u^2) = \sqrt{\pi}/2 \cdot \operatorname{erf}(b)$
I appreciate any help! Thank you! 
 A: For $a,b>0$ we have
\begin{align}
\int \limits_0^a \mathrm{e}^{-b \left(x-\frac{1}{x}\right)^2} \, \mathrm{d} x &= \frac{1}{2} \int \limits_0^a \mathrm{e}^{-b \left(x-\frac{1}{x}\right)^2} \left(1 + \frac{1}{x^2} + 1 - \frac{1}{x^2}\right) \mathrm{d} x \\
&= \frac{1}{2} \int \limits_0^a \mathrm{e}^{-b \left(x-\frac{1}{x}\right)^2} \left(1 + \frac{1}{x^2}\right) \mathrm{d} x + \frac{1}{2} \mathrm{e}^{4 b}\int \limits_0^a \mathrm{e}^{-b \left(x+\frac{1}{x}\right)^2} \left(1 - \frac{1}{x^2}\right) \mathrm{d} x \\
&= \frac{1}{2} \frac{\sqrt{\pi}}{2 \sqrt{b}} \left(\operatorname{erf}\left[\sqrt{b} \left(a - \frac{1}{a}\right)\right] +1\right) + \frac{1}{2} \mathrm{e}^{4 b} \frac{\sqrt{\pi}}{2 \sqrt{b}} \left(\operatorname{erf}\left[\sqrt{b} \left(a + \frac{1}{a}\right)\right] - 1\right) \\
&= \frac{\sqrt{\pi}}{4 \sqrt{b}} \left(\operatorname{erfc}\left[\sqrt{b} \left(\frac{1}{a} - a\right)\right] - \mathrm{e}^{4b} \operatorname{erfc}\left[\sqrt{b} \left(\frac{1}{a} + a\right)\right]\right) \, .
\end{align}

Now let $T,s>0$ and (for now) $x,v>0$. Then your integral (divided by $T$ to make the result a density) is
$$ \frac{1}{T} \int \limits_0^T \frac{\mathrm{e}^{-\frac{(x-vt)^2}{4s^2 t}}}{\sqrt{4 \pi s^2 t}} \, \mathrm{d} t \stackrel{t = \frac{x}{v} \xi^2}{=} \sqrt{\frac{x}{\pi v}} \frac{1}{sT} \int \limits_0^{\sqrt{\frac{v T}{x}}} \mathrm{e}^{- \frac{v x}{4 s^2} \left(\xi - \frac{1}{\xi}\right)^2}\, \mathrm{d} \xi = \frac{\operatorname{erfc} \left(\frac{x - vT}{2 s \sqrt{T}}\right) - \mathrm{e}^{\frac{v x}{s^2}} \operatorname{erfc} \left(\frac{x + vT}{2 s \sqrt{T}}\right)}{2 v T} \, . $$
For $x < 0$ the exponent becomes $- \frac{(\lvert x \rvert + v t)^2}{4s^2t}$ and a few signs change, but the calculation is similar. The final result for $x \in \mathbb{R} \setminus \{0\}$ is
\begin{align}
\frac{1}{T} \int \limits_0^T \frac{\mathrm{e}^{-\frac{(x-vt)^2}{4s^2 t}}}{\sqrt{4 \pi s^2 t}} \, \mathrm{d} t  &= \operatorname{sgn}(x) \frac{\operatorname{erfc} \left(\operatorname{sgn}(x) \frac{x - vT}{2 s \sqrt{T}}\right) - \mathrm{e}^{\frac{v x}{s^2}} \operatorname{erfc} \left(\operatorname{sgn}(x) \frac{x + vT}{2 s \sqrt{T}}\right)}{2 v T} \\
&= \frac{\operatorname{sgn}(x)-\operatorname{erf} \left( \frac{x - vT}{2 s \sqrt{T}}\right) - \mathrm{e}^{\frac{v x}{s^2}} \left[\operatorname{sgn}(x) -\operatorname{erf} \left(\frac{x + vT}{2 s \sqrt{T}}\right)\right]}{2 v T} \, .
\end{align}
The second expression is correct for $x = 0$ as well. 
For $v < 0$ the result remains unchanged and for $v=0$ we can let $\frac{x^2}{4 s^2 t} = \frac{1}{u^2}$ and integrate by parts to find
$$ \frac{1}{T} \int \limits_0^T \frac{\mathrm{e}^{-\frac{x^2}{4s^2 t}}}{\sqrt{4 \pi s^2 t}} \, \mathrm{d} t = \frac{\mathrm{e}^{-\frac{x^2}{4s^2 T}}}{\sqrt{\pi s^2 T}} - \frac{\rvert x\lvert}{2 s^2 T} \operatorname{erfc} \left(\frac{\rvert x\lvert}{2 s \sqrt{T}}\right) \, .$$
