I must calculate $\int^\infty_0\cos x^2 dx$, so I need to integrate $\cos z^2$ along a convenient closed path. Since $\cos z^2=\frac{e^{iz^2}+e^{-iz^2}} 2$, it seems to me that the only two useful paths could be 1) the one consisting of the segment $[-r,r]$ and the upper half of the circle of radius $r$ centered in $0$; 2) the one consisting of $[0,r]$, of $R=\{z\in \mathbb C: z = it$ for some $t\in [0,r]\}$ and of the quarter of circle necessary to close the path. However I must have misunderstood something at this point, because I have this problem: the function is entire, so the integral along a closed path (so both 1 and 2) is zero; if I call $I_r$ the integral $\int^r_0\cos x^2 dx$, I have that for 1) $\int_{[-r,0]}\cos z^2dz=I_r$, and for 2) I have $\int_R\cos z^2dz=iI_r$. So in both cases the integral along the arc of circle must be different from zero, or I'd have $I_r=0$, but it seems quite difficult to calculate it. Am I wrong with something? Thank you in advance

  • 2
    $\begingroup$ Write $\cos (x^2) = \operatorname{Re} e^{ix^2}$ and take contour 2). [If you use $\cos (x^2) = \frac{1}{2}(e^{ix^2} + e^{-ix^2})$ you need different contours for the two exponential terms.] The integral over the arc tends to $0$ as $r \to \infty$, but the integrals over the two rays don't. And the integral over $e^{i\pi/4}\cdot [0,+\infty)$ becomes something (hopefully) familiar. $\endgroup$ Nov 28, 2019 at 22:43
  • $\begingroup$ Thank you I didn't thought of taking only the real part $\endgroup$
    – Dr. Scotti
    Nov 28, 2019 at 22:50
  • $\begingroup$ Sorry I don't understand why the integral along the arc tends to $0$: if I consider $\cos(t+ikt)$ for a fixed non negative real $k$ and $t\in\mathbb R$, I have that for $t\to\infty$ it is very close to $e^{kt}e^{-it}$. This last function assumes real values infinitely many times and their module increase as $t\to\infty$ for every $k$. I'm not saying that this implies that the integral can't turn out to be zero, but it's not clear to me why. Thank you $\endgroup$
    – Dr. Scotti
    Nov 29, 2019 at 10:23
  • $\begingroup$ Actually I should have said "for infinitely many $t\ge t_0$, for every $t_0$" $\endgroup$
    – Dr. Scotti
    Nov 29, 2019 at 10:28
  • 1
    $\begingroup$ Parametrise $z = r e^{i\varphi}$ ($0 \leqslant \varphi \leqslant \pi/4$). The modulus of the integral over the arc is $$\biggl\lvert\int_0^{\pi/4} \exp \bigl(i r^2e^{2i\varphi}\bigr)ire^{i\varphi}\,d\varphi \biggr\rvert \leqslant r\int_0^{\pi/4}\exp\bigl(-r^2\sin(2\varphi)\bigr)\,d\varphi \leqslant r\int_0^{\pi/4} \exp\Bigl(-\frac{4}{\pi}r^2\varphi\Bigr)d\varphi < \frac{\pi}{4r}\,.$$ $\endgroup$ Nov 29, 2019 at 12:33

2 Answers 2


You don't even need to use complex analysis.

$$e^{ix} = \cos{x} + i\sin{x}$$

$$e^{-ix^2} = \cos{(-x^2)} + i\sin{(-x^2)}=\cos{x^2} - i\sin{x^2}$$

So now if we integrate:

$$\int_{-\infty}^\infty e^{-ix^2}dx = \int_{-\infty}^\infty \cos{x^2}dx - i\int_{-\infty}^\infty \sin{x^2}dx$$

Gaussian integral is: $$\int_{-\infty}^\infty e^{-ax^2}dx = \sqrt{\frac{\pi}{a}}$$

So if we take $a=i$:

$$\sqrt{\frac{\pi}{i}} =\int_{-\infty}^\infty \cos{x^2}dx - i\int_{-\infty}^\infty \sin{x^2}dx$$

Know to clean up: $$\sqrt{\frac{\pi \cdot i}{i\cdot i}}= \sqrt{-\pi i} =\frac{i\sqrt{2 \pi}}{2}(\pm(1+i))$$ however, both integrals are positive so we take $-(1+i)$ and get: $$ \int_{-\infty}^\infty \cos{x^2}dx - i\int_{-\infty}^\infty \sin{x^2}dx = -\frac{i\sqrt{2 \pi}}{2}+\frac{\sqrt{2 \pi}}{2}$$

Taking real and imaginary parts together we get:

$$\int_{-\infty}^\infty \cos{x^2}dx = \int_{-\infty}^\infty \sin{x^2}dx = \frac{\sqrt{2\pi}}{2}$$


$$\int_{0}^\infty cos(x^2)dx\buildrel{x^2\rightarrow z}\over{\overbrace{=}}\frac{1}{2}\int_{0}^\infty cos(z)z^{-\frac{1}{2}}dz=\frac{1}{2}\mathfrak{R}\left(\int_{0}^\infty e^{iz}z^{-\frac{1}{2}}dz\right)$$

We choose a quarter of the complex plane with a quarter cirlce deformation in the origin as our contour and define $f(z)=e^{iz}z^{-\frac{1}{2}}$ $$\oint{f(z)dz}=\left(\int_{r}^R+\int_\Gamma+\int_{iR}^{ir}+\int_\gamma\right) f(z)dz$$ Since there are no poles inside the contour $\oint{f(z)dz}=0$

Using the Estimation Lemma, it's easy to show that$\int_\Gamma f(z)dz\rightarrow0$ when $R\rightarrow\infty$ and that$\int_\gamma f(z)dz\rightarrow0$ when $r\rightarrow0$.

Hence: $$\int_{r}^R f(z)dz=-\int_{iR}^{ir} f(z)dz\buildrel{z\rightarrow it}\over{\overbrace{=}}i\int_{r}^{R} f(it)dt$$ $$\int_{0}^\infty e^{iz}z^{-\frac{1}{2}}dz=ie^{-\frac{i\pi}{4}} \int_{0}^\infty e^{-t}t^{-\frac{1}{2}}dt=\frac{i}{\sqrt2}(1-i)\Gamma\left(\frac{1}{2}\right)=\frac{1+i}{\sqrt2}\sqrt{\pi}$$

Therefore, it's possible to conclude that: $$\int_{0}^\infty cos(x^2)dx=\frac{1}{2}\mathfrak{R}\left(\frac{1+i}{\sqrt2}\sqrt{\pi}\right)=\frac{\sqrt{\pi}}{2\sqrt2}$$

$\textbf{Addendum:}$ If you don't need to provide a proof about this result, you could use the Mellin Transform of cosine and the result would be immediate: $$\int_{0}^\infty cos(x^2)dx\buildrel{x^2\rightarrow z}\over{\overbrace{=}}\frac{1}{2}\int_{0}^\infty cos(z)z^{-\frac{1}{2}}dz=\frac{1}{2}\mathscr{M}\left(\cos(z)\right)_{s=\frac{1}{2}}=$$ $$\frac{1}{2}\left(\cos(\frac{s\pi}{2})\Gamma(s)\right)_{s=\frac{1}{2}}=\frac{\sqrt{\pi}}{2\sqrt2}$$




You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .