Integral $\int_0^\infty e^{imx^2}dx$ In evaluating an integral in path integrals in QFT, I am stuck with this integral (that came up from evaluating a functional integral),
$$I = \bigg( \frac{m}{2\pi i\tau}\bigg) \int dx_1e^{\frac{im\tau}{2} \bigg((x_{2} - x_1)^2+(x_{1} - x_0)^2\bigg)}$$
After some manipulation, I end up with an integral of the form (apart from some constants)
$$\int_{0}^{\infty} e^{iax^2}\;dx$$
And on further evaluation using the substitution $s= -iax^2 $, I get
$$ \int_{0}^{i\infty} \frac{ds}{\sqrt{-ias}} e^{-s} $$
what kind of contour can we choose for evaluating this one. A diagram would be really helpful.
 A: I will calculate your integral
$$
I=\int_{-\infty}^\infty e^{i\alpha x^2}=2\int_0^\infty e^{i\alpha x^2}dx
$$
by using some residue methods.  This will be a general proof for you, you can put in the constant factors at the end where you need them.
\begin{equation}
F(\alpha)\equiv C(\alpha)+iS(\alpha)=\int_{-\infty}^{\infty} e^{i\alpha x^2}dx
\end{equation}
for real $\alpha$.  These are the Fresnel integrals, S($\alpha$) and C($\alpha$) which are two transcendental functions.  The integral is even so we can write
$$
F(\alpha)= 2\int_{0}^\infty {e^{i\alpha x^2}} dx.
$$
Consider the complex function $f(z)= e^{i\alpha z^2}$, $z=re^{i\theta}$, $f(z=re^{i\theta})=e^{i\alpha r^2 e^{2i\theta}}.$  If we stare at
$$
f(z=re^{i\theta})=e^{i\alpha r^2 e^{2i\theta}}
$$
we notice an amazing result, for $\theta=\pi/4$, this is just a real Gaussian integral ($\alpha >0$)!!  If $\theta =0$ we have $f(re^{i\theta})=e^{i\alpha r^2}$.
Thus our contour is split up into three contours making an angle between imaginary and real axis of $45^o$.  The contour I am using is shown here http://en.wikipedia.org/wiki/File:Fresnel_Integral_Contour.svg. We know there are no poles inside and $f(z)$ is holomorphic, thus by the Cauchy-Goursat theorem we know
\begin{equation}
0=\oint f(z) dz=\int_{0}^{\infty} e^{i\alpha x^2} dx +\int_{0}^{\pi/4} ire^{i\theta}  d\theta e^{i\alpha r^2(\cos(2\theta)+i\sin(2\theta))}+\int_{\infty}^{0}e^{-\alpha r^2}e^{i\pi/4}dr 
\end{equation}
where the integral is broken up into three contours shown in the illustration and I used $z=re^{i\theta}, \ dz= e^{i\theta }dr$.  The difficult integral to evaluate is 
$$
\int_{0}^{\pi/4} ire^{i\theta}  d\theta e^{i\alpha r^2(\cos(2\theta)+i\sin(2\theta))},
$$
however it vanishes as $r \to \infty$.  We need to show that it vanishes, it is similar to Jordan's inequality, but that just places an upper bound on the integral,
$$
\int_{0}^{\pi} e^{-r\sin\theta}d\theta \ < \frac{\pi}{r} \ (r >0).
$$
We will prove this now by showing that 
$$
\lim_{r\to \infty} \bigg| \int_{0}^{\pi/4} e^{i\alpha r^2 e^{2i\theta}} ir e^{i\theta }d\theta \bigg|=0.
$$
We know that 
$$
\bigg| \int_{0}^{\pi/4} e^{i\alpha r^2 e^{2i\theta}} ir e^{i\theta }d\theta \bigg| \leq \int_{0}^{\pi/4} \big|e^{i\alpha r^2 e^{2i\theta}}\big| \big|ir e^{i\theta}d\theta\big|=\int_{0}^{\pi/4} rd\theta \big| e^{i\alpha r^2\cos(2\theta)-\alpha r^2\sin(2\theta)} \big|=\int_{0}^{\pi/4}rd\theta \big|e^{i \alpha r^2\cos(2\theta)}\big|\big|e^{-\alpha r^2 \sin(2\theta)}\big|
$$
where I used $e^{2i\theta}=\cos 2\theta +i\sin 2\theta$.  We can simplify this to obtain
$$
\int_{0}^{\pi/4} r d\theta \big|e^{i \alpha r^2\cos(2\theta)}\big|\big|e^{-\alpha r^2\sin(2\theta)}\big|=\int_{0}^{\pi/4} rd\theta e^{-\alpha r^2\sin(2\theta)}.
$$
Thus we need to show that this vanishes as $r \to \infty.$  If we make the substitution $\xi=2\theta , d\theta=d\xi/2$ and changing the bounds of integration we obtain
$$
\int_{0}^{\pi/2} \frac{r}{2}d\xi e^{-\lambda r^2\sin \xi}.
$$ 
We can see that for $\xi \in [0,\pi/2]$, $\sin\xi \geq 2\xi/\pi$.  Since $e^{-\alpha r^2\cdot 2\xi/\pi} \geq e^{-\alpha r^2 \sin \xi} $ (since exponential is bigger for a smaller exponent), we can write
$$
\int_{0}^{\pi/2} \frac{r}{2}d\xi e^{-\alpha r^2\sin \xi} \leq \int_{0}^{\pi/2} \frac{r}{2}d\xi e^{-\alpha r^2 \cdot 2/\pi}=\frac{\pi}{4 \alpha r}(1-e^{-\alpha r^2}).
$$
Thus it is clear that 
$$
\lim_{r\to \infty}\frac{\pi}{4 \alpha r}(1-e^{-\alpha r^2})=0,
$$
thus we have shown that 
$$
\lim_{r\to \infty} \bigg| \int_{0}^{\pi/4} e^{i\alpha r^2 e^{2i\theta}} ir e^{i\theta }d\theta \bigg|=0.
$$
We are left with
$$
0=\int_{0}^{\infty} e^{i\alpha x^2} dx +\int_{\infty}^{0}e^{-\alpha r^2}e^{i\pi/4}dr.
$$
Re-arranging this expression we obtain
$$
\int_{0}^{\infty} e^{i\alpha x^2} dx=-\int_{\infty}^{0}e^{-\alpha r^2}e^{i\pi/4}dr=\int_{0}^{\infty}e^{-\alpha r^2}e^{i\pi/4}dr
$$
where I switched the bounds of integration to remove the minus sign.  This is a fabulous result, we have reduced the Fresnel integral to a real Gaussian integral which is trivial, the result is
$$
\int_{0}^{\infty} e^{i\alpha x^2} dx=\int_{0}^{\infty}e^{-\alpha r^2}e^{i\pi/4}dr=\frac{1}{2}e^{i\pi/4} \sqrt{\frac{\pi}{\alpha}}
$$
for $\alpha> 0.$(proof at end of this part.)
Thus using the property that the integrand is even, we revert back to the original integral in  to obtain the desired result given by
\begin{equation}
\int_{-\infty}^{\infty} e^{i\alpha x^2}dx=e^{i\pi/4} \sqrt{\frac{\pi}{\alpha}} , \ \  \alpha>0.
\end{equation}
Now we notice that $F(-\alpha)={F}^*(\alpha)$, thus we can write
$$
F(\alpha)=e^{-i\pi/4} \sqrt{\frac{\pi}{\alpha}}, \ \ \alpha<0.
$$
For $\alpha=0$, the integral is divergent since
$$
\int_{-\infty}^{\infty} dx=\infty.
$$
We can now calculate $C(\alpha)$ and $S(\alpha)$ by writing
$$
F(\alpha=C(\alpha)+iS(\alpha)=e^{\pm i\pi/4}\sqrt{\frac{\pi}{\alpha}}=\sqrt{\frac{\pi}{\alpha}}\bigg( \frac{1}{\sqrt{2}}\pm \frac{i}{\sqrt{2}}\bigg).
$$
Thus we conclude that 
\begin{equation}
{\boxed{      
F(\alpha)=\sqrt{\frac{\pi}{\alpha}}\cdot
\left\{
\begin{array}{ll}
e^{i\pi/4} \ ,\  \alpha > 0 \\
e^{-i\pi/4}  \ , \ \alpha < 0.\\ 
\end{array}
\right., \ 
C(\alpha)=\sqrt{\frac{\pi}{2\alpha}}, \ \alpha \neq 0, \ S(\alpha)=\sqrt{\frac{\pi}{\alpha}}\cdot
\left\{
\begin{array}{ll}
\frac{1}{\sqrt{2}} \ ,\  \alpha > 0 \\
-\frac{1}{\sqrt{2}} \ , \ \alpha < 0.\\ 
\end{array}
\right.
}}
\end{equation}
A: To compute the integral 
$$
\int_0^\infty e^{i\alpha x^2}\,\mathrm{d}x
$$
we will consider the contour integral
$$
\int_\gamma e^{i\alpha z^2}\,\mathrm{d}z=0
$$
where $\gamma=[0,R]\cup Re^{i[0,\pi/4]}\cup e^{i\pi/4}[R,0]$ as $R\to\infty$. 
$\hspace{3cm}$
There are no singularities of the integrand inside this contour, so the integral is $0$. Since the integral along the arc of the contour tends to $0$
$$
\begin{align}
\left|\int_{Re^{i[0,\pi/4]}}e^{i\alpha z^2}\,\mathrm{d}z\right|
&\le\int_0^{\pi/4}e^{-\alpha R^2\sin(2x)}R\,\mathrm{d}x\\
&\le\int_0^\infty e^{-\alpha R^24x/\pi}R\,\mathrm{d}x\\
&=\frac{\pi}{4\alpha R}
\end{align}
$$
the integrals along the two line segments must cancel. Therefore,
$$
\begin{align}
\overbrace{\int_0^\infty e^{i\alpha x^2}\,\mathrm{d}x}^{[0,R]}
&=\overbrace{\int_0^\infty e^{i\alpha(xe^{i\pi/4})^2}\,\mathrm{d}xe^{i\pi/4}}^{e^{i\pi/4}[0,R]}\\
&=e^{i\pi/4}\int_0^\infty e^{-\alpha x^2}\,\mathrm{d}x\\
&=\color{#C00000}{\frac{1+i}{\sqrt2}\frac12\sqrt{\frac\pi\alpha}}
\end{align}
$$

Correcting and Continuing the Answer in the Question
Substituting $s=-i\alpha x^2$ gives
$$
\frac12\int_0^{-i\infty}\frac{e^{-s}}{\sqrt{-i\alpha s}}\,\mathrm{d}s
$$
note the factor of $\frac12$ and the upper limit of integration.
To compute the integral above, consider the integral
$$
\frac12\int_\gamma\frac{e^{-z}}{\sqrt{-i\alpha z}}\,\mathrm{d}z=0
$$
where $\gamma=-i[0,R]\cup Re^{-i[\pi/2,0]}\cup[R,0]$.
$\hspace{3.8cm}$
There are no singularities of the integrand inside this contour, so the integral is $0$. Again, the integral along the arc vanishes as $R\to\infty$
$$
\begin{align}
\left|\frac12\int_{Re^{-i[\pi/2,0]}}\frac{e^{-z}}{\sqrt{-i\alpha z}}\,\mathrm{d}z\right|
&\le\left|\frac12\int_{-\pi/2}^0\frac{e^{-R\cos(x)}}{\sqrt{\alpha R}}R\,\mathrm{d}x\right|\\
&=\left|\frac12\int_0^{\pi/2}\frac{e^{-R\sin(x)}}{\sqrt{\alpha R}}R\,\mathrm{d}x\right|\\
&\le\frac12\int_0^\infty\frac{e^{-2Rx/\pi}}{\sqrt{\alpha R}}R\,\mathrm{d}x\\[5pt]
&=\frac\pi{4\sqrt{\alpha R}}
\end{align}
$$
the integrals along the two line segments must cancel. Therefore,
$$
\begin{align}
\overbrace{\frac12\int_0^{-i\infty}\frac{e^{-s}}{\sqrt{-i\alpha s}}\,\mathrm{d}s}^{-i[0,R]}
&=\overbrace{\frac{1+i}{\sqrt{2\alpha}}\int_0^\infty\frac{e^{-x}}{2\sqrt{x}}\,\mathrm{d}x}^{[0,R]}\\
&=\frac{1+i}{\sqrt{2\alpha}}\int_0^\infty e^{-x^2}\,\mathrm{d}x\\
&=\color{#C00000}{\frac{1+i}{\sqrt{2\alpha}}\frac{\sqrt\pi}2}
\end{align}
$$
