# Can someone explain this integration trick for log-sine integrals?

I was working on this rather challenging log-sine integral:

$$∫2π0x2ln2(2sin(x2))dx=13π545 \int_{0}^{2\pi}x^{2}\ln^{2}\left(2\sin\left(x \over 2\right)\right)\,{\rm d}x = {13\pi^{5} \over 45}$$

The upper limit is a waiver from the norm of $$π2\frac{\pi}{2}$$. Anyway, when integrating log-sin integrals one can often times use the famous identity

$$−ln(2sin(x/2))=∞∑k=1cos(kx)k\displaystyle -\ln(2\sin(x/2))=\sum_{k=1}^{\infty}\frac{\cos(kx)}{k}$$

by switching sum and integral, integrating, then evaluating the sums. However, this is only valid when $$x≠±π,±2π,…x\neq \pm \pi,\pm2\pi,\ldots$$. So, just for the heck of it, I decided to do something I thought would not be viable but have done it anyway. I integrated $$∫2π0x2cos2(kx)k2,\displaystyle \int_{0}^{2\pi}\frac{x^{2}\cos^{2}(kx)}{k^{2}},$$ evaluated the resulting sums and arrived at $$41π5180\displaystyle \frac{41{\pi}^{5}}{180}$$.

Now, take the integral $$∫π0x2ln2(2cos(x/2))dx=11π5180.\displaystyle \int_{0}^{\pi}x^{2}\ln^{2}(2\cos(x/2))dx=\frac{11{\pi}^{5}}{180}.$$ This one can be done by using Cauchy’s cosine formula, differentiating, and so on. Anyway, note that when I add the two results, the correct result for the integral at hand is obtained.

$$41π5180+11π5180=13π545.\displaystyle \frac{41{\pi}^{5}}{180}+\frac{11{\pi}^{5}}{180}=\frac{13{\pi}^{5}}{45}.$$

By quandary/query is why does this happen to work?. A fluke? Does that cosine sum represent something that when evaluated and added to the above log-cos integral happens to be equivalent to the log-sine integral in question?.

See what I am trying to explain?. I done something I knew I was not supposed to, but it happened to work out. If viable, what would $$∫2π0x2cos2(kx)k2\displaystyle \int_{0}^{2\pi}\frac{x^{2}\cos^{2}(kx)}{k^{2}}$$ represent such that when it is added to $$∫π0x2ln2(2cos(x/2))dx=11π5180\displaystyle \int_{0}^{\pi}x^{2}\ln^{2}(2\cos(x/2))dx=\frac{11{\pi}^{5}}{180}$$ equals $$∫2π0x2ln2(2sin(x/2))dx=13π545\displaystyle \int_{0}^{2\pi}x^{2}\ln^{2}(2\sin(x/2))dx=\frac{13{\pi}^{5}}{45}$$.

I knew I could not just square the cosine and multiply by $$x2x^2$$. But,sometimes it can be done due to Parseval, i.e., $$ln2(2sin(x/2))=∞∑n=1∞∑k=1cos(nx)cos(kx)nk\displaystyle \ln^{2}(2\sin(x/2))=\sum_{n=1}^{\infty}\sum_{k=1}^{\infty}\frac{\cos(nx)\cos(kx)}{nk}$$. Then, because $$∫π0cos(nx)cos(kx)dx=0, n≠k\displaystyle \int_{0}^{\pi}\cos(nx)\cos(kx)dx=0, \;\ n\neq k$$, one can integrate $$∫π0cos2(kx)k2\displaystyle \int_{0}^{\pi}\frac{\cos^{2}(kx)}{k^{2}}$$, then sum.

This works for $$2π2\pi$$ as well, but that $$x2x^2$$ term tends to throw a wrench in things But I do not think I can do this in my case because of the $$x2x^2$$ term. Or can I?. I was surprised when I saw this. I thought perhaps I stumbled onto a cool way to evaluate this, but I am not entirely sure what I have.

Or, if anyone has their own clever method?.

EDIT: I managed to evaluate this integral by considering the identity

$$ln(2sin(x2))=ln(1−eix)+i2(π−x)\ln\left(2\sin\left(\frac{x}{2}\right)\right)=\ln(1-e^{ix})+\frac{i}{2}(\pi -x)$$

Preliminaries

