TITLE: Evaluating $\int_{0}^{\pi/3}\ln^2 \left ( \sin x \right )\,dx$
QUESTION [20 upvotes]: Good evening!
I want to compute the integral $\displaystyle \int_{0}^{\pi/3}\ln^2 \left ( \sin x \right )\,dx$.  However I find it extremely difficult. What I've tried is rewritting it as:
$\begin{aligned}
\int_{0}^{\pi/3}\ln^2\left ( \sin x \right )\,dx &=\int_{0}^{\pi/3}\left [  \ln \left ( \sin x \right )  \right ]^2\,dx \\ 
 &= \int_{0}^{\pi/3}\left [ \ln \left ( \frac{e^{-ix}-e^{ix}}{2i} \right ) \right ]^2\,dx\\ 
 &= \int_{0}^{\pi/3}\left [ \ln \left ( e^{-ix}-e^{ix} \right )-\ln 2i \right ]^2\, dx\\ 
 &= \int_{0}^{\pi/3}\left ( \ln^2\left ( e^{-ix}-e^{ix} \right )-2\ln 2i \ln \left ( e^{-ix}-e^{ix} \right ) +\ln^2 2i\right )\,dx\\ 
 &= \int_{0}^{\pi/3} \ln^2 \left ( e^{-ix}-e^{ix} \right )\,dx-2\int_{0}^{\pi/3}\ln 2i \ln \left ( e^{-ix}-e^{ix} \right )\,dx +\int_{0}^{\pi/3}\ln^2 2i \,dx \\ 
\end{aligned}$
I wrote the first integral as:
$\begin{aligned}
\int_{0}^{\pi/3}\ln^2 \left ( e^{-ix}-e^{ix} \right )\,dx &= \int_{0}^{\pi/3}\ln^2 \left ( e^{-ix}\left ( 1-e^{-2ix} \right ) \right )\,dx\\ 
 &= \int_{0}^{\pi/3}\ln^2 \left ( e^{-ix} \right )\,dx+\int_{0}^{\pi/3}\ln^2 \left ( 1-e^{-2ix} \right )\,dx\\  
\end{aligned}$
Now I used MacLaurin's Expasion of $\ln(1-x)$ for the second integral, so that I can express it as complex series, which is the following:
$$\ln^2\left ( 1-e^{-2ix} \right )= \sum_{m=1}^{\infty}\sum_{k=1}^{\infty}\frac{e^{-2ikx}}{k}\frac{e^{-2imx}}{m} \implies \int_{0}^{\pi/3}\ln^2\left ( 1-e^{-2ix} \right )\,dx=\int_{0}^{\pi/3}\left ( \sum_{m=1}^{\infty}\sum_{k=1}^{\infty}\frac{e^{-2ikx}}{k}\frac{e^{-2imx}}{m} \right )\,dx$$
I'm pretty confident that I can alter summation and integral. I don't know if this can help. And this is where I stopped. I can't play around with the middle integral, because of that $\ln(2i)$ term which bothers me, otherwise I would apply the same technic with the MacLaurin expansion. Something also tells me that the last integral should be discarded. Because it's a complex one, but I have not dwelved in it further so I'm not quite sure if there are no cancellations with the other integrals I have, because they all contain complex parts.
Any help would be appreciated. 
P.S: This is not homework.

REPLY [13 votes]: \begin{align}\mathcal{I}&=\frac{\ln{2}}{6\sqrt{3}}\psi_1\left(\small{\frac{1}{3}}\right)+\frac{\ln{3}}{12\sqrt{3}}\psi_1\left(\small{\frac{2}{3}}\right)-\frac{\ln{3}}{12\sqrt{3}}\psi_1\left(\small{\frac{1}{3}}\right)-\frac{\ln{2}}{6\sqrt{3}}\psi_1\left(\small{\frac{2}{3}}\right)\\& \ \ \ \ +\frac{\pi}{3}\ln^2{2}-\frac{\pi}{12}\ln^2{3}+\frac{\pi^3}{81}-{\rm Im} \ {\rm Li}_3(1-e^{i2\pi/3}) \end{align}

Disclaimer: I stole this method from Random Variable so I dare not take credit for it.

