Tough definite integral: $\int_0^\frac{\pi}{2}x\ln^2(\sin x)~dx$

Exploiting the Fourier series of $\ln(2\sin x)$ available for $x\in(0,\pi/2)$: $$\ln(2\sin x)=-\sum_{n=1}^\infty\frac{\cos2nx}n$$ The original integral equals $$I=-\sum_{n=1}^\infty\frac1{n}\int_0^{\pi/2}x\ln\sin x\cos(2nx)dx-\ln2\int_0^{\pi/2}x\ln\sin xdx$$ The second part equals $$\frac7{16}\zeta(3)\ln2-\frac18\pi^2\ln^22$$ which can be found in another MSE post.
To evaluate the integral in the first part, integrating by parts give $$\int_0^{\pi/2}\cot x\left(\frac{\cos2nx-1}{4n^2}+\frac{x\sin2nx}{2n}\right)dx\\ =\frac{I_1(n)}{4n^2}+\frac{I_2(n)}{2n}$$ It's obvious that $I_1(0)=0$, $$I_1(n)-I_1(n-1)=\int_0^{\pi/2}-2\cot x\sin x\sin(2n-1)xdx\\ =\left\{\begin{array}\ -\frac1n&n\text{ odd}\\-\frac1{n-1}&n\text{ even}\end{array}\right.$$ Hence, $$I_1(n)=\left\{\begin{array}\ H_{(n-1)/2}-2H_{n-1}-\frac1n&n\text{ odd}\\H_{n/2}-2H_n&n\text{ even}\end{array}\right.$$ By similar techniques, $$I_2(n)-I_2(n-1)=-2\int_0^{\pi/2}x\cos x\cos(2n-1)xdx\\ =\left\{\begin{array}\ \frac{\pi^2}8-\frac12&n=1\\-\frac1{2n^2}&n\text{ odd, $\ge3$}\\-\frac{1}{2(n-1)^2}&n\text{ even}\end{array}\right.$$ Note $I_2(1)=\frac{\pi^2}8-\frac12$, $$I_2(n)=\frac{\pi^2}8+\left\{\begin{array}\ \frac14H_{(n-1)/2}^{(2)}-H_{n-1}^{(2)}-\frac1{2n^2}&n\text{ odd}\\\frac14H_{n/2}^{(2)}-H^{(2)}_n&n\text{ even}\end{array}\right.$$ Now, $$I=-\sum_{n=1}^\infty\frac1{4(2n)^3}(H_n-2H_{2n})-\sum_{n=0}^\infty\frac{1}{4(2n+1)^3}(H_n-2H_{2n}-\frac1{2n+1})-\sum_{n=1}^\infty\frac1{2(2n)^2}(\frac14H_n^{(2)}-H_{2n}^{(2)})-\sum_{n=0}^\infty\frac1{2(2n+1)^2}(\frac14H_n^{(2)}-H_{2n}^{(2)}-\frac1{2(2n+1)^2})=:-S_1-S_2-S_3-S_4$$ Next, we use some results of Euler sum. Ref for $S_1$ $$S_1=\frac{\pi^4}{2304}-\frac12\left(\operatorname{Li_4}\left(\frac12\right)-\frac34\zeta(4)+\frac78\ln2\zeta(3)-\frac14\ln^22\zeta(2)+\frac{1}{24}\ln^42\right)$$ $$S_2=\frac{\pi ^4}{768}-\frac{7}{16} \zeta (3) \ln2-\frac12\sum_{n=0}^\infty\frac{H_{2n}}{(2n+1)^3}$$ Ref for $S_3$, $S_4$, $A$ denotes the green integral in the linked question. $$S_3=\frac{37}{11520}\pi^4-\frac 18\left(\frac{37}{1440}\pi^4+\frac{121 \pi^4}{1440} + \frac{1}{3} \pi^2 \ln^22 - \frac{1}{3}\ln^42 - 7 \ln2 \zeta(3)- 8 \mathrm{Li}_4\left(\frac{1}{2}\right)\right)$$ $$S_4=\frac{\pi^4}{192}-\frac 18\left(\frac{121 \pi^4}{1440} + \frac{1}{3} \pi^2 \ln^22 - \frac{1}{3}\ln^42 - 7 \ln2 \zeta(3)- 8 \mathrm{Li}_4\left(\frac{1}{2}\right)\right)-\frac12\sum_{n=1}^\infty\frac{H_{2n}^{(2)}}{(2n+1)^2}$$ First calculate the first series, $$\sum_{n=0}^\infty\frac{H_{2n}}{(2n+1)^3}\\ =\int_0^1\sum_{n=0}^\infty \frac12H_{2n}x^{2n}\ln^2x\\ =\int_0^1\frac{\ln^2x}4\left(\frac{\ln(1-x)}{1-x}+\frac{\ln(1+x)}{1+x}\right)dx$$ whose integrand has a polylog-based antiderivative. Using CAS, I found it equals $$ \text{Li}_4\left(\frac{1}{2}\right)+\frac{7}{8} \zeta (3) \ln2-\frac{17 \pi ^4}{1440}+\frac{\ln^42}{24}-\frac{1}{24} \pi ^2 \ln^22$$ Finally, through the same method, $$\sum_{n=1}^\infty\frac{H_{2n}^{(2)}}{(2n+1)^2}\\ =\int_0^1-\frac{\text{Li}_2(x) \ln x}{2 (1-x)}-\frac{\text{Li}_2(-x) \ln x}{2 (1+x)}dx$$ The first one equals $\frac{\pi^4}{240}$. Also, note that the integrand have closed-form antiderivative, we may integrate it from $-1$ to $0$ and take the real part. With help of CAS I got $$\int_0^1-\frac{\text{Li}_2(-x) \ln x}{2 (1+x)}dx\\=2 \text{Li}_4\left(\frac{1}{2}\right)+\frac{7}{4} \zeta (3) \ln2-\frac{13 \pi ^4}{576}+\frac{\ln^42}{12}-\frac{1}{12} \pi ^2 \ln^22$$ And we got the result $$\tiny\frac{1}{4} \left(8 \text{Li}_4\left(\frac{1}{2}\right)+7 \zeta (3) \log (2)-\frac{121 \pi ^4}{1440}+\frac{\log ^4(2)}{3}-\frac{1}{3} \pi ^2 \log ^2(2)\right)+\frac{1}{4} \left(2 \text{Li}_4\left(\frac{1}{2}\right)+\frac{7}{4} \zeta (3) \log (2)-\frac{17 \pi ^4}{720}+\frac{\log ^4(2)}{12}-\frac{1}{12} \pi ^2 \log ^2(2)\right)+\frac{1}{2} \left(-2 \text{Li}_4\left(\frac{1}{2}\right)-\frac{7}{4} \zeta (3) \log (2)+\frac{53 \pi ^4}{2880}-\frac{1}{12} \log ^4(2)+\frac{1}{12} \pi ^2 \log ^2(2)\right)+\frac{1}{2} \left(-\text{Li}_4\left(\frac{1}{2}\right)-\frac{7}{8} \zeta (3) \log (2)+\frac{\pi ^4}{120}-\frac{1}{24} \log ^4(2)+\frac{1}{24} \pi ^2 \log ^2(2)\right)-\frac{7}{8} \zeta (3) \log (2)+\frac{\pi ^4}{144}+\frac{1}{8} \pi ^2 \log ^2(2)$$ $$=\text{Li}_4\left(\frac{1}{2}\right)-\frac{19 \pi ^4}{2880}+\frac{\log ^4(2)}{24}+\frac{1}{12} \pi ^2 \log ^2(2)$$


