Show that $\int_0^\pi \log^2\left(\tan\frac{ x}{4}\right)dx=\frac{\pi^3}{4}.$ Hi I am trying to prove the relation
$$
I:=\int_0^\pi \log^2\left(\tan\frac{ x}{4}\right)dx=\frac{\pi^3}{4}.
$$
I tried expanding the log argument by using $\sin x/ \cos x=\tan x,$ and than used $\log(a/b)=\log a-\log b$, I get
$$
I=\int_0^\pi \left( \log \sin \frac{x}{4}-\log\cos \frac{x}{4}\right)^2dx.
$$
We can distribute this out 
$$
\int_0^\pi \log^2 \sin \frac{x}{4}dx +\int_0^\pi \log^2\cos \frac{x}{4}dx-2\int_0^\pi\log \sin \frac{x}{4}\log \cos \frac{x}{4}dx.
$$
Now I am stuck at how to solve these.  Thanks.  
 A: Let $u=\tan{\dfrac{x}{4}}$, then $du=\dfrac{1}{4}\sec^2{\dfrac{x}{4}}dx=\dfrac{1}{4}(1+u^2)dx$. The integral becomes
\begin{align}
\int^{\pi}_0\ln^2\left(\tan\frac{x}{4}\right)dx
&=4\int^{1}_0\frac{\ln^2{u}}{1+u^2}du\\
&=4\sum_{n \ge 0}(-1)^n\int^1_0x^{2n}\ln^2{x}dx\\
&=4\sum_{n \ge 0}(-1)^n\lim_{a \to 2n}\frac{d^2}{da^2}\int^1_0x^adx\\
&=4\sum_{n \ge 0}(-1)^n\lim_{a \to 2n}\frac{d}{da}\left(-\frac{1}{(a+1)^2}\right)\\
&=8\sum_{n \ge 0}\frac{(-1)^n}{(2n+1)^3}\\
&=8\beta(3)\\
&=\frac{\pi^3}{4}
\end{align}
A: $\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{I \equiv \int_{0}^{\pi}\ln^{2}\pars{\tan\pars{x \over 4}}\,\dd x
     ={\pi^{3} \over 4\phantom{^{3}}}:\ {\large ?}}$

\begin{align}
I&=4\int_{0}^{\pi/4}\ln^{2}\pars{\tan\pars{x}}\,\dd x
=4\int_{0}^{1}{\ln^{2}\pars{x} \over x^{2} + 1}\,\dd x
=2\int_{0}^{\infty}{\ln^{2}\pars{x} \over x^{2} + 1}\,\dd x
\\[3mm]&=2\lim_{\mu \to 0}\partiald[2]{}{\mu}
\int_{0}^{\infty}{x^{\mu} \over x^{2} + 1}\,\dd x
=\lim_{\mu \to 0}\partiald[2]{}{\mu}
\int_{0}^{\infty}{x^{\pars{\mu - 1}/2} \over x + 1}\,\dd x
\end{align}

With $\ds{t \equiv {1 \over x + 1}\quad\imp\quad x = {1 \over t} - 1}$:
\begin{align}
I&=\lim_{\mu \to 0}\partiald[2]{}{\mu}
\int_{1}^{0}t\pars{1 - t}^{\pars{\mu - 1}/2}t^{\pars{1 - \mu}/2}\,
\pars{-\,{\dd t \over t^{2}}}
\\[3mm]&=\lim_{\mu \to 0}\partiald[2]{}{\mu}\int_{0}^{1}t^{-\pars{1 + \mu}/2}
\pars{1 - t}^{\pars{\mu - 1}/2}\,\dd t
=\lim_{\mu \to 0}\partiald[2]{{\rm B}\pars{1/2 - \mu/2,1/2 + \mu/2}}{\mu}
\\[3mm]&=\lim_{\mu \to 0}\partiald[2]{}{\mu}
\bracks{\Gamma\pars{1/2 - \mu/2}\Gamma\pars{1/2 + \mu/2} \over \Gamma\pars{1}}
=\lim_{\mu \to 0}\partiald[2]{}{\mu}
\braces{\pi \over \sin\pars{\pi\bracks{1/2 + \mu/2}}}
\\[3mm]&=\pi\lim_{\mu \to 0}\partiald[2]{\sec\pars{\pi\mu/2}}{\mu}
=\pi\lim_{\mu \to 0}\bracks{%
{1 \over 4}\,\pi^{2}\sec^{3}\pars{\pi\mu \over 2}
+ {1 \over 4}\,\pi^{2}\sec\pars{\pi\mu \over 2}\tan^{2}\pars{\pi\mu \over 2}}
\\[3mm]&=\pi\pars{\pi^{2} \over 4}
\end{align}

$\ds{{\rm B}\pars{x,y}}$ and $\ds{\Gamma\pars{z}}$ are the Beta and Gamma Functions, respectively, and we used well known properties of them.

$$
\int_{0}^{\pi}\ln^{2}\pars{\tan\pars{x \over 4}}\,\dd x
= {\pi^{3} \over 4\phantom{^{3}}}
$$
A: Rescaling domain by a factor of $2$, the integral becomes: $$I=2\int_{0}^{\frac{\pi}{2}}\log^2\left(\tan{\frac{x}{2}}\right)dx.$$
If it didn't appear so beforehand, the new form of the integral should be screaming "tangent half-angle substitution" to you now.
Let $t=\tan{\frac{x}{2}}$. The integral then becomes,
$$I=2\int_{0}^{1}\log^2\left(t\right)\cdot\frac{2\,dt}{1+t^2}=4\int_0^1\frac{\log^2t}{1+t^2}dt.$$
Now let $u=-\log{t}$. Then, $t=e^{-u}$, $dt=-e^{-u}du$, and
$$\int_0^1\frac{\log^2t}{1+t^2}dt=\int_{0}^{\infty}\frac{u^2e^{-u}}{1+e^{-2u}}du.$$
The denominator can be expanded into an alternating geometric series of exponentials. Interchanging the order of summation and integration then integrating term by term should yield a recognizable series:
$$\frac{1}{1+e^{-2u}}=\sum_{n=0}^{\infty}(-1)^ne^{-2nu}\\
\implies \frac{u^2e^{-u}}{1+e^{-2u}}=\sum_{n=0}^{\infty}(-1)^n u^2 e^{-(2n+1)u}\\
\implies \int_{0}^{\infty}\frac{u^2e^{-u}}{1+e^{-2u}}du=\sum_{n=0}^{\infty}(-1)^n \int_{0}^{\infty} u^2 e^{-(2n+1)u}du=2\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)^3}$$
Hence, we have the series representation of the integral $I$:
$$I=8\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)^3}$$
A: Letting $x\mapsto \frac{1}{x},$ we have
$$
I=\int_0^\pi \ln ^2\left(\tan \frac{x}{4}\right) d x=4 \int_0^{\frac{\pi}{4}} \ln ^2(\tan x) d x
$$
By my post,
$$\int_0^{\frac{\pi}{4}} \ln ^2(\tan x) d x= \frac{\pi^3}{16} ,$$
we can conclude that
$$
\boxed {I=\frac{\pi^3}{4}}
$$
