# How can I evaluate this improper integral?

I have a problem: evaluate $$\int_{0}^{\infty}\frac{\cos(x)-\cos(2x)}{x}dx\,.$$ I am told this integral is not an elementary one and that's why I am stuck where to start. Thank you for helping me.

-
Here is a related problem. – Mhenni Benghorbal Jan 3 '13 at 1:44

$$\int_a^{\infty}\frac{\cos(2x)}{x}dx = \int_{2a}^{\infty}\frac{\cos(x)}{x}dx$$ and so this integral equals $$\lim_{a\downarrow 0}\int_a^{2a}\frac{\cos(x)}{x}dx$$ which is easily found to be equal to $\log(2)$ using the inequalities $$1-\frac{x^2}{2}\leq\cos(x)\leq 1.$$

-
+1: I believe this answer gives the best intuition what is going on here... – Fabian Jan 1 '13 at 18:52
In principle there might be an analogous contribution to the result, equal to the limit when $b\to\infty$ of the integral of $x\mapsto(\cos x)/x$ on $(b,2b)$. One should show that actually this contribution disappears. – Did Jan 1 '13 at 19:18
@did Yes, absolutely. That will follow from the fact that $\int_a^{\infty}\frac{\cos(x)}{x}dx$ is a well defined improper integral to begin with. – WimC Jan 1 '13 at 19:29

$$\int_{0}^{\infty}\frac{\cos x-\cos 2x}{x}=\int_{0}^{\infty}(\mathscr L(\cos x)-\mathscr L(\cos 2x)) \\ =\int_{0}^{\infty}(\frac{s}{s^{2}+1}-\frac{s}{s^{2}+4})ds=\frac 12 \ln \left( \frac{s^{2}+1}{s^{2}+4}\right)_{0}^{\infty} =\ln 2$$

-
The integrals on the third line do not converge. – Fabian Jan 1 '13 at 18:28
The answer is edited. – aliakbar Jan 1 '13 at 18:33

This integral can be written $$\mathrm{Re}\left(\int_{0}^{\infty}\frac{e^{ix}-e^{2ix}}{x}\,dx\right)$$ We move the contour of integration so that we integrate along the positive imaginary axis instead of the positive real axis (it can be checked that the integrays decays quickly enough at infinity for this to be valid). Rewriting our new integral with $x=it$ gives $$\int_0^\infty t^{-1}(e^{-t}-e^{-2t})\,dt$$ If we replace the $t^{-1}$ with $t^{-1+\epsilon}$, for some $\epsilon>0$, the value of the above integral is $\Gamma(\epsilon)(1-2^{-\epsilon})$. As $\epsilon\to 0$, $\Gamma(\epsilon)\sim \frac{1}{\epsilon}$, so the limit of the above expression is $\log(2)$

-
The final result $\log2$ is definitely correct but the juggling with real/imaginary exponentials to get it is not quite convincing at the moment. – Did Jan 1 '13 at 18:20

This is a bit similar to @aliakbar's way but in detailed. Let $f(x)=\cos(x)-\cos(2x)$ and let's evaluate the following integral: $$I(s)=\int_{0}^{\infty}\exp(-sx)\frac{f(x)}{x}~dx$$ We can easily seen that $\lim_{x\to 0^+}\frac{f(x)}{x}=0$ and that: $$\mathcal{L}\{\cos(x)-\cos(2x)\}=\frac{s}{s^2-1}-\frac{s}{s^2+4}$$ Moreover $$\int_0^{\infty}\frac{f(x)}{x}=\int_0^{\infty}F(s)~ds$$ wherein $F(s)=\mathcal{L(f(x))}$. So $I(s)=\mathcal{L\left(\frac{f(x)}{x}\right)}=\int_s^{\infty}\left(\frac{t}{t^2-1}-\frac{t}{t^2+4}\right)dt=...=\frac{1}{2}\ln\left(\frac{s^2+4}{s^2+1}\right)$. Now set $s=0$ in the later integral. It equals to $\ln(2)$.

-

You have to use the limited developement of cos(x) and cos(2x).

-
You mean the series expansion? – Pedro Tamaroff Jan 1 '13 at 18:27