<s>[INST] Is there an efficient way of showing $\int_{-1}^{1} \ln\left(\frac{2(1+\sqrt{1-x^2})}{1+x^2}\right)dx = 2$? Hi I recently came across the following integral:
$$
\int_{-1}^{1} \ln\left(\frac{2(1+\sqrt{1-x^2})}{1+x^2}\right)dx
$$
When an integral calculator finds the antiderivative of the equation (if it even can) it comes out as this crazy formula.
Anyways the definite integral happens to be equal to 2 and I was wondering if there might be an elegant way of showing that this is the case.
Thank you.
 [/INST] $$I=\int_{-1}^1\ln\left(\frac{2(1+\sqrt{1-x^2})}{1+x^2}\right)dx=2\int_{0}^1\ln\left(\frac{2(1+\sqrt{1-x^2})}{1+x^2}\right)dx$$
$$=2\int_0^1 \ln(2)dx+2\int_0^1\ln(1+\sqrt{1-x^2})dx-2\int_0^1\ln(1+x^2)dx$$
$$=2I_1+2I_2-2I_3$$
$$I_1=\boxed{\ln(2)}$$
$$I_2\overset{IBP}{=}x\ln(1+\sqrt{1-x^2}))|_0^1+\int_0^1\frac{x^2}{\sqrt{1-x^2}(1+\sqrt{1-x^2})}dx$$
$$\overset{x=\sin\theta}{=}\int_0^{\pi/2}\frac{\sin^2\theta}{1+\cos\theta}d\theta=\int_0^{\pi/2}\frac{1-\cos^2\theta}{1+\cos\theta}d\theta$$
$$=\int_0^{\pi/2}(1-\cos\theta)d\theta=\boxed{\frac{\pi}{2}-1}$$
$$I_3\overset{IBP}{=}x\ln(1+x^2)|_0^1-\int_0^1\frac{2x^2}{1+x^2}dx$$
$$=\boxed{\ln(2)-\left(2-\frac{\pi}{2}\right)}$$
Combining the boxed results gives $2$.
</s>