An astounding identity: $\int_0^{\pi/2}\ln\lvert\sin(mx)\rvert\cdot \ln\lvert\sin(nx)\rvert\, dx$ In this question,  user Franklin Pezzuti Dyer gives the following surprising integral evaluation:
$$\int_0^{\pi/2}\ln \lvert\sin(mx)\rvert \cdot \ln \lvert\sin(nx)\rvert \, dx = \frac{\pi^3}{24} \frac{\gcd^2(m,n)}{mn}+\frac{\pi\ln^2(2)}{2}$$
I've verified this numerically for small values for $m,n$.  Is there a proof?  Also, can we generalize it to more factors in the integrand?
 A: Though, I think the Fourier series approach is the cleaner approach for this integral, I'd like to present a somewhat unique alternative method.
This integral may be evaluated by exploiting symmetry and the following multiple-angle identity:
\begin{equation}
\sin(mx)=2^{m-1}\prod_{k=0}^{m-1}\sin\left(x+\frac{\pi k}{m}\right)
\end{equation}
Your integral is equal to $\frac{1}{2}I(m,n)$ where
\begin{equation}
I(m,n)=\int_0^{\pi}\ln|\sin(mx)|\cdot\ln|\sin(nx)|dx
\end{equation}
First, suppose than $m,n$ are coprime. We see that
\begin{equation}
\begin{split}
I(1,n)&=\int_0^{\pi}\ln|\sin(x)|\cdot\ln|\sin(nx)|dx\\
&=\int_0^{\pi}\ln|\sin(mx)|\cdot\ln|\sin(mnx)|dx\\
\end{split}
\end{equation}
since the integrand has period $\pi$. Applying the multiple-angle formula for $\sin$ gives us that
\begin{equation}
I(1,n)=\sum_{k=0}^{m-1}\int_0^{\pi}\ln|\sin(mx)|\cdot\ln|\sin(nx+\pi k/m)|dx+ (m-1)\ln(2)\int_0^{\pi}\ln|\sin(mx)|dx
\end{equation}
Since $n,m$ are coprime, then the map $k\mapsto nk$ is an automorphism on $\mathbb{Z}/m$, meaning that
\begin{equation}
\begin{split}
I(1,n)&=\sum_{k=0}^{m-1}\int_0^{\pi}\ln|\sin(mx)|\cdot\ln|\sin(nx+\pi nk/m)|dx \\
&\qquad\qquad + (m-1)\ln(2)\int_0^{\pi}\ln|\sin(mx)|dx\\
&=\sum_{k=0}^{m-1}\int_0^{\pi}\ln|\sin(m[x+\pi k/m])|\cdot\ln|\sin(n[x+\pi k/m])|dx \\
&\qquad\qquad+(m-1)\ln(2)\int_0^{\pi}\ln|\sin(mx)|dx\\
\end{split}
\end{equation}
Again, since the integrands have period $\pi$ we may simplify
\begin{equation}
\begin{split}
I(1,n)&=\sum_{k=0}^{m-1}\int_0^{\pi}\ln|\sin(mx)|\cdot\ln|\sin(nx)|dx+(m-1)\ln(2)\int_0^{\pi}\ln|\sin(x)|dx\\
&=mI(m,n)+(m-1)\ln(2)J\\
\end{split}
\end{equation}
where
\begin{equation}
J=\int_0^{\pi}\ln(\sin(x))dx
\end{equation}
Noting that $I(1,n)=I(n,1)$ and applying the above identity twice gives us that
\begin{equation}
I(m,n)=\frac{1}{mn}[I(1,1)+\ln(2)J]-\ln(2)J
\end{equation}
Now, in the case where $m,n$ are not coprime, then $\frac{m}{\gcd(m,n)},\frac{n}{\gcd(m,n)}$ are coprime, so by the periodicity of the integrand,
\begin{equation}
I(m,n)=I\left(\frac{m}{\gcd(m,n)},\frac{n}{\gcd(m,n)}\right)=\frac{\gcd^2(m,n)}{mn}[I(1,1)+\ln(2)J]-\ln(2)J
\end{equation}
Finally, $I(1,1)$ and $J$ are somewhat famous integrals which may be evaluated in a few different ways. This answer shows that
\begin{equation}
J=-\pi\ln(2)
\end{equation}
using an elementary method, and in this answer I use a complex-analytic method to show that
\begin{equation}
I(1,1)=\pi\ln^2(2)+\frac{\pi^3}{12}
\end{equation}
Putting these facts together, we have that
\begin{equation}
I(m,n)=\frac{\pi^3}{12}\frac{\gcd^2(m,n)}{mn}+\pi\ln^2(2)
\end{equation}
In other words, the original integral is given by
\begin{equation}
\boxed{\int_0^{\pi/2}\ln|\sin(mx)|\cdot\ln|\sin(nx)|dx=
\frac{\pi^3}{24}\frac{\gcd^2(m,n)}{mn}+\frac{\pi\ln^2(2)}{2}}
\end{equation}
which I think is a really beautiful result.
A: Okay, I'll prove it for you.
Start with the following well-known identity:
$$\int_0^{\pi}\cos(mx)\cos(nx)dx=\frac{\pi}{2}\delta_{mn}\tag{1}$$
...where $m,n$ are positive integers. Recall also the well-known Fourier Series
$$\sum_{n=1}^\infty \frac{\cos(kx)}{k}=-\frac{\ln(2-2\cos(x))}{2}\tag{2}$$
Now, replace $m$ in $(1)$ with $mk$, where both $m,k$ are integers, and divide both sides by $k$ to get
$$\int_0^{\pi}\frac{\cos(kmx)}{k}\cos(nx)dx=\frac{\pi\delta_{(mk)n}}{2k}$$
Then sum both sides from $k=1$ to $\infty$ to get
$$-\frac{1}{2}\int_0^{\pi}\ln(2-2\cos(mx))\cos(nx)dx=\frac{\pi m}{2n}[m|n]$$
where the brackets on the $RHS$ are Iverson Brackets. A bit more manipulation yields the equality
$$\int_0^{\pi}\ln\bigg(\frac{1-\cos(mx)}{2}\bigg)\cos(nx)dx=-\frac{\pi m}{n}[m|n]$$
Now, this time, replace $n$ with $nk$ and divide both sides by $k$. This yields
$$\int_0^{\pi}\ln\bigg(\frac{1-\cos(mx)}{2}\bigg)\frac{\cos(knx)}{k}dx=-\frac{\pi m}{k^2n}[m|kn]$$
Then sum from $k=1$ to $\infty$ to get
$$-\frac{1}{2}\int_0^{\pi}\ln\bigg(\frac{1-\cos(mx)}{2}\bigg)\ln(2-2\cos(nx))dx=-\sum_{k=1}^{\infty} \frac{\pi m}{k^2n}[m|kn]$$
Now notice the following about the series on the RHS. Due to the Iverson Bracket, the kth term is zero unless $m|kn$, or unless $k$ is divisible by $m/\gcd(m,n)$. Thus, we let $k=jm/\gcd(m,n)$ for the integers $j=1$ to $\infty$ and reindex the sum:
$$\begin{align}
-\frac{1}{2}\int_0^{\pi}\ln\bigg(\frac{1-\cos(mx)}{2}\bigg)\ln(2-2\cos(nx))dx
&=-\sum_{j=1}^{\infty} \frac{\pi m}{(jm/\gcd(m,n))^2n}\\
&=-\frac{\pi\gcd^2(m,n)}{mn}\sum_{j=1}^{\infty} \frac{1}{j^2}\\
&=-\frac{\pi^3\gcd^2(m,n)}{6mn}\\
\end{align}$$
or
$$\int_0^{\pi}\ln\bigg(\frac{1-\cos(mx)}{2}\bigg)\ln(2-2\cos(nx))dx=\frac{\pi^3\gcd^2(m,n)}{3mn}\tag{3}$$
Then, by using the result
$$\int_0^{\pi}\ln(1-\cos(ax))=-\pi\ln(2)\tag{4}$$
for all positive integers $a$, and the trigonometric identity
$$\sin^2(x/2)=\frac{1-\cos(x)}{2}\tag{5}$$
and finally, a substitution $x\to 2x$, the result easily follows from $(3)$ :
$$\bbox[lightgray,5px]{\int_0^{\pi/2}\ln \lvert\sin(mx)\rvert \cdot \ln \lvert\sin(nx)\rvert \, dx = \frac{\pi^3}{24} \frac{\gcd^2(m,n)}{mn}+\frac{\pi\ln^2(2)}{2}}$$
