# Use of residue theorem to evaluate a real integral

I have seen this integral on youtube, I tried to solve it for 5 hours but I expect I need to use residue theorem which I don't really know $$\int_{0}^1\frac{\ln(x+1)}{x^2+1}\,dx$$, numerical integration yields $$0.272198261$$ with an estimated error of $$10^{-15}$$but I am not really sure how to get there, I tried to take antiderivative but failed miserably. When trying to use residue theorem which I don't really know, I got $$\ln(2)\pi$$ which is precisely 8 times the value of the numerical integration.

• Can you specify the region where you are integrating? Commented Oct 4, 2018 at 13:23
• Is the upper limit equal to $1$?? Commented Oct 4, 2018 at 13:33
• but integral is from zero to 1. I just made a typo Commented Oct 4, 2018 at 13:33

Enforcing the substitution $$x\mapsto \tan(x)$$ reveals
\begin{align} \int_0^1 \frac{\log(x+1)}{x^2+1}\,dx&=\int_0^{\pi/4} \log(\tan(x)+1)\,dx\\\\ &=\int_0^{\pi/4}\log(\sin(x)+\cos(x))\,dx-\int_0^{\pi/4}\log(\cos(x))\\\\ &=\int_0^{\pi/4}\log(\sqrt{2}\cos(\pi/4-x))\,dx-\int_0^{\pi/4}\log(\cos(x))\\\\ &=\frac{\pi}{8}\log(2) \end{align}
Feynman' trick or Fubini's theorem are valid alternatives: $$I=\int_{0}^{1}\frac{\log(x+1)}{1+x^2}\,dx = \int_{0}^{1}\int_{0}^{x}\frac{dy}{1+y}\cdot\frac{dx}{1+x^2}=\iint_{(0,1)^2}\frac{x}{(1+xy)(1+x^2)}\,dx\,dy$$ equals $$\int_{0}^{1}\frac{\pi y+2\log(2)-4\log(1+y)}{4(1+y^2)}\,dy=\frac{\pi}{4}\log(2)-\int_{0}^{1}\frac{\log(1+y)}{1+y^2}\,dy=\frac{\pi}{4}\log(2)-I$$ hence $$I=\color{red}{\frac{\pi}{8}\log(2)}$$.