# Evaluate $\int_0^{\pi/2}\ln^2(\sin\theta)\,\mathrm d\theta$

How can I evaluate

$$\int_0^{\pi/2}\ln^2(\sin\theta)\,\mathrm d\theta$$

With Wolfram Alpha (see) I get to the next result $$\int_0^{\pi/2}\ln^2(\sin\theta)\,\mathrm d\theta = \frac{1}{24} \left(\pi^3 + 3\pi \ln^2(4)\right)$$ How to prove these ?

• You can use differentiation under the integral sign, but I doubt you could compute the final result by hand – Frank W May 21 '18 at 2:20
• – Omran Kouba May 21 '18 at 4:08

Using the Fourier expansion, we have that \begin{align} \log(\sin x) = -\log 2-\sum^\infty_{k=1}\frac{\cos(2kx)}{k} \end{align} for $0 \leq x \leq \pi/2$. Then we see that \begin{align} \log^2(\sin x) = \left(\log 2 +\sum^\infty_{k=1}\frac{\cos(2kx)}{k} \right)^2 \end{align} which means \begin{align} &\int^{\pi/2}_0\left( \log 2 +\sum^\infty_{k=1}\frac{\cos(2kx)}{k} \right)^2\ dx \\ &= \int^{\pi/2}_0\log^2 2+2\log 2\sum^\infty_{k=1}\frac{\cos(2kx)}{k}+\sum^\infty_{k=1}\sum^\infty_{n=1} \frac{\cos(2kx)\cos(2nx)}{kn}\ dx\\ &= \frac{\pi}{2} \log^2 2+2\log 2 \sum^\infty_{k=1}\int^{\pi/2}_0 \frac{\cos(2kx)}{k}\ dx+\sum^\infty_{k=1}\sum^\infty_{n=1}\int^{\pi/2}_0 \frac{\cos(2kx)\cos(2n x)}{kn}\ dx\\ &= \frac{\pi}{2}\log^2 2 + \sum^\infty_{n=1} \int^{\pi/2}_0 \frac{\cos^2(2nx)}{n^2}\ dx = \frac{\pi}{2}\log^2 2 +\frac{\pi}{4}\sum^\infty_{n=1}\frac{1}{n^2}\\ &= \frac{\pi}{2}\log^2 2 +\frac{\pi^3}{24} =\frac{1}{24}\left(\pi^3+3\pi\log^2 4 \right) \end{align}

Enforcing the substitution $\theta =\arcsin(x)$ reveals

$$\int_0^{\pi/2} \log^2(\sin(\theta))\,d\theta=\int_0^1\frac{\log^2(x)}{\sqrt{1-x^2}}\,dx\tag1$$

Now, let $I(a)$ be given by the integral

$$I(a)=\int_0^1 \frac{x^a}{\sqrt{1-x^2}}\,dx \tag2$$

and note that $I''(0)=\int_0^1\frac{\log^2(x)}{\sqrt{1-x^2}}\,dx$.

By substituting $x\mapsto x^{1/2}$ in $(2)$, we obtain

\begin{align} I(a)&=\frac12\int_0^1 x^{(a-1)/2}(1-x)^{-1/2}\,dx\\\\ &=\frac12B((a+1)/2,1/2)\\\\ &=\frac{\Gamma(1/2)\Gamma((a+1)/2)}{2\Gamma(a/2+1)}\tag 3 \end{align}

Taking the second derivative of the right-hand side of $(3)$ and setting $a=0$ yields

\begin{align} I''(0)&=\frac{\sqrt\pi}{2}\left(\frac{\Gamma(1/2)\left(\psi^2(1)-2\psi(1/2)\psi(1)+\psi^2(1/2)-\psi'(1)\psi'(1/2)\right)}{4\Gamma(1)}\right)\\\\ &=\frac1{24}(\pi^3+12\pi\log^2(2)) \end{align}

You can use differentiation under the integral sign to evaluate the more general integral$$I=\frac {\partial^2}{\partial a^2}\int\limits_0^1dt\,\frac {t^a}{\sqrt{1-t^2}}=\frac {\sqrt{\pi}}2\frac {\partial^2}{\partial a^2}\frac {\Gamma\left(\frac a2+\frac 12\right)}{\Gamma\left(\frac a2+1\right)}$$The derivatives of the gamma function may be computed using a CAS or by hand patiently. It's important to note that\begin{align*}\Gamma'(z) & =\Gamma(z)\psi(z)\\\Gamma''(z) & =\Gamma(z)\psi^2(z)+\psi'(z)\end{align*}So the problem now comes down to evaluating $\Gamma'(z), \psi(z),\psi'(z)$ at the points $1/2$ and $1$. This can be done by using their expansion to see that$$\psi(1)=-\gamma\qquad\qquad \psi\left(\frac 12\right)=-\gamma-\log 4$$And$$\psi'(1)= \zeta(2)\qquad\qquad\psi'\left(\frac 12\right)=3\zeta(2)$$The final outcome gives$$\int\limits_0^1dt\,\frac {\log^2t}{\sqrt{1-t^2}}\color{blue}{=\frac {\pi^3}{24}+\frac {\pi\log^24}8}$$