Looking at the real part of $$log(1−eix)\log\left(1-e^{ix}\right)$$, we get
$$log(2sin(x2))=−∞∑k=1cos(kx)k \log\left(2\sin\left(\frac x2\right)\right)=-\sum_{k=1}^\infty\frac{\cos(kx)}{k}\tag1$$
Integrating by parts twice, we get
$$∫2π0x2cos(kx)dx={8π33if k=04πk2if k≠0 \int_0^{2\pi}x^2\cos(kx)\,\mathrm{d}x=\left\{\begin{array}{}\frac{8\pi^3}3&\text{if }k=0\\\frac{4\pi}{k^2}&\text{if }k\ne0\end{array}\right.\tag2$$

In the derivations below, we use the values of $$ζ(2)\zeta(2)$$ and $$ζ(4)\zeta(4)$$ computed at the end of this answer.

Start to evaluate one sum, then get another:
∞∑j=1∞∑k=11(k+j)2kj=∞∑j=1∞∑k=1(1kj−1k(k+j))(1kj−1j(k+j))=∞∑j=1∞∑k=11k21j2−2∞∑j=1∞∑k=11k2(k+j)j+∞∑j=1∞∑k=11(k+j)2kj∞∑j=1∞∑k=11k2(k+j)j=12ζ(2)2=π472 \begin{align} \color{#C00}{\sum_{j=1}^\infty\sum_{k=1}^\infty\frac1{(k+j)^2kj}} &=\sum_{j=1}^\infty\sum_{k=1}^\infty\left(\frac1{kj}-\frac1{k(k+j)}\right)\left(\frac1{kj}-\frac1{j(k+j)}\right)\tag{3a}\\[3pt] &=\color{#00F}{\sum_{j=1}^\infty\sum_{k=1}^\infty\frac1{k^2}\frac1{j^2}}-2\color{#090}{\sum_{j=1}^\infty\sum_{k=1}^\infty\frac1{k^2(k+j)j}}+\color{#C00}{\sum_{j=1}^\infty\sum_{k=1}^\infty\frac1{(k+j)^2kj}}\tag{3b}\\ \color{#090}{\sum_{j=1}^\infty\sum_{k=1}^\infty\frac1{k^2(k+j)j}} &=\frac12\color{#00F}{\zeta(2)^2}\tag{3c}\\[3pt] &=\frac{\pi^4}{72}\tag{3d} \end{align}
Explanation:
$$(3a)\text{(3a)}$$: $$1kj−1k(k+j)=1j(j+k)\frac1{kj}-\frac1{k(k+j)}=\frac1{j(j+k)}$$ and $$1kj−1j(k+j)=1k(j+k)\frac1{kj}-\frac1{j(k+j)}=\frac1{k(j+k)}$$
$$(3b)\text{(3b)}$$: expand the products and separate the sums
$$(3b):\phantom{\text{(3b):}}$$ note that $$∞∑j=1∞∑k=11k2(k+j)j=∞∑j=1∞∑k=11k(k+j)j2\sum\limits_{j=1}^\infty\sum\limits_{k=1}^\infty\frac1{k^2(k+j)j}=\sum\limits_{j=1}^\infty\sum\limits_{k=1}^\infty\frac1{k(k+j)j^2}$$
$$(3c)\text{(3c)}$$: cancel the red sums, move the green sum to the left side, and divide by $$22$$
$$(3d)\text{(3d)}$$: simplify

Evaluate the sum we started before (using the other sum we got before):
∞∑j=1∞∑k=11(k+j)2kj=∞∑j=1∞∑k=j+11k2(k−j)j=∞∑k=1k−1∑j=11k2(k−j)j=∞∑k=1k−1∑j=11k3(1k−j+1j)=2∞∑k=1(Hkk3−1k4)=2∞∑k=1∞∑j=11k3(1j−1j+k)−2ζ(4)=2∞∑k=1∞∑j=11k2(k+j)j−2ζ(4)=π436−π445=π4180 \begin{align} \sum_{j=1}^\infty\sum_{k=1}^\infty\frac1{(k+j)^2kj} &=\sum_{j=1}^\infty\sum_{k=j+1}^\infty\frac1{k^2(k-j)j}\tag{4a}\\ &=\sum_{k=1}^\infty\sum_{j=1}^{k-1}\frac1{k^2(k-j)j}\tag{4b}\\ &=\sum_{k=1}^\infty\sum_{j=1}^{k-1}\frac1{k^3}\left(\frac1{k-j}+\frac1j\right)\tag{4c}\\ &=2\sum_{k=1}^\infty\left(\frac{H_k}{k^3}-\frac1{k^4}\right)\tag{4d}\\ &=2\sum_{k=1}^\infty\sum_{j=1}^\infty\frac1{k^3}\left(\frac1j-\frac1{j+k}\right)-2\zeta(4)\tag{4e}\\ &=2\sum_{k=1}^\infty\sum_{j=1}^\infty\frac1{k^2(k+j)j}-2\zeta(4)\tag{4f}\\ &=\frac{\pi^4}{36}-\frac{\pi^4}{45}\tag{4g}\\[6pt] &=\frac{\pi^4}{180}\tag{4h} \end{align}
Explanation:
$$(4a)\text{(4a)}$$: substitute $$k↦k−jk\mapsto k-j$$
$$(4b)\text{(4b)}$$: swap order of summation
$$(4b):\phantom{\text{(4b):}}$$ (we include $$k=1k=1$$ since the inner sum is then $$00$$)
$$(4c)\text{(4c)}$$: partial fractions
$$(4d)\text{(4d)}$$: $$k−1∑j=11k−j=k−1∑j=11j=Hk−1k\sum\limits_{j=1}^{k-1}\frac1{k-j}=\sum\limits_{j=1}^{k-1}\frac1j=H_k-\frac1k$$
$$(4e)\text{(4e)}$$: $$Hk=∞∑j=1(1j−1j+k)H_k=\sum\limits_{j=1}^\infty\left(\frac1j-\frac1{j+k}\right)$$
$$(4f)\text{(4f)}$$: simplify the summand
$$(4g)\text{(4g)}$$: apply $$(3)(3)$$
$$(4h)\text{(4h)}$$: simplify

Putting The Preliminaries To Work
∫2π0x2log(2sin(x2))2dx=∫2π0x2∞∑j=1∞∑k=1cos(kx)kcos(jx)jdx=∫2π0x2∞∑j=1∞∑k=1cos((k+j)x)+cos((k−j)x)2kjdx=2π∞∑j=1∞∑k=11(k+j)2kj+4π∞∑j=1∞∑k=j+11(k−j)2kj+4π33∞∑k=11k2=2π∞∑j=1∞∑k=11(k+j)2kj+4π∞∑j=1∞∑k=11k2(k+j)j+4π33ζ(2)=π590+π518+2π59=13π545 \begin{align} &\int_0^{2\pi}x^2\log\!\left(2\sin\left(\frac{x}2\right)\right)^2\,\mathrm{d}x\\ &=\int_0^{2\pi}x^2\sum_{j=1}^\infty\sum_{k=1}^\infty\frac{\cos(kx)}{k}\frac{\cos(jx)}{j}\,\mathrm{d}x\tag{5a}\\ &=\int_0^{2\pi}x^2\sum_{j=1}^\infty\sum_{k=1}^\infty\frac{\color{#C00}{\cos((k+j)x)}+\color{#090}{\cos((k-j)x)}}{2kj}\,\mathrm{d}x\tag{5b}\\ &=\color{#C00}{2\pi\sum_{j=1}^\infty\sum_{k=1}^\infty\frac1{(k+j)^2kj}}+\color{#090}{4\pi\sum_{j=1}^\infty\sum_{k=j+1}^\infty\frac1{(k-j)^2kj}+\frac{4\pi^3}3\sum_{k=1}^\infty\frac1{k^2}}\tag{5c}\\ &=2\pi\sum_{j=1}^\infty\sum_{k=1}^\infty\frac1{(k+j)^2kj}+4\pi\sum_{j=1}^\infty\sum_{k=1}^\infty\frac1{k^2(k+j)j}+\frac{4\pi^3}3\zeta(2)\tag{5d}\\ &=\frac{\pi^5}{90}+\frac{\pi^5}{18}+\frac{2\pi^5}9\tag{5e}\\[6pt] &=\frac{13\pi^5}{45}\tag{5f} \end{align}
Explanation:
$$(5a)\text{(5a)}$$: apply $$(1)(1)$$
$$(5b)\text{(5b)}$$: $$cos(a)cos(b)=cos(a+b)+cos(a−b)2\cos(a)\cos(b)=\frac{\cos(a+b)+\cos(a-b)}2$$
$$(5c)\text{(5c)}$$: apply $$(2)(2)$$
$$(5d)\text{(5d)}$$: substitute $$k↦k+jk\mapsto k+j$$ in the middle sum
$$(5e)\text{(5e)}$$: apply $$(3)(3)$$ and $$(4)(4)$$
$$(5f)\text{(5f)}$$: simplify