(Reposted from math stack exchange)
I have searched and failed to find a rigorous proof showing that $$\int_{0}^\infty e^{-ax^2}\ \mathrm{d}x = \frac{\sqrt{\pi}}{2\sqrt{a}}$$ is true for $\Re(a)=0$ and $\Im(a)\neq0$. For example, why does $$ \int_{-\infty}^\infty e^{-ix^2}\ \mathrm{d}x = \sqrt{\frac{\pi}{i}} $$ and does one need to invoke contour integration to show this? Is it just a coincidence this happens to work? Or is the following technique valid:
Suppose $\Re (b)>0$ and $a$ is complex; then $$ \int_{-\infty}^\infty e^{-ax^2}\ \mathrm{d}x \stackrel{?}{=} \lim_{b\to0}\int_0^\infty e^{-(a+ b)x^2}\ \mathrm{d}x = \lim_{b\to0}\frac{\sqrt{\pi}}{2\sqrt{a+b}}. $$
Another example is $$ \int_0^\infty x^{s-1}e^{-ix}\ \mathrm{d}x = i^{-s}\Gamma(s) $$ which follows from $$ \int_0^\infty x^{s-1}e^{-ax}\ \mathrm{d}x = a^{-s}\Gamma(s), $$ but why is it that both of these are true? I fail to believe it is just a coincidence. Is there an explanation (not a calculation) that can justify these results?
Thank you.