Suppose $ \alpha, \beta>0 $. Compute: $ \int_{0}^{\infty}\frac{\cos (\alpha x)-\cos (\beta x)}{x}dx $ 
Suppose $ \alpha, \beta>0 $. Compute:
  $$ \int_{0}^{\infty}\frac{\cos (\alpha x)-\cos (\beta x)}{x}dx $$

Here is what I do:
$$\begin{align}
\int_{0}^{\infty}\frac{\cos (\alpha x)-\cos (\beta x)}{x}dx &= \int_{0}^{\infty}dx\int_{\alpha}^{\beta}\sin (yx)dy\\
&=\int_{\alpha}^{\beta}dy\int_{0}^{\infty}\sin(yx)dx\\
& \\
&   \qquad\text{let $ yx=u $}\\
& \\
&=\int_{\alpha}^{\beta}\frac{1}{y}dy\int_0^{\infty}\sin u du\\
&=\int_{\alpha}^{\beta}\frac{1}{y}dy\left( -\cos u|_{\infty}+\cos u|_0 \right)\\
&=\log\frac{\beta}{\alpha}(-\cos(\infty)+1)\\
&=\log\frac{\beta}{\alpha}-\cos(\infty)\log\frac{\beta}{\alpha}
\end{align}$$
But $ \cos(\infty) $ does not exist right? Does it mean the integral actually diverse?
Edit: The question comes from https://math.uchicago.edu/~min/GRE/files/week1.pdf
Who can point out my mistake in the above deduction?
 A: \begin{align}
\int_{0}^{\infty}e^{-tx}\frac{\cos (\alpha x)-\cos (\beta x)}{x}dx &= \int_{0}^{\infty}dx\int_{\alpha}^{\beta}e^{-tx}\sin (yx)dy\\
&=\int_{\alpha}^{\beta}dy\int_{0}^{\infty}e^{-tx}\sin(yx)dx\\
&=\int_{\alpha}^{\beta}dy\dfrac{y}{t^2+y^2}\\
&=\dfrac12\ln\dfrac{t^2+\beta^2}{t^2+\alpha^2}
\end{align}
now let $t=0$.
A: This is a Frullani integral. Compute as follows. 
Let $0 < r < R < +\infty$. Then 
$$\newcommand \diff {\,\mathrm d}
\int_r^R \frac {\cos(\alpha x) - \cos(\beta x)}x \diff x = \int_r^R \frac {\cos(\alpha x)}x \diff x - \int_r^R \frac {\cos(\beta x)}x \diff x =\left( \int_{\alpha r}^{\alpha R} - \int_{\beta r}^{\beta R}\right)\frac {\cos t}t \diff t = \int_{\alpha r}^{\beta r} \frac {\cos t}t\diff t - \int_{\alpha R}^{\beta R} \frac {\cos t} t \diff t = I(r) - J(R). 
$$
Now for $I(r)$, use the 1st MVT for integrals, we have
$$
I(r) = \cos(A) \int_{\alpha r}^{\beta r} \frac {\diff t} t = \cos(A) \log(\beta/\alpha) [A = \alpha r + (1-s)(\beta - \alpha)r, s \in (0,1)] \xrightarrow{r \to 0^+} \cos 0 \log(\beta /\alpha) = \log(\beta/\alpha). 
$$
For $J(R)$, note that the integral
$$
\int_1^{+\infty}\frac {\cos t}t \diff t
$$
converges by Dirichlet test, hence 
$$
J(R) \xrightarrow{R \to +\infty} 0
$$
by Cauchy principle. Altogether the original integral is 
$$
\lim_{\substack {r \to 0^+\\ R\to +\infty }} I(r) - J(R) = \log\left( \frac \beta \alpha\right). 
$$
A: I would actually use Laplace transforms to compute this sort of an integral.
You must have used it in solving linear differential equations in the past.
It can be defined as follows:-
$$ \mathcal{L}\{f(x)\}=\int_{0}^\infty e^{-px}f(x)dx = F(p)$$
Here we are transforming the function $f$ with domain $x$ to a function $F$ with domain $p$ with a unilateral integral transform of kernel $e^{-px}$. Now consider the general Laplace transform formula given above. Differentiating both sides with respect to $p$ we get:
$$F'(p)=\int_{0}^\infty e^{-px}(-x)f(x)dx=-\mathcal{L}\{xf(x)\} \rightarrow (1)$$
Now put $G(p)$ as Laplace transform of $f(x)/x$ and obtain its differentiation using equation $(1)$:-
$$G(p)=\mathcal{L}\left\{\frac{f(x)}{x}\right\}\Rightarrow G'(p)=-\mathcal{L}\{f(x)\}=-F(p)\rightarrow (2)$$
Using the Fundamental Theorem of Calculus (relationship between derivative and integral) for $(2)$:
$$G(p)=-\int_{a}^p F(p)dp \Rightarrow \int_{0}^\infty e^{-px}\frac{f(x)}{x}dx=-\int_{a}^p F(p)dp \rightarrow (3)$$
Note that $a$ here is some constant. If $G(p) \rightarrow 0$ as $p \rightarrow \infty$ then we put $a = \infty$ and obtain the following:-
$$\int_{0}^\infty e^{-px}\frac{f(x)}{x}dx=\int_{p}^\infty F(p)dp \rightarrow (4)$$
If we let $p \rightarrow 0$ on both sides of equation $(4)$ we get the following:
$$\int_{0}^\infty \frac{f(x)}{x}dx=\int_{0}^\infty F(p)dp \rightarrow (5)$$
This is useful for us for finding the improper integral of various functions of the form $f(x)/x$ where the transform $F(p)$ is known. Now I leave the proof for the following upto you (which is elementary considering we use integration by parts):
$$\mathcal{L}\{ \cos bx \} = \int_{0}^\infty e^{-px}(\cos bx) dx = \frac{p}{p^2 + b^2} \ (p>0) \rightarrow (6)$$
For some constant $b$. Now using equation (5) and (6) we get:
$$\int_{0}^\infty \frac{\cos bx}{x}dx=\int_{0}^\infty \frac{p}{p^2 + b^2}dp \rightarrow (7)$$
Now plugging in equation $(7)$ into the integral we are required to compute:-
$$I=\int_{0}^\infty \frac{\cos \alpha x - \cos \beta x}{x}dx = \int_{0}^\infty p \left( 
\frac{1}{p^2 + \alpha^2} - \frac{1}{p^2 + \beta^2} \right)dp$$
$$\Rightarrow I=\frac{\beta^2-\alpha^2}{2} \int_{0}^\infty \frac{2p}{(p^2+\alpha^2)(p^2 +\beta^2)}dp \rightarrow (8)$$
Set $v=\frac{\beta^2+\alpha^2}{2}; u=\frac{\beta^2-\alpha^2}{2}; t=p^2+u$ and using the substitutions and some further simplification:
$$I=\int_{v}^\infty \frac{u}{t^2-u^2}dt = \left[\frac{1}{2}\ln \left|\frac{t-u}{t+u}\right|\right]_{t=v}^{t=\infty}=\frac{1}{2}\ln \left|\frac{u+v}{u-v}\right|$$
Substituting the variables back and rewriting the main equation for $I$ we get:
$$\int_{0}^\infty \frac{\cos \alpha x - \cos \beta x}{x}dx = \ln \frac{\beta}{\alpha}$$
