# How to evaluate this integral $\int_0^{\frac{\pi}{2}}(\ln(\tan x))^2dx$?

How to evaluate this integral ? $$\int_0^{\frac{\pi}{2}}(\ln(\tan x))^2dx$$ I changed it to $$\int_{-\infty}^{\infty}\frac{x^2e^x}{e^{2x}+1}dx$$ Thanks in advance.

## 2 Answers

The integral is $$I=\int_{-\infty}^\infty\frac{x^2e^x}{e^{2x}+1}=2J$$Where, $$J=\int_{0}^\infty\frac{x^2e^x}{e^{2x}+1}dx=\int_{0}^{\infty}\frac{x^2e^{-x}}{e^{-2x}+1}dx=\int_{0}^{\infty}x^2e^{-x}\sum_{k=0}^{\infty}(-1)^k e^{-2kx}dx\\=\sum_{k=0}^{\infty}(-1)^k\int_{0}^{\infty}x^2e^{-(2k+1)x}dx\quad(\mbox{Can be justified by Fubini's theorem})\\ =\sum_{k=0}^{\infty}\frac{(-1)^k}{(2k+1)^3}\Gamma(3)$$ The answer provided by RonGordon to this series can be found in the link provided by him. This shows that the integral evaluates to $\frac{\pi^3}{8}$.

• WolframAlpha spat out an answer of $\frac{\pi^3}{8}$. It would be nice if we could equate your series to that value. My gut tells it's already been demonstrated somewhere on this site. Feb 20 '14 at 15:13
• I'm trying to find its value. Feb 20 '14 at 15:41
• math.stackexchange.com/questions/359667/… Feb 20 '14 at 16:51
• Thanks @RonGordon for the link to the series. Feb 20 '14 at 16:53

Note

\begin{align} \int_0^{\frac{\pi}{2}}\ln^2\tan x\ dx & \overset{t=\tan x}= \int_0^\infty\frac{\ln^2t}{1+t^2}dt =\frac{d^2}{da^2} \left( \int_0^\infty\frac{t^{a-1}}{1+t^2}dt\right)\bigg|_{a=1}\\ &= \frac{d^2}{da^2} \left( \frac\pi2\csc\frac{\pi a}2\right)\bigg|_{a=1}=\frac{\pi^3}{8} \end{align} where the general result $$\int_0^\infty\frac{t^{a-1}}{1+t^2}dt= \frac\pi2\csc\frac{\pi a}2$$ is used.