# Evaluate improper integral $(\cos(2x)-1)/x^2$

Consider the following improper integral:

$$\int_0^\infty \frac{\cos{2x}-1}{x^2}\;dx$$

I would like to evaluate it via contour integration (the path is a semicircle in the upper plane), but i have some problems: first, the only singularity would be $z=0$, but it is only an apparent singularity so the residue is $0$. There are no other singularity of interest, so the integral should be zero... But it can't be zero, so?

-
The integral of this function along any closed path is $0$, for the reason you mentioned. What would make you think it can't be $0$? –  Michael Hardy Feb 18 '12 at 21:32
$\cos(2x) - 1 = -2\sin^2(x)$, thus $\int_0^\infty \frac{\cos(2x)-1}{x^2} \mathrm{d} x = - 2 \int_0^\infty \left(\frac{\sin(x)}{x}\right)^2 \mathrm{d} x = -\pi$. –  Sasha Feb 18 '12 at 22:00
Ok, it's correct, but the last integral is just the same... I feel uneasy because, reasoning in terms of contour integration, I can't solve either the integral above nor the one you use (both have an apparent singularity in $z=0$). So, again, shouldn't it be zero? –  quark1245 Feb 18 '12 at 22:13
Write down your contour argument more carefully. –  GEdgar Feb 18 '12 at 22:20
Strategy: let $f(z)=(\cos(2z)-1)/z^2$; our path in the complex plane is the semicircle of radius $r$ in the upper plane, oriented positively, plus the real interval from $-r$ to $-\epsilon$, the semicircle of radius $\epsilon$ (just to avoid the singularity in $z=0$), plus the real interval from $\epsilon$ to $r$. In the limit $\epsilon\to 0$ and $R\to\infty$, the integral along the semicircle of radius $r$ is zero (consider the absolute value of the integral), the integral along the semicircle of radius $\epsilon$ is zero (the singularity is apparent, so the residue is zero).. to be continued –  quark1245 Feb 18 '12 at 22:28

$$\int_0^\infty\frac{\cos 2\,x-1}{x^2}\,dx=\frac12\,\int_{-\infty}^\infty\frac{\cos 2\,x-1}{x^2}\,dx=\frac12\,\int_{-\infty}^\infty\frac{\Re(e^{2ix}-1)}{x^2}\,dx.$$ The key is the choice of function to integrate along a path. The function $$f(z)=\frac{e^{2iz}-1}{z^2}=\frac{2\,i}{z}-2-\frac{4\,i}{3}\,z+\cdots$$ has a simple pole at $z=0$ with residue $2\,i$. Take $R>0$ large and $\epsilon>0$ small. Integrate along a path formed by the positively oriented semicircle of radius $R$ in the upper half plane ($C_R$), the interval $[-R,-\epsilon]$ ($C_\epsilon$), the semicircle of radius $\epsilon$ negatively oriented and the interval $[\epsilon,R]$ and take the limit as $R\to\infty$ and $\epsilon\to0$. The integral along the path is zero, $\lim_{R\to\infty}\int_{C_R}f(z)\,dz=0$, but $\lim_{R\to\infty}\int_{C_\epsilon}f(z)\,dz=?$.
Now we are rescued by the half residue theorem that states that the last integral is $\pi i$ times the residue in zero, which is $2i$. Change the sign because the semicircle is oriented negatively. So, the integral is $-2\pi$. Done. Yet, can you state more precisely where my previous argument goes wrong? –  quark1245 Feb 19 '12 at 9:50
$$\lim_{R\to\infty}\int_{C_R}\frac{\cos 2\,z-1}{z^2}\,dz=\ne0.$$ –  Julián Aguirre Feb 19 '12 at 18:05
It is much easier to use Laplace Transform to calculate this improper integral. Recall that if $F(s)$ is the Laplace Transform of $f(x)$, then $$\mathcal{L}\big\{\frac{f(x)}{x}\big\}=\int_s^\infty F(u)du.$$ Let $f(x)=\cos 2x-1$; then $F(s)=\frac{s}{s^2+4}-\frac{1}{s}$. Thus \begin{eqnarray*} \mathcal{L}\big\{\frac{\cos 2x-1}{x}\big\}&=&\int_s^\infty\left(\frac{u}{u^2+4}-\frac{1}{u}\right)du\\ &=&\ln s-\frac{1}{2}\ln(s^2+4). \end{eqnarray*} Therefore \begin{eqnarray*} \mathcal{L}\big\{\frac{\cos 2x-1}{x^2}\big\}&=&\int_s^\infty\left(\ln u-\frac{1}{2}\ln(u^2+4)\right)du\\ &=&-\pi+2\arctan\frac{s}{2}-s\ln s+\frac{1}{2}\ln(s^2+4). \end{eqnarray*} So $$\int_0^\infty\frac{\cos 2x-1}{x^2}dx=\lim_{s\to o^+}\left(-\pi+2\arctan\frac{s}{2}-s\ln s+\frac{1}{2}\ln(s^2+4)\right)=-\pi.$$