In physics, one often encounters the integral: $$I = \int_{-\infty}^\infty e^{-\frac{1}{2}zx^2}dx $$ for $z\in\mathbb{C}$. Inputting this into Mathematica, I get that $I=\frac{\sqrt{2\pi}}{\sqrt{z}}$ so long as $\text{Re}(z)>0$. I'm a little confused by this (isn't $\sqrt{z}$ at risk of being multivalued since there are two square roots?), so I would like to derive it.
I followed a derivation which claims to do this in polar coordinates. Squaring the above and switching to polar coordinates using $r^2=x_1^2+x_2^2$, one finds that: $$ I^2= \int_{-\infty}^\infty e^{-\frac{1}{2}zx_1^2}dx_1 \int_{-\infty}^\infty e^{-\frac{1}{2}zx_2^2}dx_2 =\int_0^{2\pi}\int_0^\infty re^{-zr^2/2} dr d\phi$$ which, under a change of variables $u=zr^2/2$ yields: $$I^2=\frac{2\pi}{z}$$ So far so good. It is the next step that confuses me, where the square root is taken on both sides to yield: $$I=\frac{\sqrt{2\pi}}{\sqrt{z}}$$ Suppose $z\in \mathbb{R}$ - then I'm fine with this, since $I$ must be real and positive, so this can only hold for $z>0$ and it must be the positive root, so there's no ambiguity. But I don't understand (a) how to derive the above result for $z\in\mathbb{C}$, and (b) why the expression $\sqrt{z}$ for $z\in\mathbb{C}$ is well-defined at all. How do I resolve these concerns?
The integral is an analytic function of $z$ as long as it converges, so as soon as you know
you can conclude that the formula (using that branch of $1/\sqrt{z}$) is valid in the open right half plane.