# Complex integration help

The integral given is

$$\int_{-\infty}^{\infty} \frac{\cos(x)-1}{x^2}\,dx$$

Ok, so, I've used the upper semi circular contour with the function

$$f(z) = \frac{e^{iz}-1}{z^2}$$

Now the residue I get is $i$ which when used with the residue theorem gives me the answer of $-2\pi$ as the answer to the integral of the $f(z)$ and through this I get my answer to the original integral as $-2\pi$. However in the answers to this question the answer states that the solution is $-\pi$. I've double checked with Wolfram Alpha and Wolfram Alpha also gives this as an answer. Can anyone please correct me where I'm going wrong? Thanks.

-
The problem is that your integration line crosses the singularity. In this case the result has to be divided by $2$ (because we integrate $e^{ix}$ only over $(0,\pi)$ instead of $(0,2\pi)$ (sorry for the wrong previous answer...). You may prove it more rigorously by considering a little arc of circle excluding the origin (or including : the three methods will give the same result). – Raymond Manzoni May 12 '13 at 11:42
OK thanks I understand it now. Thanks for that. Does diving it by 2 hold for every time your line integral crosses a singularity? Also if I was to integrate it over the little arc excluding the origin [ie a small semi circle around the singularity] what would the radius of the smaller circle to go to in the line integral? – Lolwat May 12 '13 at 11:45
Good question (I am not entirely sure since some weird functions could be considered near $0$...). In practice you should only meet the variants with the small circle excluded or included or a vertical shift of $\epsilon$ of the whole line (for physicists). – Raymond Manzoni May 12 '13 at 11:52
Anyway the method will 'usually' work (but shouldn't be considered in a rigorous proof !) and may be generalized to any angles : if you consider only a sector with angle $\alpha$ at the singularity then the contribution will be $i\;\alpha$. – Raymond Manzoni May 12 '13 at 12:00
Thanks for the explanation, I now understand why you divide by 2. I think I also figured it out know how to use the indented region; you can notice that the original function is even so it's integral can be written as $2\int_{0}^{\infty} \frac{\cos(x)-1}{x^2}\,dx$. And from there you can use the indented region right? – Lolwat May 12 '13 at 12:07

## 2 Answers

DonAntonio gave a fine answer (+1) but let's finish too...

Let's start with : \begin{align} \int_{-\infty}^{\infty} \frac{\cos(x)-1}{x^2}\,dx&=2\int_0^{\infty} \frac{\cos(x)-1}{x^2}\,dx\\ &=\int_0^{\infty} \frac{e^{ix}+e^{-ix}-2}{x^2}\,dx\\ &=\lim_{\epsilon\to 0^+}\left[\int_{\epsilon}^{\infty} \frac{e^{ix}-1}{x^2}\,dx+\int_{\epsilon}^{\infty} \frac{e^{-ix}-1}{x^2}\,dx\right]\\ &=PV\int_{-\infty}^{\infty} \frac{e^{ix}-1}{x^2}\,dx\\ \end{align} (we had to replace $0$ by $\epsilon>0$ because of the singular part $\frac 1x$ of the integral at $0$)

Now let's integrate $\displaystyle \frac{e^{iz}-1}{z^2}$ over this contour (with a small circle of radius $\epsilon$ excluding $0$) :

The integral over $C_R$ will go to $0$ as $R\to\;+\infty$ (because $e^{iz}=e^{ix-y}$ with $y\ge 0$) and there is no residue at all in the contour so that we get (supposing $z=\epsilon\;e^{i\theta}$): $$PV\int_{-\infty}^{\infty} \frac{e^{ix}-1}{x^2}\,dx+\lim_{\epsilon\to 0}\int_{\pi}^0 \frac{e^{i\epsilon e^{i\theta}}-1}{\epsilon^2\;e^{2i\theta}}\,\epsilon\;i\;e^{i\theta}\;d\theta=0$$

Use $e^{a\epsilon}=1+a\epsilon+O(\epsilon^2)$ to get $\pi$ in the second integral and conclude !

-
Thanks very much, this is exactly what I was alluding to. Thanks once again. – Lolwat May 12 '13 at 14:50
Glad it helped @Lolwat ! (Note that you could have proposed an answer yourself : this is welcome here !) – Raymond Manzoni May 12 '13 at 14:54

Condensing what you did and comments, define

$$f(z):=\frac{e^{iz}-1}{z^2}\;,\;\;\gamma_r:=\{\,z\in\Bbb C\;;\;z=re^{it}\;,\;t\in(0,\pi)\;,\;r\in\Bbb R_+\,\}$$

and define the path

$$\Gamma_{R,\epsilon}:=[-R,\epsilon]\cup\left(-\gamma_\epsilon\right)\cup[\epsilon,R]\cup\gamma_R\;,\;\;R>>\epsilon>0$$

where $\,-\gamma_r\,$ means the integration path is taken in the clockwise direction (the negative one, thus).

Since the pole at $\,z=0\,$ is simple (why?), we get

$$\text{Re}_{z=0}(f)=\lim_{z\to 0}\,zf(z)\stackrel{\text{l'Hospital}}=ie^0=i$$

so by the lemma and in particular its corollary in an answer here, and by CIT we get

$$2\pi i\cdot i=\oint\limits_{\Gamma_{R,\epsilon}}\,f(z)\,dz\implies$$

$$-2\pi=\lim_{R\to\infty\,,\,\epsilon\to 0}\left(\int\limits_{-R}^{-\epsilon}\,f(x)dx+\int\limits_{\gamma_\epsilon}f(z)\,dz+\int\limits_\epsilon^Rf(x)\,dx+\int\limits_{\gamma_R}f(z)\,dz\right)=$$

$$=\int\limits_{-\infty}^\infty\frac{\cos x-1+i\sin x}{x^2}dx-\pi$$

And comparing real and imaginary parts you get what you need.

Note: the integral on $\,\gamma_R\,$ vanishes as $\,R\to\infty\,$ either by Jordan's Lemma or directly estimating the integral's modulus.

-
Thank you very much for the answer. – Lolwat May 12 '13 at 14:51
Any time, though in fact you had already the bulk of it. +1 for the good question adding your own effort. – DonAntonio May 12 '13 at 14:52