How to determine the convergence of this improper integral? How to determine the convergence of $\int_0^\infty e^{-x}\log(\cos^2x)dx$? Any hint is appreciated.
 A: The function $\log(\cos^2)$ is nonpositive on $(0,+\infty)$ with period $\pi$ hence, splitting $(0,+\infty)$ into the intervals $n\pi+(0,\pi)$ for $n\geqslant0$, one sees that, finite or infinite, the integral is
$$
I=\sum_{n\geqslant0}\int_0^\pi\mathrm e^{-x-n\pi}\log(\cos^2x)\mathrm dx=\frac{J}{1-\mathrm e^{-\pi}},\qquad J=\int_0^\pi\mathrm e^{-x}\log(\cos^2x)\mathrm dx.
$$
Since $\mathrm e^{-\pi}\leqslant\mathrm e^{-x}\leqslant1$ on $(0,\pi)$, $J$ converges if and only if $K$ converges, where
$$
K=\int_0^\pi\log(\cos^2x)\mathrm dx=2\int_0^{\pi/2}\log(\cos^2x)\mathrm dx=2\int_0^{\pi/2}\log(\sin^2x)\mathrm dx.
$$
The last integral has a singularity at $x=0$, $x\gt0$, where $\log(\sin^2x)\sim2\log x$. Since $x\mapsto\log x$ is integrable at $x=0$, $x\gt0$, $K$ is finite. Finally, $I$ converges.
A: CORRECTION

Well, I guess I should admit that my first attempt contained an error. So may be I should try the second time.
But I still will try to use the same series expansion as in the first time.
One can utilize the idea of splitting the integral over periods of $\ln(\cos^2(x))$ (and the property of logarythms $\ln(\cos(x)^2)=2 \ln(\cos(x))$) like:
$$2\int_{0}^{\pi \over 2}\mathrm e^{-x}\log(\cos(x))\mathrm dx+2\sum_{n=1}^\infty\int_{\frac{\pi}{2}+n}^{\frac{3\pi}{2}+n}\mathrm e^{-(x+n\pi)}\log(\cos(x))\mathrm dx$$
Then for $ x^2\leq \frac{\pi^2}{4}$ one can use expansion:
$$\ln(\cos(x))=-\frac{1}{2}\sum_{k=1}^\infty \frac{\sin^{2k}(x)}{k},$$
And
$$-\sum_{k=1}^\infty \frac{1}{k}\int_{0}^{\pi \over 2}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx-\sum_{k=1}^\infty \frac{1}{k}\sum_{n=1}^\infty \mathrm e^{-n\pi}\int_{\frac{\pi}{2}+n}^{\frac{3\pi}{2}+n}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx$$
Then one can use the fact that the functions $\mathrm e^{-x}\sin^{2k}(x)$ within the integration limits, so:
$$\int_{0}^{\pi \over 2}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx\leq \int_{0}^{\infty}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx$$
And the function under integral $\int_{\frac{\pi}{2}+n}^{\frac{3\pi}{2}+n}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx$ gets smaller on every sequential "quasi-period" $n$, so:
$$\sum_{n=1}^\infty \mathrm e^{-n\pi}\int_{\frac{\pi}{2}+n}^{\frac{3\pi}{2}+n}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx\leq \sum_{n=1}^\infty \mathrm e^{-n\pi} n \int_{\frac{\pi}{2}}^{\frac{3\pi}{2}}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx.$$
One can again bound the obtained integral:
$$\int_{\frac{\pi}{2}}^{\frac{3\pi}{2}}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx\leq \int_{0}^{\infty}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx.$$ 
Assuming, that: 
$$\sum_{n=1}^\infty \mathrm e^{-n\pi} n=\frac{e^{\pi }}{\left(e^{\pi }-1\right)^2}$$
one will finally gets:
$$\int_0^\infty e^{-x}\log(\cos^2x)dx\leq -\bigg(\!1+\frac{e^{\pi }}{\left(e^{\pi }-1\right)^2}\!\!\bigg)\sum_{k=1}^\infty \frac{1}{k}\int_{0}^{\infty}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx $$
At last one can use the following equality (see:  "Integrals and Series: Elementary Functions (Vol. 1)" A. P. Prudnikov, Y.A. Brychkov, O.I. Marichev):
$$\int_{0}^{\infty}\mathrm e^{-x}\sin^{2k}(x)\mathrm dx=(2k)!\prod_{l=0}^k\frac{1}{1+4l^2}$$
And $$\prod_{l=0}^k\frac{1}{1+4l^2}=\frac{\pi  2^{-2 k-1} \mathrm{csch\big(\frac{\pi}{2}\big)}}{\left(\Gamma \left(\left(1-\frac{i}{2}\right)+k\right) \Gamma \left(\left(1+\frac{i}{2}\right)+k\right)\right)}$$
The resultant sum is convergent (here I used Wolfram Mathematica): $$\frac{2 \ \mathrm{csch\big(\frac{\pi}{2}\big)}}{\pi }\sum _{k=1}^{\infty }\frac{1}{k} \frac{2^{-2 k} (2 k)!}{\Gamma \left(\left(1-\frac{i}{2}\right)+k\right) \Gamma \left(\left(1+\frac{i}{2}\right)+k\right)}=\frac{\pi}{4}\mathrm{csch\big(\frac{\pi}{2}\big)}\frac{\, _3F_2\left(1,1,\frac{3}{2};2-\frac{i}{2},2+\frac{i}{2};1\right)}{\Gamma \left(2-\frac{i}{2}\right) \Gamma \left(2+\frac{i}{2}\right)}.$$
So finally:
$$\int_0^\infty e^{-x}\log(\cos^2x)dx\leq -\bigg(\!1+\frac{e^{\pi }}{\left(e^{\pi }-1\right)^2}\!\!\bigg)\frac{\pi}{4}\mathrm{csch\big(\frac{\pi}{2}\big)}\frac{\, _3F_2\left(1,1,\frac{3}{2};2-\frac{i}{2},2+\frac{i}{2};1\right)}{\Gamma \left(2-\frac{i}{2}\right) \Gamma \left(2+\frac{i}{2}\right)}$$
or numerically it equals to $-1.081$. Numerical integration of the initial integral gives the answer $-1.032$. So: 1) the initial integral is convergent, 2) the relative error of the obtained estimate from the numeric integration of the integral is about $4.75 \%$.
P.S.: by the way, if we neglect the second integral (which includes the periods $n\geq 1$) then the relative error will drop dramatically to $10^{-12}\%$.
