Integral of $e^{-x^2}\cos(x^2)$ using residues

I want to solve the following integral:

$$\int_0^{\infty} \!\! \operatorname{e}^{-x^2}\!\cos(x^2) \, \operatorname{d}\!x$$

I have seen this in a section about residues, so my guess is that I would need to compute an appropriate contour integral. However, it does not seems to be like the usual forms of integrals that can be computed using an appropriate complex integral. So I don't know what to do. Any help would be appreciated. Thanks!


Solution 1:

As suggested in the comment, write the integral as

$$\Re\int_0^{\infty} dx \, e^{-(1-i) x^2} = \Re\int_0^{\infty} dx \, e^{-\sqrt{2} e^{-i \pi/4} x^2}$$

Now consider the following contour integral:

$$\oint_C dz \, e^{-\sqrt{2} e^{-i \pi/4} z^2}$$

where $C$ is a circular sector of radius $R$ that opens at an angle of $\pi/8$ with respect to the positive real axis. Note that we will not be using residues in computing the integral, because there are no poles within the contour $C$. Rather, we will be evaluating the integral over the contour itself and using Cauchy's theorem.

The contour integral over $C$ is equal to

$$\int_0^R dx \, e^{-\sqrt{2} e^{-i \pi/4} x^2} + i R \int_0^{\pi/8} d\theta \, e^{i \theta} \, \exp{\left[-\sqrt{2} R^2 e^{-i \pi/4 + 2 \theta}\right]}\\+e^{i \pi/8} \int_R^0 dt \,e^{-\sqrt{2} t^2} $$

Note that the second integral vanishes as $R \to \infty$. Its magnitude is bounded by

$$R \int_0^{\pi/8} d\theta \, e^{-\sqrt{2} R^2 \sin{(\pi/4+2 \theta)}} \le R \int_0^{\pi/8} d\theta \, e^{-\sqrt{2} R^2/2} e^{-4 \sqrt{2} R^2 \theta/\pi} \le \frac{\pi}{4 \sqrt{2} R} e^{-\sqrt{2} R^2/2}$$

as $R \to \infty$. Further, the contour integral is zero by Cauchy's theorem (no poles in the contour). Therefore,

$$\int_0^{\infty} dx \, e^{-(1-i) x^2} = e^{i \pi/8} \int_0^{\infty} dt \,e^{-\sqrt{2} t^2} = \frac12 e^{i \pi/8} \sqrt{\frac{\pi}{\sqrt{2}}}$$

Therefore, taking real parts, we get

$$\int_0^{\infty} dx \, e^{-x^2} \cos{x^2} = \frac{\sqrt{\pi}}{2} \frac{\cos{(\pi/8)}}{2^{1/4}} = \frac{\sqrt{\pi}}{4} \sqrt{1+\sqrt{2}}$$