# Evaluating an improper integral using complex contour integration

I just started learning complex analysis and I'm struggling with some complex contour integration. One problem I recently saw was $$\int_{-\infty}^{\infty}e^{-x^{2}}\cos(2x)dx$$

To my understanding, since the function is continuous everywhere $$\oint_{C}f(z)dz = \int_{-R}^{R}f(z)dz + \int_{\gamma_{r}}f(z)dz = 0$$ from the Cauchy-Goursat theorem, where $[-R,R]$ is along the real axis with a limit as $R$ goes to infinity, and the contour $\gamma_r$ is a semi circle in the complex plane with $|z|>0$. Now I'm struggling with evaluating the contour integral in the second part. How do I go about solving this, assuming my steps so far are correct?

• You can write the second integral with the curve $\gamma_{k}$ as a line integral under the substitution $z = Re^{it}$ with $t \in [0,\pi]$ – JessicaK Sep 20 '17 at 23:29
• @JessicaK But then wouldn't the integral converge to 0 as R goes to infinity? – Ray Sep 20 '17 at 23:36
• To abuse notation a little, the point is that $\oint_{C} = \int_{-R}^{R} + \int_{\gamma_{r}} = 0$, or $\int_{-R}^{R} = -\int_{\gamma_{r}}$. You can then compute $\int_{-\infty}^{\infty} e^{-x^{2}} \cos(2x)\operatorname{d}\!x$ by computing the line integral and taking the limit of both sides. – JessicaK Sep 20 '17 at 23:40
• @JessicaK So I get that and I've been trying to solve that line integral for a while now, but it's a rather complicated integral to solve after substituting for z. Do you have any recommendations on how to solve it? I've tried substitution methods and integration by parts but both of those seem to make things more complicated... – Ray Sep 21 '17 at 0:30
• I'm sorry, I did not look at this question carefully enough when making a comment. It looks like you will need a different contour. I started doing the problem and it looks like taking a box-shaped contour with vertices $(-R,R,R+i, -R+i)$ should work. Some additional effort is necessary to create an estimate so that the sides vanish. I unfortunately have to leave now and cannot write up the details. – JessicaK Sep 21 '17 at 0:58

Consider $f(x)=e^{-x^{2}}$ and define $\Gamma$ to be the rectangular contour connecting the vertices at the points $-R, R, R+i, -R+i$. Furthermore, define $\gamma_{1},\gamma_{2},\gamma_{3},\gamma_{4}$ are the lines represented by

\begin{align*} \gamma_{1}&: t, &t\in[-R,R]\\ \gamma_{2}&: R+ti, &t\in [0,1]\\ \gamma_{3}&: i-t, &t\in[-R,R]\\ \gamma_{4}&: -R+(1-t)i, &t\in[0,1] \end{align*}

so that, by abusing notation,

$$\oint_{\Gamma} = \int_{\gamma_{1}} +\int_{\gamma_{2}} + \int_{\gamma_{3}} + \int_{\gamma_{4}},$$

and by Cauchy-Goursat,

$$\oint_{\Gamma} e^{-z^{2}}\operatorname{d}\!z = 0.$$

We will show that $\int_{\gamma_{2}}$ vanishes (and similarly for $\int_{\gamma_{4}}$). Indeed, under the map $z=R+ti$, $\operatorname{d}\!z = i\operatorname{d}\!t$ and by the ML lemma,

$$\left\lvert\int_{\gamma_{2}} e^{-z^{2}} \operatorname{d}\!z\right\rvert = \left\lvert\int_{0}^{1}ie^{-(R+ti)^{2}}\operatorname{d}\!t\right\rvert = \left\lvert\int_{0}^{1}ie^{-(R^{2}+2ti-t^{2})}\operatorname{d}\!t\right\rvert \leq \int_{0}^{1}\left\lvert e^{-R^{2}-t^{2}}\right\rvert\operatorname{d}\!t \leq e^{-R^{2}}\longrightarrow 0.$$

Now,

\begin{align*} \int_{\gamma_{1}} f(z)\operatorname{d}\!z + \int_{\gamma_{3}}f(z)\operatorname{d}\!z &= \int_{-R}^{R} e^{-t^{2}} \operatorname{d}\!t - \int_{-R}^{R}e^{-t^{2}-2it+1} \operatorname{d}\!t\\ &=\int_{-R}^{R} e^{-t^{2}} \operatorname{d}\!t-e \int_{-R}^{R}e^{-t^{2}}(\cos(2t) - i\sin(2t))\operatorname{d}\!t. \end{align*}

It should be easy to see from here that

$$\int_{-\infty}^{\infty}e^{-x^{2}}\cos(2x)\operatorname{d}\!x = \frac{\sqrt{\pi}}{e}.$$