How do I calculate the integral $\int^{\infty}_{0}\frac{\cos(ax)-\cos(bx)}{x}dx$ without residues? Consider the integral:
$$\int^{\infty}_{0}\frac{\cos(ax)-\cos(bx)}{x}\,dx$$
I found this problem in a subject test problem set and I'm unsure how to solve it without using the residue theorem. 
I've simplified it to $$\int^{\infty}_{0}-2\frac{\sin\left(\frac{(a+b)x}{2}\right)\sin\left(\frac{(a-b)x}{2}\right)}{x}\,dx$$ but still unsure where to go from here. 
There's a hint in the problem that says: " Rewrite numerator as integral over sine, estimate, and exchange order of integration." but I don't see a helpful bound to use. Bounding using the fact that $|\sin|\le 1$ hasn't gotten me anywhere helpful. 
Any ideas? 
 A: Notice that:
$$\frac{\cos (ax)-\cos (bx)}{x}=\int_{a}^{b}{\sin \left( xs \right)ds}$$
If you define
$$I\left( t \right)=\int_{0}^{\infty }{{{e}^{-tx}}\frac{\cos (ax)-\cos (bx)}{x}}dx$$
Then
$$I\left( t \right)=\int_{0}^{\infty }{{{e}^{-tx}}\left\{ \int_{a}^{b}{\sin \left( xs \right)ds} \right\}}dx$$
Reversing the order of integration gives:
$$I\left( t \right)=\int_{a}^{b}{\left\{ \int_{0}^{\infty }{{{e}^{-tx}}\sin \left( xs \right)dx} \right\}}ds$$
integration by parts twice gives 
$$\int{{{e}^{-tx}}\sin \left( xs \right)dx=\frac{{{e}^{-tx}}\left( s\sin \left( xs \right)-x\cos \left( xs \right) \right)}{{{t}^{2}}+{{s}^{2}}}}$$
So
$$I\left( t \right)=\int_{a}^{b}{\left[ \frac{{{e}^{-tx}}\left( s\sin \left( xs \right)-x\cos \left( xs \right) \right)}{{{t}^{2}}+{{s}^{2}}} \right]}_{0}^{\infty }ds=\int_{a}^{b}{\frac{s}{{{t}^{2}}+{{s}^{2}}}ds}$$
Finally the change of variable $u={{t}^{2}}+{{s}^{2}}$ reduces the integral
$$I\left( t \right)=\frac{1}{2}\ln \left( \frac{{{t}^{2}}+{{b}^{2}}}{{{t}^{2}}+{{a}^{2}}} \right)$$
Can you guess what happens when $t\to 0$?
A: I will assume $a,b>0$. If exactly one of $a,b$ is zero, the integral is easily seen to diverge, while for $a,b\neq 0$ the signs don't matter.
Take any $c>0$. Observe that by letting $x=by/a$, we have $dx/x=dy/y$ and hence
$$\int_{ac}^\infty\frac{\cos bx}{x}dx=\int_{bc}^\infty\frac{\cos ay}{y}dy,$$
where both sides converge as can be seen e.g. from the Dirichlet's test. We therefore have
$$\int_{bc}^\infty\frac{\cos ax-\cos bx}{x}dx=\int_{bc}^\infty\frac{\cos ax}{x}dx-\int_{bc}^\infty\frac{\cos bx}{x}dx\\
=\int_{bc}^\infty\frac{\cos ax}{x}dx-\int_{ac}^\infty\frac{\cos bx}{x}dx+\int_{ac}^{bc}\frac{\cos bx}{x}dx\\
=\int_{ac}^{bc}\frac{\cos bx}{x}dx.$$
Now we let $c\to 0$. The left-hand side converges to the integral you are interested in. On the right-hand side, $\cos bx$ becomes closer and closer to $1$ for $x$ between $bc$ and $ac$, so the integral is approximated by
$$\int_{ac}^{bc}\frac{1}{x}dx=\ln bc-\ln ac=\ln\frac{b}{a}.$$
In fact, that last integral tends to this value, and you can formally verify this by taking $\varepsilon>0$ and taking $c$ small enough so that $1-\varepsilon\leq\cos bx\leq 1$ and estimating. I will omit the details.
Therefore we get
$$\int_0^\infty\frac{\cos ax-\cos bx}{x}dx=\ln\frac{b}{a}.$$
A: $$
\int_0^\infty\frac{\cos (ax)-\cos (bx)}x dx=\int_0^\infty dx\int_a^b\sin wx dw\\
=\int_a^b dw \int_0^\infty{\sin w x}\, dx \stackrel*=\int_a^b\frac { dw}w=\log\left|\frac ba\right|.
$$
To justify $(\stackrel*=) $ consider: 
$$
\int_0^\infty{\sin w x}\, dx =\lim_{\epsilon\to0}\int_0^\infty{e^{-\epsilon x}\sin w x}\, dx=\lim_{\epsilon\to0}\frac w {\epsilon^2+w^2}=\frac1w.
$$
A: Except for the case $a=b=0$, the integral diverges if $ab=0$, so let's assume $|b|=|a|r\gt0$. Then
$$\int_0^\infty{\cos ax-\cos bx\over x}dx=\int_0^\infty{\cos ax-\cos arx\over x}dx=\int_0^\infty{\cos u-\cos ru\over u}du$$
Now
$$\begin{align}
I_N(r)=\int_0^N{\cos u-\cos ru\over u}du
&\implies I_N'(r)=\int_0^N\sin ru\,du={-\cos ru\over r}\Big|_0^N={1\over r}\left(1-\cos rN\right)\\
&\implies I_N(r)=\ln r-\int_1^r{\cos tN\over t}dt
\end{align}$$
(since $I_N(1)=0$). But for any fixed $r\gt0$, we have
$$\lim_{N\to\infty}\int_1^r{\cos tN\over t}dt=0$$
(We have $\int_a^bf(t)\cos tN\,dt\to0$ as $N\to\infty$ for any continuous function on any finite interval.) Thus
$$\int_0^\infty{\cos ax-\cos bx\over x}dx=\lim_{N\to\infty}I_N(|b/a|)=\ln|b/a|$$
A: Split into sum of two terms, and then apply integral from table:
$$\int \frac{\cos ax}{x} dx = \ln x - \frac{(ax)^2}{2 \cdot 2!} + \frac{(ax)^4}{4 \cdot 4!}  - \frac{(ax)^6}{6 \cdot 6!} + ... 
 $$
