TITLE: Integral$\int_0^{\pi/4} \log \tan \left(\frac{\pi}{4}\pm x\right)\frac{dx}{\tan 2x}=\pm\frac{\pi^2}{16}$
QUESTION [10 upvotes]: 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

REPLY [3 votes]: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{\int_{0}^{\pi/4}\ln\pars{\tan\pars{{\pi \over 4} \pm x}}\,
{\dd x \over \tan\pars{2x}} = \pm\,{\pi^{2} \over 16}:\ {\large ?}}$

We'll performed both calculations simultaneously.
Set
  $\quad\ds{t \equiv {\pi \over 4} \pm x\quad\imp\quad x
= \pm\pars{t - {\pi \over 4}}}$:

\begin{align}&\color{#66f}{\large\int_{0}^{\pi/4}
\ln\pars{\tan\pars{{\pi \over 4} \pm x}}\,{\dd x \over \tan\pars{2x}}}
\\[3mm]&=\int_{\pi/4}^{\braces{\pi/2 \atop {\vphantom{\Huge A}0}}}
\ln\pars{\tan\pars{t}}\,{\pm\,\dd t \over \tan\pars{\pm\bracks{2t - \pi/2}}}
\\[3mm]&=-\int_{\pi/4}^{\braces{\pi/2 \atop {\vphantom{\Huge A}0}}}
\ln\pars{\tan\pars{t}}\tan\pars{2t}\,\dd t
=-\,\half\int_{\pi/2}^{\braces{\pi \atop {\vphantom{\Huge A}0}}}
\ln\pars{\tan\pars{t \over 2}}\tan\pars{t}\,\dd t
\\[3mm]&=-\,\half\int_{1}^{\braces{\infty \atop {\vphantom{\Huge A}0}}}
\ln\pars{t}{2t \over 1 - t^{2}}\,{2\,\dd t \over 1 + t^{2}}
=-2\int_{1}^{\braces{\infty \atop {\vphantom{\Huge A}0}}}
{t\ln\pars{t} \over 1 - t^{4}}\,\dd t
\\[3mm]&=\mp\, 2\int_{0}^{1}{t^{1/4}\ln\pars{t^{1/4}} \over 1 - t}\,{1 \over 4}
\,t^{-3/4}\,\dd t
=\mp\,{1 \over 8}\ \underbrace{%
\int_{0}^{1}{t^{-1/2}\ln\pars{t} \over 1 - t}\,\dd t}
_{\ds{=\ -\,{\pi^{2} \over 2}}}
=\color{#66f}{\Large\pm\,{\pi^{2} \over 16}}
\end{align}