Note that
$$\ln(1-e^{i2x})=\ln(\sin{x})+\ln{2}+i\left(x-\frac{\pi}{2}\right)$$
Square both sides and extract the real part.
$${\rm Re}\ln^2(1-e^{i2x})=\ln^2(\sin{x})+2\ln{2}\ln(\sin{x})+\ln^2{2}-\left(x-\frac{\pi}{2}\right)^2$$
Let us first compute $\displaystyle\mathcal{J}=\int^{\frac{\pi}{3}}_0\ln(\sin{x}){\rm d}x$.
\begin{align}
\mathcal{J}
&={\rm Re}\int^{\frac{\pi}{3}}_0\ln(1-e^{i2x}){\rm d}x-\frac{\pi}{3}\ln{2}\\
&=\frac{1}{2}{\rm Im}\int^{e^{i\frac{2\pi}{3}}}_1\frac{\ln(1-z)}{z}{\rm d}z-\frac{\pi}{3}\ln{2}\\
&=-\frac{1}{2}{\rm Im} \ {\rm Li}_2(e^{i2\pi/3})-\frac{\pi}{3}\ln{2}\\
\end{align}
Then
\begin{align}
\mathcal{I}
&=\int^{\frac{\pi}{3}}_0\ln^2(\sin{x}){\rm d}x\\
&={\rm Re}\int^{\frac{\pi}{3}}_0\ln^2(1-e^{i2x}){\rm d}x-2\mathcal{J}\ln{2}-\frac{\pi}{3}\ln^2{2}+\frac{13\pi^3}{324}\\
&=\frac{1}{2}{\rm Im}\int^{e^{i\frac{2\pi}{3}}}_1\frac{\ln^2(1-z)}{z}{\rm d}z-2\mathcal{J}\ln{2}-\frac{\pi}{3}\ln^2{2}+\frac{13\pi^3}{324}\\
&=\frac{1}{2}{\rm Im}\left[\frac{i2\pi}{3}\ln^2(1-e^{i2\pi/3})+\int^{e^{i\frac{2\pi}{3}}}_1\frac{2\ln{z}\ln(1-z)}{1-z}{\rm d}z\right]-2\mathcal{J}\ln{2}\\
&\ \ \ \ -\frac{\pi}{3}\ln^2{2}+\frac{13\pi^3}{324}\\\
&=\frac{\pi}{12}\ln^2{3}-\frac{\pi^3}{108}+\frac{1}{2}{\rm Im}\left[2{\rm Li}_2(1-e^{i2\pi/3})\ln(1-e^{i2\pi/3})-2{\rm Li}_3(1-e^{i2\pi/3})\right]\\
&\ \ \ \  +\ln{2} \ {\rm Im} \ {\rm Li}_2(e^{i2\pi/3})+\frac{2\pi}{3}\ln^2{2}-\frac{\pi}{3}\ln^2{2}+\frac{13\pi^3}{324}\\
&=\frac{5\pi^3}{162}+\frac{\pi}{12}\ln^2{3}+\frac{\pi}{3}\ln^2{2}-{\rm Im}\left[{\rm Li}_3(1-e^{i2\pi/3})-{\rm Li}_2(1-e^{i2\pi/3})\ln(1-e^{i2\pi/3})\\
-\ln{2}{\rm Li}_2(e^{i2\pi/3})\right]
\end{align}

The real part of ${\rm Li}_2(e^{i2\pi/3})$ is
\begin{align}
{\rm Re} \ {\rm Li}_2(e^{i2\pi/3})
&=\sum^\infty_{n=1}\frac{\cos(2n\pi/3)}{n^2}\\
&=-\frac{1}{4}\sum^\infty_{n=-\infty}\left(\frac{1}{(3n+1)^2}+\frac{1}{(3n+2)^2}\right)+\frac{1}{9}\sum^\infty_{n=1}\frac{1}{n^2}\\
&=\frac{1}{4}\left[\operatorname*{Res}_{z=-1/3}\frac{\pi\cot(\pi z)}{(3z+1)^2}+\operatorname*{Res}_{z=-2/3}\frac{\pi\cot(\pi z)}{(3z+2)^2}\right]+\frac{\pi^2}{54}\\
&=-\frac{\pi^2}{18}
\end{align}
and its imaginary part is
\begin{align}
{\rm Im} \ {\rm Li}_2(e^{i2\pi/3})
&=\sum^\infty_{n=1}\frac{\sin(2n\pi/3)}{n^2}\\
&=\frac{\sqrt{3}}{2}\sum^\infty_{n=0}\left(\frac{1}{(3n+1)^2}-\frac{1}{(3n+2)^2}\right)\\
&=\frac{1}{6\sqrt{3}}\psi_1\left(\small{\frac{1}{3}}\right)-\frac{1}{6\sqrt{3}}\psi_1\left(\small{\frac{2}{3}}\right)
\end{align}
By Euler's reflection formula for the dilogarithm,
\begin{align}{\rm Li}_2(1-e^{i2\pi/3})
&=\frac{\pi^2}{6}-\ln(e^{i2\pi/3})\ln(1-e^{i2\pi/3})-{\rm Li}_2(e^{i2\pi/3})\\
&=\frac{\pi^2}{9}+i\left(\frac{1}{6\sqrt{3}}\psi_1\left(\small{\frac{2}{3}}\right)-\frac{1}{6\sqrt{3}}\psi_1\left(\small{\frac{1}{3}}\right)-\frac{\pi}{3}\ln{3}\right)\end{align}
Therefore, the imaginary part of ${\rm Li}_2(1-e^{i2\pi/3})\ln(1-e^{i2\pi/3})$ is
\begin{align}
& \ \ \ \ \ \ \ {\rm Im}\ln(1-e^{i2\pi/3}){\rm Li}_2(1-e^{i2\pi/3})\\
&={\rm Re}\ln(1-e^{i2\pi/3}){\rm Im} \ {\rm Li}_2(1-e^{i2\pi/3})+{\rm Im}\ln(1-e^{i2\pi/3}){\rm Re} \ {\rm Li}_2(1-e^{i2\pi/3})\\
&=-\frac{\pi^3}{54}-\frac{\pi}{6}\ln^2{3}+\frac{\ln{3}}{12\sqrt{3}}\psi_1\left(\small{\frac{2}{3}}\right)-\frac{\ln{3}}{12\sqrt{3}}\psi_1\left(\small{\frac{1}{3}}\right)
\end{align}

Plucking these values into our previously obtained result yields
\begin{align}\mathcal{I}
&=\frac{\ln{2}}{6\sqrt{3}}\psi_1\left(\small{\frac{1}{3}}\right)+\frac{\ln{3}}{12\sqrt{3}}\psi_1\left(\small{\frac{2}{3}}\right)-\frac{\ln{3}}{12\sqrt{3}}\psi_1\left(\small{\frac{1}{3}}\right)-\frac{\ln{2}}{6\sqrt{3}}\psi_1\left(\small{\frac{2}{3}}\right)\\& \ \ \ \ +\frac{\pi}{3}\ln^2{2}-\frac{\pi}{12}\ln^2{3}+\frac{\pi^3}{81}-{\rm Im} \ {\rm Li}_3(1-e^{i2\pi/3})\approx 2.0445154\cdots\\ \end{align}