# 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.


\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}}}$$

• Thanks for the solution. I appreciate the use of special functions by you in this proof and in others, very helpful! I also am glad to see the usual $\partial_\mu$ you like to use! I would check this as the answer, but have already checked the one above. Thanks +1 – Jeff Faraci Apr 27 '14 at 3:25
• @Integrals $\partial_{\mu}$ is my ghost. Thanks. – Felix Marin Apr 27 '14 at 6:45

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}$$

• +1 cannot believe "The world's sneakiest substitution" was staring at me in the face. – IAmNoOne Apr 26 '14 at 23:32
• $\beta(2m+1) = \sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2n+1)^{2m+1}}$ has a nice closed form in terms of the Euler numbers. math.stackexchange.com/questions/762813/… – Random Variable Apr 27 '14 at 0:00
• @David H. This is a very nice solution and I didn't see the substitution at first at all! Thank you for this! – Jeff Faraci Apr 27 '14 at 0:07
• @RandomVariable Your comment completes the proof of this problem, so thanks. – Jeff Faraci Apr 27 '14 at 0:14

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}