TITLE: How to solve $\int_0^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx$?
QUESTION [6 upvotes]: Here is my question
$$\int_0^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx$$
I have tried it by substituting $x$ = $\frac{1}{t}$. I got the answer $0$ but the correct answer is $\pi log(2)$. Any suggestion would be appreciated.

REPLY [3 votes]: Approach 1:
\begin{align}
I&=\int_0^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx\\
&=\int_0^{1} \frac{\log(x+\frac{1}{x})}{1+x^2}dx+\int_1^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx\\
&=2\int_0^{1} \frac{\log(x+\frac{1}{x})}{1+x^2}dx\\
&=2\int_2^{\infty} \frac{\log(u)}{u\sqrt{u^2-4}}du\\
\end{align}
using $u=x+\frac{1}{x}$ in the last step. Now set $u=2\sec y$ to obtain
\begin{align}
I&=\int_0^{\pi/2} \log(2\sec y)dy\\
&=\frac{\pi}{2}\log2-\int_0^{\pi/2} \log(\cos y)dy\\
&=\pi\log2
\end{align}
using this in the last step.
Approach 2:
$x \to \tan x$
\begin{align}
I&=-\int_0^{\pi/2} \log(\sin x\cos x)dx\\
&=-\int_0^{\pi/2} \log(\sin x)dx+\int_0^{\pi/2} \log(\cos x)dx\\
&=-2\int_0^{\pi/2} \log(\cos x)dx\\
&=\pi \log 2
\end{align}