I need to calculate the integral $$ \int \frac{\ln(1+x^2)}{x^2+1} dx$$ strictly by using elementary functions.
Let $\displaystyle I(x)=\int \arctan^2(x) \ dx$. And now with the help of $I(x)$ we need to calculate the above integral.
I tried integration by parts but every direction I take seems to take to an even more complicated integral.
The trick is to notice that $\int \frac{1}{x^2+1}\mathrm dx$ is $\arctan(x)$. Hence use by parts formula on $\int \frac{\ln(1+x^2)}{x^2+1}\mathrm dx$ to get $\ln(1 + x^{2})*\arctan(x) -\int \frac{\arctan(x)*2x}{1 + x^{2}}\mathrm dx$. Now, apply by parts again to this integral, by taking $\frac{2*\arctan(x)}{x^2+1}$ as the integrand, to obtain the final form in terms of $I(x)$. The final answer should look along the lines of $\ln(1 + x^{2})*\arctan(x) - x*{\arctan^{2}(x)} + I(x)$.