Seeking methods to solve $ \int_{0}^{\frac{\pi}{2}} \ln\left|2 + \tan^2(x) \right| \:dx $

calculusdefinite integralsintegrationleibniz-integral-rule

As part of going through a set of definite integrals that are solvable using the Feynman Trick, I am now solving the following:

$$ \int_{0}^{\frac{\pi}{2}} \ln\left|2 + \tan^2(x) \right| \:dx $$

I'm seeking methods using the Feynman Trick (or any method for that matter) that can be used to solve this definite integral.

Best Answer

If one wishes to use "Feynman's Trick," then begin by defining a function $I(a)$, $a>1$ as given by

$$I(a)=\int_0^{\pi/2}\log(a+\tan^2(x))\,dx \tag1$$

Differentiation of $(1)$ reveals

$$\begin{align} I'(a)&=\int_0^{\pi/2} \frac{1}{a+\tan^2(x)}\,dx\\\\ &=\frac{\pi/2}{a-1}-\frac{\pi/2}{\sqrt a (a-1)}\tag2 \end{align}$$

Integration of $(2)$ yields

$$\begin{align} I(a)&=\frac\pi2\left(\log(a-1)+\log\left(\frac{\sqrt a+1}{\sqrt{a}-1}\right) \right)\\\\ &=\pi \log(\sqrt a+1)\tag3 \end{align}$$

Finally, setting $a=2$ in $(3)$, we obtain the coveted result

$$\int_0^{\pi/2}\log(2+\tan^2(x))\,dx=\pi \log(\sqrt 2+1)$$