Solution by real methods:

From here we have

$$\frac23\arcsin^4x=\sum_{n=1}^\infty\frac{H_{n-1}^{(2)}(2x)^{2n}}{n^2{2n\choose n}}=\sum_{n=1}^\infty\frac{H_{n}^{(2)}(2x)^{2n}}{n^2{2n\choose n}}-\sum_{n=1}^\infty\frac{(2x)^{2n}}{n^4{2n\choose n}}$$

Set $x=1$ we get

$$\sum_{n=1}^\infty\frac{4^n}{n^4{2n\choose n}}=\sum_{n=1}^\infty\frac{4^nH_{n}^{(2)}}{n^2{2n\choose n}}-\frac{15}{4}\zeta(4)\tag1$$

In this question we showed $$\sum_{n=1}^\infty\frac{4^nH_n}{n^3{2n\choose n}}=-\sum_{n=1}^\infty\frac{4^nH_n^{(2)}}{n^2{2n\choose n}}+12\ln^2(2)\zeta(2)\tag2$$

Adding $(1)$ and $(2)$ yields

$$\sum_{n=1}^\infty\frac{4^n}{n^4{2n\choose n}}=12\ln^2(2)\zeta(2)-\frac{15}{4}\zeta(4)-\sum_{n=1}^\infty\frac{4^nH_n}{n^3{2n\choose n}}$$

