# Integral:$\int^\infty_{-\infty}\frac{\ln(x^{2}+1)}{x^{2}+1}dx$

How to evaluate:

$$\int^\infty_{-\infty}\frac{\ln(x^{2}+1)}{x^{2}+1}dx$$

Maybe we can evaluate it using the well-known result:$\int_{0}^{\frac{\pi}{2}} \ln{\sin t} \text{d}t=\int_{0}^{\frac{\pi}{2}} \ln{\cos t} \text{d}t=-\frac{\pi}{2}\ln{2}$

But how do I evaluate it, using that ?

Letting $x=\tan t$ leads to $$-4 \int^{\pi/2}_0 \log(\cos t) dt = 2\pi \log 2.$$
Alternatively to Ragib's substitution, you could consider $I(s) = \int_\mathbb{R} \left(1+x^2\right)^s \mathrm{d}x$, and then evaluate $I^\prime(-1)$.
$$I(s) = \int_\mathbb{R} \left(1+x^2\right)^s \mathrm{d}x = 2 \int_0^\infty \left(1+x^2\right)^s \mathrm{d}x \stackrel{x^2=\frac{u}{1-u}}{=} \int_0^1 \left(1-u\right)^{-\frac{3}{2}-s}\frac{\mathrm{d} u}{\sqrt{u}} = B\left(\frac{1}{2}, -\frac{1}{2}-s\right)$$ Thus we established $I(s) = \sqrt{\pi}\frac{\Gamma\left(-\frac{1}{2}-s\right)}{\Gamma\left(-s\right)}$. We are now ready to compute the derivative: $$I^\prime(s) = I(s) \left( \psi(-s) - \psi\left(-s-\frac{1}{2}\right) \right)$$ and $$I^\prime(-1) = I(-1) \left( \psi(1) - \psi\left(\frac{1}{2}\right) \right) = \sqrt{\pi} \frac{\Gamma\left(\frac{1}{2}\right)}{\Gamma(1)} \left( \psi(1) - \psi\left(\frac{1}{2}\right) \right) = 2 \pi \log(2)$$ where $\Gamma\left(\frac{1}{2}\right) = \sqrt{\pi}$ was used, as well as a polygamma duplication identity: $$\psi(2s) = \log(2) + \frac{1}{2}\left(\psi(s) + \psi\left(s+\frac{1}{2}\right)\right)$$ that evaluated at $s=\frac{1}{2}$ gives $\psi(1) - \psi\left(\frac{1}{2}\right) = 2 \log(2)$.
Let $$I(\alpha)=\int_{-\infty}^{\infty}\frac{\ln(\alpha x^2+1)}{x^2+1}dx.$$ Then \begin{eqnarray*} I'(\alpha)&=&\int_{-\infty}^{\infty}\frac{x^2}{(\alpha x^2+1)(x^2+1)}dx\\ &=&\frac{1}{\alpha-1}\int_{-\infty}^{\infty}\left[\frac{1}{x^2+1}-\frac{1}{\alpha x^2+1}\right]dx\\ &=&\frac{\pi}{\sqrt{\alpha}+\alpha} \end{eqnarray*} and hence \begin{eqnarray*} I(\alpha)&=&\int\frac{\pi}{\sqrt{\alpha}+\alpha}d\alpha\\ &=&2\pi\ln(1+\sqrt{\alpha})+C. \end{eqnarray*} Clearly $I(0)=0$ implies $C=0$. Thus $$\int_{-\infty}^{\infty}\frac{\ln(x^2+1)}{x^2+1}dx=I(1)=2\pi\ln 2.$$
since $$\displaystyle\frac{\ln(x^{2}+1)}{x^{2}+1}$$ is even function, $$\int^\infty_{-\infty}\frac{\ln(x^{2}+1)}{x^{2}+1}dx = 2\int^\infty_{0}\frac{\ln(x^{2}+1)}{x^{2}+1}dx$$