# Evaluating $\int_0^{\Large\frac{\pi}{2}}\left(\frac{1}{\log(\tan x)}+\frac{1}{1-\tan(x)}\right)^3dx$

Using the method shown here, I have found the following closed form.

$$\int_0^{\!\Large \frac{\pi}{2}}\!\!\left(\frac{1}{\log(\tan x)}+\frac{1}{1-\tan x}\right)^2\! \mathrm dx= 3\ln2-\frac{4}{\pi}G -\frac12,$$

where $G$ is Catalan's constant.

I can see that replicating the techniques for the following integral could be rather lenghty.

$$\int_0^{\!\Large \frac{\pi}{2}}\!\!\left(\frac{1}{\log(\tan x)}+\frac{1}{1-\tan x}\right)^3\! \mathrm dx$$

My question: Could someone have, ideally, a different idea to evaluate the latter integral?

I've found it.

We have

$$\int_0^{\!\Large \frac{\pi}{2}}\!\!\left(\frac{1}{\log(\tan x)}+\frac{1}{1-\tan x}\right)^3\! \mathrm dx= \color{blue}{\frac92\ln2-\frac{6}{\pi}G -\frac34 -\frac\pi8} \tag1$$

where $G$ is Catalan's constant.

Proof. Set $$I_n:=\int_0^{\!\Large \frac{\pi}{2}}\!\!\left(\frac{1}{\log(\tan x)}+\frac{1}{1-\tan x}\right)^n\! \mathrm dx, \, n=0,1,2... . \tag2$$ Clearly $$I_0=\frac\pi2.$$ Recall that $$\tan \!\left(\!\frac\pi2 -x\!\right) = \frac{1}{\tan x}$$ giving \begin{align} \frac{1}{\log \tan \!\left(\!\frac\pi2 -x\!\right) }+\frac{1}{1-\tan \!\left(\!\frac\pi2 -x\!\right)}& =\frac{1}{\log \left( \dfrac{1}{\tan x}\right) }+\frac{1}{1-\dfrac{1}{\tan x}} \\\\ & =-\frac{1}{\log \left( \tan x \right) }-\frac{1}{1-\tan x}+1 \tag3 \end{align}

Hence, by the change of variable $\displaystyle x \rightarrow \frac\pi2 -x$, we readily have \begin{align} I_1&=\int_0^{\!\Large \frac{\pi}{2}}\!\!\left(-\frac{1}{\log(\tan x)}-\frac{1}{1-\tan x}+1\right)\! \mathrm dx =-I_1+\frac\pi2 \tag4 \end{align} $$I_1=\frac\pi4 .$$ Similarly, \begin{align} \int_0^{\!\Large \frac{\pi}{2}}\!\!\left(\frac{1}{\log(\tan x)}+\frac{1}{1-\tan x}\right)^3\! \mathrm dx & =\int_0^{\!\Large \frac{\pi}{2}}\!\!\left(\!-\frac{1}{\log \left( \tan x\! \right) }-\frac{1}{1-\tan x}+1 \! \right)^3\! \mathrm dx \end{align} \tag5 and, by the binomial expansion, \begin{align} I_3 & =-I_3+3I_2-3I_1+I_0 \end{align} $$I_3 =-I_3+3I_2-3\frac{\pi}{4}+\frac\pi2$$ $$I_3 =\frac32 I_2- \frac{\pi}{8} \tag6$$ we may conclude with this value obtained for $I_2$.

A numerical approximation is $$\color{blue}{I_3=0.22709780663611705673940738484148718263....}$$