<s>[INST] How to solve $\int_0^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx$? 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.
 [/INST] You may write
$$
\begin{align}
\int_0^{\infty} \frac{\log(x+\frac{1}{x})}{1+x^2}dx&=\int_0^{\infty} \frac{\log(1+x^2)-\log x}{1+x^2}dx\\\\
&=\int_0^{\infty} \frac{\log(1+x^2)}{1+x^2}dx-\int_0^{\infty} \frac{\log x}{1+x^2}dx.
\end{align}
$$ Clearly, by the change of variable $ x \to \dfrac 1 x$, we get
$$
\int_0^{\infty} \frac{\log x}{1+x^2}dx=-\int_0^{\infty} \frac{\log x}{1+x^2}dx=0.
$$ On the other hand, by the change of variable $$x= \tan  \theta,  \quad dx =(1+\tan^2 \theta)d\theta, \quad 1+ \tan^2 \theta=\dfrac{1}{\cos^2 \theta},$$ we obtain the classic evaluation:
$$
\int_0^{\infty} \frac{\log(1+x^2)}{1+x^2}dx=-2\int_0^{\pi/2} \log ( \cos \theta) \: d\theta=\pi \log 2.
$$
</s>