Complex Gaussian Integral by change of variable In this video (minute 5:20), they prove that
$$ I = \int_{-\infty}^{\infty}e^{i x^2}dx = e^{i\frac{\pi}{4}}\sqrt{\pi}$$
by deforming the integration contour in the complex plane from the real axis to a straight line crossing the origin at a $\frac{\pi}{4}$ angle. In other words, they perform the change of variable $ x = e^{i\frac{\pi}{4}}t$, and change the integration measure accordingly, i.e., $dx = e^{i \frac{\pi}{4}}dt$. Then, they claim that
$$ I = e^{i\frac{\pi}{4}}\int_{-\infty}^{\infty}e^{-x^2}dx,$$
where the resulting integral is a well known result.
I don't distrust the result (in fact, it's proven in this other question), but I'm concerned about the change of variable.
Why didn't they change the bounds of the integral to $\pm(1+i)\infty$? Is it always possible to proceed as they did?
P.S. The video is part of an online course on complex analysis by the MISiS
 A: In fact, video does not provide a proof thar this change is permissible. Because the function is even, $I = \int_{-\infty}^{\infty}e^{i x^2}dx =\frac{1}{2}\int_{0}^{\infty}e^{i x^2}dx$, it can be proved by means of consideration of integral along the following closed contour in the complex plane of the function $e^{i x^2}$:

$R$ is a big radius ($\to{\infty}$) and $r$ is a small radius ($\to0$). On the positive axis we get our initial integral; the integral along the line $y=ix$ is $\frac{i+1}{\sqrt2}\int_{R}^{r}e^{i\frac{1}{2} x^2(i+1)}dx=\exp(\frac{\pi{i}}{4})\int_{R}^{r}e^{- x^2}dx$.
The integral along a big circle can be evaluated by means of Jordan's lemma as $I_R=\int_{0}^{\frac{\pi}{4}}e^{iR^2e^{2i\phi}}iRe^{i\phi}d\phi<\int_{0}^{\frac{\pi}{4}}e^{-R^2{\sin(2\phi)}}Rd\phi<\frac{1}{2}\int_{0}^{\frac{\pi}{2}}e^{-R^2\frac{2\phi}{\pi}}Rd\phi=\frac{\pi}{4R}(1-e^{-R^2})\to0$ as $R\to\infty$. It is easy to evaluate the integral along a small circle $r$: $I_r<Ar $ ($A=const$) and $\to0$ as $r\to0$.
Given the fact that there is no singularities inside the chosen contour $\oint_C=0$,
and we get $\int_{0}^{\infty}e^{i x^2}dx+\exp(\frac{\pi{i}}{4})\int_{\infty}^{0}e^{- x^2}dx=0$, or $$\int_{0}^{\infty}e^{i x^2}dx=\frac{\sqrt{\pi}}{2}\exp(\frac{\pi{i}}{4})$$