By using the Fourier series of $\tan x\ln(\sin x)$, we showed in this solution:

$$\sum_{n=1}^\infty\frac{4^nH_n}{n^3{2n\choose n}}=-8\text{Li}_4\left(\frac12\right)+\zeta(4)+8\ln^2(2)\zeta(2)-\frac{1}{3}\ln^4(2)$$

substitute this result we get

$$\sum_{n=1}^\infty\frac{4^n}{n^4{2n\choose n}}=8\text{Li}_4\left(\frac12\right)-\frac{19}{4}\zeta(4)+4\ln^2(2)\zeta(2)+\frac{1}{3}\ln^4(2)\tag3$$

Now we use the well-known series expansion of $\arcsin^2 x$:

$$\arcsin^2(x)=\frac12\sum_{n=1}^\infty\frac{4^n x^{2n}}{n^2{2n\choose n}}$$

Multiply both sides by $-\frac{\ln x}{x}$ then $\int_0^1$ and use that $-\int_0^1 x^{2n-1}\ln xdx=\frac{1}{4n^2}$ we get

$$\frac18\sum_{n=1}^\infty\frac{4^n}{n^4{2n\choose n}}=-\int_0^1\frac{\ln x\arcsin^2(x)}{x}dx$$

$$\overset{IBP}{=}\int_0^1\frac{\ln^2x\arcsin(x)}{\sqrt{1-x^2}}dx\overset{x=\sin\theta}{=}\int_0^{\pi/2}x\ln^2(\sin x)dx\tag4$$

From $(3)$ and $(4)$ we obtain

$$\int_0^{\pi/2} x\ln^2(\sin x)dx=\frac{1}{2}\ln^2(2)\zeta(2)-\frac{19}{32}\zeta(4)+\frac{1}{24}\ln^4(2)+\operatorname{Li}_4\left(\frac{1}{2}\right)$$


Not a closed form, but still might be a useful result:

$$\int_0^\frac{\pi}{2}x\ln^2(\sin x)\ dx= \frac{1}{8} \frac{d^2}{db^2} B \left(b,\frac{1}{2} \right) ~{_3F_2} \left(\frac{1}{2},\frac{1}{2},b;\frac{3}{2},b+\frac{1}{2};1 \right) \bigg|_{b=1}$$

Not sure how to get the closed form user178256 provided in their comment, but still the method I used is general enough to be worth posting here.

Making a substitution $t=\sin x$, we obtain:

$$\int_0^1 \arcsin t \ln^2 t \frac{dt}{\sqrt{1-t^2}}=\int_0^1 \int_0^1 \frac{t \ln^2 t ~dt~dy}{\sqrt{1-t^2}\sqrt{1-y^2t^2}}=$$

$$=\frac{1}{8} \int_0^1 \int_0^1 \ln^2 u~ (1-u)^{-1/2} (1-y^2 u)^{-1/2} ~du ~dy$$

Consider another integral:

$$I(b)=\int_0^1 \int_0^1 u^{b-1}~ (1-u)^{-1/2} (1-y^2 u)^{-1/2} ~du~dy$$

Quite clearly from Euler integral for the hypergeometric function:

