<s>[INST] Integral$\int_0^{\pi/4} \log \tan \left(\frac{\pi}{4}\pm x\right)\frac{dx}{\tan 2x}=\pm\frac{\pi^2}{16}$ Hi I am trying to prove $$
\int_0^{\pi/4} \log \tan \left(\frac{\pi}{4}\pm x\right)\frac{dx}{\tan 2x}=\pm\frac{\pi^2}{16}.
$$
What an amazing result and a clever one this is.    I tried writing
$$
\int_0^{\pi/4} \log \sin \left(\frac{\pi}{4}\pm x\right)\frac{dx}{\tan 2x}-\int_0^{\pi/4} \log \cos \left(\frac{\pi}{4}\pm x\right)\frac{dx}{\tan 2x}.
$$
Changing variables $y=2x$ I obtained
$$
\frac{1}{2}\int_0^{\pi/2} \log \sin \left(\frac{\pi}{4}\pm \frac{y}{2}\right)\frac{dy}{\tan y}-\frac{1}{2}\int_0^{\pi/2} \log \cos \left(\frac{\pi}{4}\pm \frac{y}{2}\right)\frac{dy}{\tan y}.
$$
I would rather work with the log sine/cosines for $y\in [0,\pi/2]$ since we can use $\int_0^{\pi/2} \log \sin x dx=-\frac{\pi}{2} \ln 2.$  But I am stuck here.  Thanks
 [/INST] We can write the integral as:
\begin{align*}
\int_0^{\pi/4} \frac{\log{\tan{(\frac{\pi}{4}-x)}}}{\tan{(2x)}}\, dx &= \int_0^{\pi/4} \log{\tan{(x)}}\tan{(2x)} \, dx \\
\end{align*}
Let
\begin{align*}
I(a) &= \int_0^{\pi/4} \tan{(x)}^a\, \tan{(2x)} dx \\
&= \int_0^{\pi/4} \frac{2\, \tan{(x)}^{a+1}}{1-\tan{(x)}^2} dx\\
&=\int_0^1 \frac{2\, t^{a+1}}{1-t^4}\, dt\\
&=\int_0^1 2\, t^{a+1}\, \sum_{n\ge 0} t^{4n}\, dt\\
&=\sum_{n\ge 0} \int_0^1 2\, t^{a+1+4n}\, dt\\
&=\sum_{n\ge 0} \frac{2}{a+2+4n}
\end{align*}
and the required integral is:
\begin{align*}
I'(0) &= \sum_{n\ge 0} -\frac{2}{(4n+2)^2}\\
&= -\frac{2}{4}\cdot \frac{3}{4} \zeta{(2)} = -\frac{\pi^2}{16}
\end{align*}
and in general,
\begin{align*}
I^{(n)}(0) = \boxed{\displaystyle \int_0^{\pi/4} \frac{\left(\log{\tan{\left(\frac{\pi}{4}- x\right)}}\right)^n}{\tan{(2x)}}\, dx = \frac{\left(-1\right)^{n} n!}{2^n} \left(1-\frac{1}{2^{n + 1}}\right) \zeta(n + 1)}
\end{align*}
and proceeding similarly for the other case:
\begin{align*}
 \boxed{\displaystyle \int_0^{\pi/4} \frac{\left(\log{\tan{\left(\frac{\pi}{4}+ x\right)}}\right)^n}{\tan{(2x)}}\, dx = \frac{n!}{2^n} \left(1-\frac{1}{2^{n + 1}}\right) \zeta(n + 1)}
\end{align*}
</s>