TITLE: How to find PV $\int_0^\infty \frac{\log \cos^2 \alpha x}{\beta^2-x^2} \, \mathrm dx=\alpha \pi$
QUESTION [29 upvotes]: $$
I:=PV\int_0^\infty \frac{\log\left(\cos^2\left(\alpha x\right)\right)}{\beta^2-x^2} \, \mathrm dx=\alpha \pi,\qquad \alpha>0,\  \beta\in \mathbb{R}.$$
I am trying to solve this integral, I edited and added in Principle value to clarify the convergence issue that the community pointed out.  I tried to use $2\cos^2(\alpha x)=1+\cos 2\alpha x\,$ and obtained
$$
I=-\log 2 \int_0^\infty \frac{\mathrm dx}{\beta^2-x^2}+\int_0^\infty \frac{\log (1+\cos 2 \alpha x)}{\beta^2-x^2}\mathrm dx,
$$
simplifying
$$
I=\frac{ \pi \log 2 }{2\beta}+\int_0^\infty \frac{\log (1+\cos 2 \alpha x)}{\beta^2-x^2}\mathrm dx
$$
but  stuck here. Note the result of the integral is independent of the parameter $\beta$. Thank you
Also for $\alpha=1$, is there a geometrical interpretation of this integral and why it is $\pi$?
Note this integral 
$$
\int_0^\infty \frac{\log \sin^2 \alpha x}{\beta^2-x^2} \,\mathrm dx=\alpha \pi-\frac{\pi^2}{2\beta},\qquad \alpha>0,\beta>0
$$
is also FASCINATING, note the constraint $\beta>0$ for this one.  I am not looking for a solution to this too obviously on the same post, it is just to interest people with another friendly integral.

REPLY [13 votes]: Let us use the contour $\gamma$ which is the limit as $R\to\infty$ and $r\to0$ of
$$
[-R,-\beta-r]\cup-\beta+re^{i[\pi,0]}\cup[-\beta+r,\beta-r]\cup\beta+re^{i[\pi,0]}\cup[\beta+r,R]\cup Re^{i[0,\pi]}
$$
$\hspace{3.5cm}$
to compute
$$
\begin{align}
&PV\int_{-\infty}^\infty\frac{\cos(\alpha x)}{\beta^2-x^2}\mathrm{d}x\\
&=PV\int_{-\infty}^\infty\frac{e^{i\alpha x}}{\beta^2-x^2}\mathrm{d}x\\
&=\int_\gamma\frac{e^{i\alpha z}}{\beta^2-z^2}\mathrm{d}z+\pi i\operatorname*{Res}_{z=-\beta}\left(\frac{e^{i\alpha z}}{\beta^2-z^2}\right)+\pi i\operatorname*{Res}_{z=\beta}\left(\frac{e^{i\alpha z}}{\beta^2-z^2}\right)\\
&=0+\pi i\frac{e^{-i\alpha\beta}}{2\beta}-\pi i\frac{e^{i\alpha\beta}}{2\beta}\\[6pt]
&=\frac\pi\beta\sin(\alpha\beta)
\end{align}
$$
where $\alpha\ge0$ (needed so that the integral vanishes along the large arc); however, the principal value integral is even in $\alpha$.
Setting $\alpha=0$ gives
$$
PV\int_{-\infty}^\infty\frac1{\beta^2-x^2}\mathrm{d}x=0
$$

Now we can use that
$$
\log\left(\cos^2(\alpha x)\right)=-2\log(2)+2\sum_{k=1}^\infty\frac{(-1)^{k-1}}{k}\cos(2k\alpha x)
$$
to get, for $\alpha\ge0$,
$$
\begin{align}
\int_0^\infty\frac{\log\left(\cos^2(\alpha x)\right)}{\beta^2-x^2}\mathrm{d}x
&=\frac12\int_{-\infty}^\infty\frac{\log\left(\cos^2(\alpha x)\right)}{\beta^2-x^2}\mathrm{d}x\\
&=\frac\pi\beta\sum_{k=1}^\infty\frac{(-1)^{k-1}}{k}\sin(2k\alpha\beta)\\
&=\frac\pi\beta\frac1{2i}\sum_{k=1}^\infty\frac{(-1)^{k-1}}{k}\left(e^{2ik\alpha\beta}-e^{-2ik\alpha\beta}\right)\\
&=\frac\pi\beta\frac1{2i}\left(\log\left(1+e^{2i\alpha\beta}\right)-\log\left(1+e^{-2i\alpha\beta}\right)\right)
\end{align}
$$

Note that
$$
\theta(\alpha,\beta)=\frac\pi\beta\frac1{2i}\left(\log\left(1+e^{2i\alpha\beta}\right)-\log\left(1+e^{-2i\alpha\beta}\right)\right)
$$
is an odd function of $\alpha$ with a period of $\frac\pi{|\beta|}$ and equals $\pi\alpha$ for $|\alpha|\lt\frac\pi{2|\beta|}$. Furthermore, in general,
$$
\int_0^\infty\frac{\log\left(\cos^2(\alpha x)\right)}{\beta^2-x^2}\mathrm{d}x=\theta(|\alpha|,\beta)
$$
and $\theta(|\alpha|,\beta)=\pi|\alpha|$ for $|\alpha|\le\frac\pi{2|\beta|}$.
Thus, the integral is not totally independent of $\beta$.