This question has been irritating me for awhile so I thought I'd ask here.
Are complex substitutions in integration okay? Can the following substitution used to evaluate the Fresnel integrals:
$\int_{0}^{\infty} \sin x^2\, dx=\operatorname {Im}\left( \int_0^\infty\cos x^2\, dx + i\int_0^\infty\sin x^2\, dx\right)=\operatorname {Im}\left(\int_0^\infty \exp(ix^2)\, dx\right)$
Letting $ix^2=-z^2 \implies x=\pm\sqrt{iz^2}=\pm \sqrt{i}z \implies z=\pm \sqrt{-i} x \implies dx = \pm\sqrt{i}\, dz$
Thus the integral becomes
$\operatorname {Im}\left(\pm \sqrt{i}\int_0^{\pm\sqrt{-i}\infty} \exp(z^2)\, dz\right)$
This step requires some justification, and I am hoping someone can help me justify this step as well: $\pm \sqrt{i}\int_0^{\pm\sqrt{-i}\infty} \exp(z^2)\, dz=\pm\sqrt{i}\int^\infty_0\exp(z^2)\, dz=\pm\sqrt{i}\left(\frac{\sqrt{\pi}}{2}\right)$
Thus
$\operatorname {Im}\left(\int_0^\infty \exp(ix^2)\, dx\right)=\operatorname {Im}\left(\pm\frac{\sqrt{i\pi}}{2}\right)=\operatorname {Im}\left(\pm\frac{(1+i)\sqrt{\pi}}{2\sqrt{2}}\right)=\pm\frac{1}{2}\sqrt{\frac{\pi}{2}}$
We find that the correct answer is the positive part (simply prove the integral is positive, perhaps by showing the integral can be written as an alternating sum of integrals).
Can someone help justify this substitution? Is this legal?