$$I(b)=B \left(b,\frac{1}{2} \right) \int_0^1 {_2F_1} \left(\frac{1}{2},b;b+\frac{1}{2};y^2 \right) dy$$

Using another Euler integral for generalized hypergeometric functions, we integrate w.r.t. $y$ to obtain:

$$I(b)=B \left(b,\frac{1}{2} \right) {_3F_2} \left(\frac{1}{2},\frac{1}{2},b;\frac{3}{2},b+\frac{1}{2};1 \right)$$

Which immediately gives us the listed result by differentiating under the integral twice.


From numerical standpoint, this result may be useful, as $I(b)$ is a very nice looking function around $b=1$:

enter image description here

We can approximate it by polynomials for example, and find the second derivative with good accuracy.


Also worth noting some special values:

$$I \left( \frac{1}{2} \right)=4G$$

$$I \left( \frac{3}{2} \right)=2$$

$$I \left( 1 \right)=\frac{\pi^2}{4}$$

Where $G$ is Catalan's constant.


Here is an elementary approach. Denote $ K= \int_0^\infty \frac{\ln t\ln(1+t^2) \tan^{-1}t}{1+t^2}dt $

\begin{align} I= &\int_0^\frac{\pi}{2}x\ln^2(\sin x)\ dx \overset{t=\tan x}= \frac14 \int_0^\infty \frac{\tan^{-1}t \ln^2\frac{t^2}{1+t^2}}{1+t^2}dt\\ =& \int_0^\infty \frac{\tan^{-1}t\ln^2t}{1+t^2}\overset{t\to 1/t}{dt} +\frac14 \int_0^\infty \frac{\tan^{-1}t\ln^2(1+t^2)}{1+t^2}\overset{t\to 1/t}{dt} -K\\ =& \frac\pi8 \int_0^\infty \frac{\ln^2t}{1+t^2}dt + \frac\pi{16}\int_0^\infty \frac{\ln^2(1+t^2)}{1+t^2}dt -I -K\\ =& \frac\pi8 \cdot\frac{\pi^3}8 +\frac\pi{16}\left(\frac{\pi^3}6+2\pi\ln^22\right) -I-K =\frac{5\pi^4}{192}+\frac{\pi^2}8\ln^22-\frac12K\tag1 \end{align} Note that, with the substitution $x=\frac{(1+t^2)y}{1-y}$ \begin{align} \int_0^1 \frac{2t\ln\frac{1-y}y}{1+t^2y^2}dy = \int_0^\infty \frac{2t\ln\frac{1+t^2}x}{(1+x)^2+t^2}dx=\ln(1+t^2)\tan^{-1}t \end{align} Then, integrate $K$ as follows \begin{align} K=& \int_0^\infty \frac{\ln t}{1+t^2}\int_0^1 \frac{2t\ln\frac{1-y}y}{1+t^2y^2}dy \>\overset{t^2\to t}{dt}\\ = &\frac12 \int_0^1 \ln\frac{1-y}y\int_0^\infty \frac{\ln t}{(1+t)(1+y^2t)}dt\>dy =\int_0^1 \ln\frac{1-y}y \frac{\ln^2y}{1-y^2}dy\\ =&\frac{\pi^4}{16}+\frac12\int_0^1\frac{\ln^2y\ln(1-y)}{1-y}dy + \frac12\int_0^1\frac{\ln^2y\ln(1-y)}{1+y}dy \end{align} The pair of integrals above are known and given below \begin{align} &\int_0^1\frac{\ln^2y\ln(1-y)}{1-y}dy= -\frac{\pi^4}{180}\\ &\int_0^1\frac{\ln^2y\ln(1-y)}{1+y}dy= -4Li_4\left(\frac12\right) +\frac{\pi^4}{90}+\frac{\pi^2}6\ln^22-\frac16\ln^42\\ \end{align} Plug them into $K$ and then into (1) to obtain $$\int_0^\frac{\pi}{2}x\ln^2(\sin x)\ dx = Li_4\left(\frac12\right)-\frac{19\pi^4}{2880}+\frac{\pi^2}{12}\ln^22-\frac1{24}\ln^42 $$