How to do Fresnel Integration using Complex Analysis? I wanted to show
$$
\int_{0}^{\infty}\sin\left(x^{2}\right){\rm d}x = {\,\sqrt{\,{2\pi}\,}\, \over 4}.
$$
As per hint in book Hint in Book

*

*Que 1: I do not understand why to chose
$\operatorname{f}\left(z\right) = {\rm e}^{-z^{2}}\ ?$.

*Que:2
$\operatorname{f}\left(z\right) =
{\rm e}^{-z^{2}}$ as it is holomorphic over the path
$\int_{C}\operatorname{f} = 0$ by Cauchy Theorem.

*How to Integrate following 
$$
\int_{0}^{\pi/4}
{\rm e}^{-R^{2}\,{\rm e}^{2{\rm i}\theta}}\,\,\,
R{\rm i}{\rm e}^{{\rm i}\theta}\,{\rm d}\theta =\ ?
$$
Any help will be appreciated.
 A: The reason behind the choice is that when we integrate along the radius making an angle of $\frac{\pi}{4}$ with the $x$-axis we get the following:
$$\int_L e^{-z^2}dz = \int_0^R e^{-\left(re^{i\frac{\pi}{4}}\right)^2}e^{i \frac{\pi}{4}}dr = \left(\frac{1+i}{\sqrt{2}}\right)\int_0^R e^{-ir^2} dr$$
$$ = \frac{1}{\sqrt{2}}\left(\int_0^R \cos(r^2)dr + \int_0^R \sin(r^2)dr\right) + \frac{i}{\sqrt{2}}\left(\int_0^R \cos(r^2)dr - \int_0^R \sin(r^2)dr\right)$$
So we can find out the answer just taking real and  imaginary value of $\int_L e^{-z^2}dl$.
As you've noted the intgral along the closed line should $0$, thus it suffices to calculate the values of the integral along the arc and the $x$-axis.
For the arc we have:
$$\left| \int_0^{\frac{\pi}{4}} e^{-(Re^{i\theta})^2}iRe^{i\theta}d\theta \right| \le \left| e^{-(Re^{i\theta})^2}iRe^{i\theta} \right| \cdot \frac{R\pi}{4} = e^{-R^2\cos(2\theta)} \frac{R^2 \pi}{4} \to 0, \text{ as } R \to \infty$$
For the $x$-axis we have that:
$$\int_0^{\infty} e^{-z^2}dz = \frac{\sqrt\pi}{2}$$
Finally comparing the real and imaginary parts we get:
$$\frac{1}{\sqrt{2}}\left(\int_0^R \cos(r^2)dr + \int_0^R \sin(r^2)dr\right) = \frac{\sqrt{\pi}}{2}$$
$$\int_0^R \cos(r^2)dr - \int_0^R \sin(r^2)dr = 0$$
From here it's not hard to make the conclusion
A: I'd like to prove a generalized conclusion. In fact it is an exercise in Grafakos's 'Classica Fourier Analysis' (Exercise 2.4.12)
Claim:
$$\lim_{R\to\infty}\int_0^R e^{-ix^2}dx= \frac{\sqrt{2\pi}}{4}(1+i)$$
After we proved this, take imagine and real part on both sides will give us
$$
\int_0^\infty \sin (x^2)dx=\int_0^\infty \cos (x^2)dx=\frac{\sqrt{2\pi}}{4}.
$$
Proof: Just take the integral contour in you hint and denote by $P_1$, $P_2$ and $P_3$ relatively. Then we have
$$
\int_{P_1}e^{iz^2}dz=\int_0^R e^{-ix^2}dx
$$
and
$$
\int_{P_3}e^{iz^2}dz=\int_R^0 e^{-r^2}e^{i\tfrac{\pi}{4}}dr=\cfrac{1+i}{\sqrt{2}}\int_R^0 e^{-r^2}dr.
$$
As for the integral on $P_2$, using the well known inequality
$$
\cfrac{2}{\pi}< \cfrac{\sin x}{x}< 1,~~~~~~~x\in (0,\tfrac{\pi}{2}),
$$
we have
\begin{align*}
    \left|\int_{P_2}e^{iz^2}dz\right|&\le R\int_0^{\frac{\pi}{4}}e^{-R^2\sin (2\theta)}d\theta\\
    &\le R\int_0^{\frac{\pi}{4}}e^{-\tfrac{4}{\pi}R^2\theta}d\theta\\
    &=\cfrac{\pi}{4R}(1-e^{-R^2})\le \cfrac{\pi}{4R}.
\end{align*}
By the residue theorem, we have
$$
\lim_{R\to\infty}\int_{P_1}+\int_{P_2}+\int_{P_3}=0.
$$
Use the fact that $\int_0^\infty e^{-x^2}dx=\frac{\sqrt{\pi}}{2}$, we have
$$
\lim_{R\to\infty}\int_0^R e^{-ix^2}dx= \frac{\sqrt{2\pi}}{4}(1+i).$$
A: We know that $$\sin(z^2)=\frac{e^{iz^2}-e^{-iz^2}}{2i}.$$
Note that $iz^2=(e^{i\pi/4}z)^2$. So the integral of $f$ on the diagonal contour of the diagram gives us part of the answer (and hopefully you see how to get the full answer from it). 
It is important that $f$ is holomorphic, this means we can use Cauchy residue theorem.
The integral of the arc of the circle goes to 0 as $R\to\infty$, as it scales as $Re^{-R^2}$.
