# How to evaluate $I=\int_0^{\pi/2}x^2\ln(\sin x)\ln(\cos x)\ \mathrm dx$

Find the value of $I=\displaystyle\int_0^{\pi/2}x^2\ln(\sin x)\ln(\cos x)\ \mathrm dx$

We have the information that $J=\displaystyle\int_0^{\pi/2}x\ln(\sin x)\ln(\cos x)\ \mathrm dx=\dfrac{(\pi\ln{2})^2}{8}-\dfrac{\pi^4}{192}$

• if you represent ln(cos(x)) as ln(d(sinx)dx)? Mar 14, 2013 at 5:31
• Please refrain from using \displaystyle in the title. Mar 14, 2013 at 5:31
• this one is answer ,but no step is shown from wolframalpha!enter image description here Mar 14, 2013 at 5:37
• Use sympy: from sympy import * x=Symbol('x') integrate(x**2*log(cos(x))*log(sin(x)),(x,0,pi/2)) Mar 14, 2013 at 5:56
• I have changed the formatting of the title so as to make it take up less vertical space -- this is a policy to ensure that the scarce space on the main page is distributed evenly over the questions. See here for more information. Please take this into consideration for future questions. Thanks in advance. Mar 12, 2018 at 16:51

Tools Needed \begin{align} \frac1{k(j-k)^2}&=\frac1{j^2k}-\frac1{j^2(k-j)}+\frac1{j(k-j)^2}\tag{1}\\ \frac1{k(j+k)^2}&=\frac1{j^2k}-\frac1{j^2(k+j)}-\frac1{j(k+j)^2}\tag{2}\\ \log(\sin(x))&=-\log(2)-\sum_{k=1}^\infty\frac{\cos(2kx)}{k}\tag{3}\\ \log(\cos(x))&=-\log(2)-\sum_{k=1}^\infty(-1)^k\frac{\cos(2kx)}{k}\tag{4}\\ \cos(2jx)\cos(2kx)&=\frac12\Big[\cos(2(j-k)x)+\cos(2(j+k)x)\Big]\tag{5}\\ \end{align} $$\int_0^{\pi/2}x^2\cos(2kx)\,\mathrm{d}x=\left\{ \begin{array}{} (-1)^k\frac\pi{4k^2}&\text{if }k\ne0\\ \frac{\pi^3}{24}&\text{if }k=0 \end{array}\right.\tag{6}\\$$

Tool Use \begin{align} &\int_0^{\pi/2}x^2\log(\sin(x))\log(\cos(x))\,\mathrm{d}x\\[12pt] &=\int_0^{\pi/2}x^2\left(\log(2)+\sum_{k=1}^\infty\frac{\cos(2kx)}{k}\right)\left(\log(2)+\sum_{k=1}^\infty(-1)^k\frac{\cos(2kx)}{k}\right)\,\mathrm{d}x\\[12pt] &=\log(2)^2\int_0^{\pi/2}x^2\,\mathrm{d}x +\log(2)\sum_{k=1}^\infty\frac1k\int_0^{\pi/2}x^2\cos(4kx)\,\mathrm{d}x\\ &+\sum_{j=1}^\infty\sum_{k=1}^\infty\frac{(-1)^k}{2jk}\int_0^{\pi/2}x^2\Big[\cos(2(j-k)x)+\cos(2(j+k)x)\Big]\,\mathrm{d}x\\[12pt] &=\frac{\pi^3}{24}\log(2)^2+\log(2)\frac\pi{16}\zeta(3)\\ &+\frac\pi8\sum_{j=1}^\infty\sum_{k=1}^\infty\frac{(-1)^j}{jk}\left[\mathrm{iif}\left(j=k,\frac{\pi^2}{6},\frac1{(j-k)^2}\right)+\frac1{(j+k)^2}\right]\\[12pt] &=\frac{\pi^3}{24}\log(2)^2+\log(2)\frac\pi{16}\zeta(3)\\ &+\frac\pi8\sum_{j=1}^\infty\frac{(-1)^j}{j}\sum_{k=1}^{j-1}\frac1{k(j-k)^2} +\frac\pi8\sum_{j=1}^\infty\frac{(-1)^j}{j^2}\frac{\pi^2}{6} +\frac\pi8\sum_{j=1}^\infty\frac{(-1)^j}{j}\sum_{k=j+1}^\infty\frac1{k(j-k)^2}\\ &+\frac\pi8\sum_{j=1}^\infty\frac{(-1)^j}{j}\sum_{k=1}^\infty\frac1{k(j+k)^2}\\[12pt] &=\frac{\pi^3}{24}\log(2)^2+\log(2)\frac\pi{16}\zeta(3)\\ &+\frac\pi8\sum_{j=1}^\infty\frac{(-1)^j}{j}\left(\frac2{j^2}H_{j-1}+\frac1jH_{j-1}^{(2)}\right) -\frac{\pi^5}{576} +\frac\pi8\sum_{j=1}^\infty\frac{(-1)^j}{j}\left(-\frac1{j^2}H_j+\frac1j\frac{\pi^2}{6}\right)\\ &+\frac\pi8\sum_{j=1}^\infty\frac{(-1)^j}{j}\left(\frac1{j^2}H_j-\frac1j\frac{\pi^2}{6}+\frac1jH_j^{(2)}\right)\\[12pt] &=\frac{\pi^3}{24}\log(2)^2+\log(2)\frac\pi{16}\zeta(3)\\ &+\frac\pi8\sum_{j=1}^\infty\frac{(-1)^j}{j}\left(\frac2{j^2}H_j+\frac2jH_j^{(2)}-\frac3{j^3}\right) -\frac{\pi^5}{576}\\[12pt] &=\frac{\pi^3}{24}\log(2)^2+\log(2)\frac\pi{16}\zeta(3)+\frac{11\pi^5}{5760} +\frac\pi4\sum(-1)^j\left(\frac1{j^3}H_j+\frac1{j^2}H_j^{(2)}\right)\\[12pt] &=\frac{\pi^3}{24}\log(2)^2+\log(2)\frac\pi{16}\zeta(3)-\frac{\pi^5}{960} -\frac\pi{16}\sum_{j=1}^\infty\frac1{j^3}H_{2j}\tag{7} \end{align} Numerically, $(7)$ matches the integral. I'm working on the last harmonic sum. Both numerical integration and $(7)$ yield $0.0778219793722938643380944$.

Mathematica Help

Thanks to Artes' answer on Mathematica, I have verified that these agree to 100 places.

• @MhenniBenghorbal: to be honest, the last equation in $(7)$ requires a page and a half of computation. I can append those if requested, but I didn't want to unnecessarily clutter the answer.
– robjohn
Mar 15, 2013 at 21:38
• @MhenniBenghorbal: Thanks! Using those functions, $(7)$ is $$\frac{\pi^3}{24}\log(2)^2+\log(2)\frac\pi{16}\zeta(3)+\frac{11\pi^5}{5760} -\frac\pi4(A(1,3)+A(2,2))$$
– robjohn
Mar 15, 2013 at 22:05
• (+1) I also tried this approach, but just gave up because of the required amount of calculation. I purely admire all your efforts toward the conclusion. Mar 16, 2013 at 4:06
• @robjohn: The value of that last Euler Sum is $$-\frac{\pi ^4}{15}-\frac{1}{3} \pi^2 \log^2(2)+\frac{\log^4(2)}{3}+8 \text{Li}_4\left(\frac{1}{2}\right)+7 \log(2)\zeta(3)$$ For it's proof you can refer to this page. Jan 11, 2014 at 8:55
• Can someone please post the full answer, then? I mean, (7) with the sigma replaced by Integrals-and-Series's answer. Aug 24, 2014 at 2:30

I'm still struggling with this integral, but I guess the following result may have a chance to be helpful:

\begin{align*} \int_{0}^{\frac{\pi}{2}} x^2 \log^2 \cos x \, dx &= \frac{11 \pi^5}{1440} + \frac{\pi^3}{24} \log^2 2 + \frac{\pi}{2}\zeta(3) \log 2 \tag{1} \\ &\approx 4.2671523609840988652 \cdots. \end{align*}

To prove this, let us consider the following identity

$$\int_{0}^{\frac{\pi}{2}} \cos^{z}x \cos wx \, dx = \frac{\pi}{2^{z+1}} \binom{z}{\frac{z+w}{2}}.$$

You can find the proof of this identity at here. Thus it follows that

$$\int_{0}^{\frac{\pi}{2}} x^2 \log^2 \cos x \, dx = - \left. \frac{\partial^4}{\partial z^2 \partial w^2} \frac{\pi}{2^{z+1}} \binom{z}{\frac{z+w}{2}} \right|_{(z, w) = (0, 0)}.$$

Performing a bunch of calculations, we obtain $(1)$. Similar idea shows that

$$\int_{0}^{\frac{\pi}{2}} \log^2 \cos x \, dx = \left. \frac{\partial^2}{\partial z^2} \frac{\pi}{2^{z+1}} \binom{z}{\frac{z+w}{2}} \right|_{(z, w) = (0, 0)} = \frac{\pi^3}{24} + \frac{\pi}{2}\log 2. \tag{2}$$

Indeed, starting from the identity

$$\log^2 \left( \frac{\sin 2x}{2} \right) = \log^2 \cos x + \log^2 \sin x + 2\log \cos x \log \sin x,$$

I obtained

\begin{align*}I &= -\frac{7}{8}\int_{0}^{\frac{\pi}{2}} x^2 \log^2 \cos x \, dx + \frac{\pi}{2} \int_{0}^{\frac{\pi}{2}} x \log^2 \cos x \, dx - \frac{3\pi^2}{32} \int_{0}^{\frac{\pi}{2}} \log^2 \cos x \, dx \\ &\quad -\frac{\log 2}{8}\int_{0}^{\pi} x^2 \log \sin x \, dx + \frac{\pi^3}{48} \log^2 2 \\ &\approx 0.077821979372293864338\cdots. \end{align*}

From the identity

$$\log \sin x = -\log 2 - \sum_{n=1}^{\infty} \frac{\cos 2nx}{n},$$

we obtain

$$\int_{0}^{\pi} x^2 \log \sin x \, dx = -\frac{\pi}{2} \zeta (3) - \frac{\pi^3}{3} \log 2. \tag{3}$$

Putting $(1)$, $(2)$ and $(3)$ together, I was able to derive

\begin{align*}I &= -\frac{61 \pi^5}{5760} - \frac{3\pi}{8} \zeta (3) \log 2 -\frac{\pi^3}{48} \log^2 2 + \frac{\pi}{2} \int_{0}^{\frac{\pi}{2}} x \log^2 \cos x \, dx. \end{align*}

I'm not sure if this formula will be helpful, since the last remaining integral seems to defy my techniques.

• I meant to upvote this earlier, but got distracted. I had forgotten about the cosine expansion for $\log(\cos(x))$ and $\log(\sin(x))$ until you used one here.
– robjohn
Mar 16, 2013 at 4:15
• For the last integral you can use the following technique since we have $$\int_0^{\Large\frac\pi2}\cos^{n-1}x\cos ax\ dx=\frac{\pi}{2^n n\ \operatorname{B}\left(\frac{n+a+1}{2},\frac{n-a+1}{2}\right)}$$ Sep 18, 2014 at 13:02

This is yet another partial answer, and a verification of some other claims.

Using $(4)$ and $(8)$ from this answer, we get $$\int_0^{\pi/2}\log(\sin(x))\log(\cos(x))\,\mathrm{d}x=\frac\pi2\log(2)^2-\frac{\pi^3}{48}\tag{1}$$ Here is a way to extend kalpeshmpopat's suggestion about substituting $x\mapsto\frac\pi2-x$. Note that $g(x)=f(\sin(x))f(\cos(x))$ is even as a function of $x-\frac\pi4$; that is, $g(\frac\pi2-x)=g(x)$. Thus, if we multiply by an odd function of $x-\frac\pi4$, the integral over $[0,\frac\pi2]$ will be $0$.

Therefore, $$\int_0^{\pi/2}\left(\frac\pi4-x\right)\log(\sin(x))\log(\cos(x))\,\mathrm{d}x=0\tag{2}$$ Using $(1)$ and $(2)$, we get \begin{align} \int_0^{\pi/2}x\log(\sin(x))\log(\cos(x))\,\mathrm{d}x &=\frac\pi4\int_0^{\pi/2}\log(\sin(x))\log(\cos(x))\,\mathrm{d}x\\ &=\frac\pi4\left(\frac\pi2\log(2)^2-\frac{\pi^3}{48}\right)\\ &=\frac{\pi^2}{8}\log(2)^2-\frac{\pi^4}{192}\tag{3} \end{align} We also have $$\int_0^{\pi/2}\left(\frac\pi4-x\right)^3\log(\sin(x))\log(\cos(x))\,\mathrm{d}x=0\tag{4}$$ Which, along with $(1)$ and $(3)$, implies that \begin{align} \int_0^{\pi/2}x^3\log(\sin(x))\log(\cos(x))\,\mathrm{d}x &=\frac{3\pi}{4}\int_0^{\pi/2}x^2\log(\sin(x))\log(\cos(x))\,\mathrm{d}x\\ &-\frac{3\pi^2}{16}\int_0^{\pi/2}x\log(\sin(x))\log(\cos(x))\,\mathrm{d}x\\ &+\frac{\pi^3}{64}\int_0^{\pi/2}\log(\sin(x))\log(\cos(x))\,\mathrm{d}x\\ &=\frac{3\pi}{4}\int_0^{\pi/2}x^2\log(\sin(x))\log(\cos(x))\,\mathrm{d}x\\ &-\frac{\pi^4}{64}\log(2)^2+\frac{\pi^6}{1536}\tag{5} \end{align} Equation $(5)$ supports math110's claim that if we know $I_2$, we know $I_3$.

• beatifull!,Thank you! Thank you Mar 15, 2013 at 15:41

Related problem: (I), (II). The contribution of this post is to evaluate the integral

$$I = \int_0^{\pi/2}\ln(\sin x)\ln(\cos x)dx$$

symbolically. Now to find $I$, we use the first change of variables $t = \sin(x)$ which results in

$$I = \frac{1}{2}\int_{0}^{1}\frac{\ln(t)\ln(1-t^2)}{\sqrt{1-t^2}}dt.$$

Following it by the change of variables $u=t^2$ gives

$$I = \frac{1}{8}\int_{0}^{1}\frac{ \ln(u) \ln(1-u) }{ \sqrt{u} \sqrt{1-u} } du .$$

To evaluate the last integral, we consider the integral

$$F = \frac{1}{8}\int_{0}^{1}u^{a-\frac{1}{2}} (1-u)^{b-\frac{1}{2}} du = \beta(a+1/2,b+1/2) ,$$

where $\beta(u,v)$ is the beta function.

$$\implies I = D_{b}\,D_{a} \beta(a+1/2,b+1/2)|_{a=0,b=0}= \frac{\pi}{48} \, \left( 24\, \left( \ln \left( 2 \right)\right)^{2} -{\pi }^{2} \right),$$

where $D_a=\frac{\partial }{\partial a}$ and $D_b=\frac{\partial }{\partial b}$.

• Too trivial edit: $dt$ is missing at the end of the second formula. Mar 19, 2013 at 1:51
• @MarkHurd: Thank you. I really appreciate it. Mar 31, 2013 at 12:30
• @MhenniBenghorbal Could you please explain how you used the Beta Function in the last step? I couldn't understand. Jun 4, 2015 at 11:40


First: Some reductions \begin{align} I&=\int_{0}^{\pi/2}x^{2}\, {\bracks{\ln\pars{\sin\pars{x}} + \ln\pars{\cos\pars{x}}}^{2} -\ln^{2}\pars{\sin\pars{x}} -\ln^{2}\pars{\cos\pars{x}} \over 2}\,\dd x \\[3mm]&=\half\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\sin\pars{x}\cos\pars{x}}\,\dd x -\half\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\sin\pars{x}}\,\dd x -\half\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\cos\pars{x}}\,\dd x \\[3mm]&=\half\int_{0}^{\pi/2}x^{2}\bracks{% \ln^{2}\pars{\sin\pars{2x}} - 2\ln\pars{2}\ln\pars{\sin\pars{2x}} + \ln^{2}\pars{2}} \,\dd x\\[3mm]& -\half\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\sin\pars{x}}\,\dd x -\half\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\cos\pars{x}} \,\dd x \\[3mm]&={\pi \over 4}\,\ln^{2}\pars{2} + {1 \over 16}\int_{0}^{\pi}x^{2}\ln^{2}\pars{\sin\pars{x}}\,\dd x - {1 \over 8}\ln\pars{2}\int_{0}^{\pi}x^{2}\ln\pars{\sin\pars{x}}\,\dd x \\[3mm]&-\half\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\sin\pars{x}}\,\dd x -\half\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\cos\pars{x}}\,\dd x \qquad\qquad\qquad\qquad\qquad\qquad\pars{1} \end{align}

Also, with $n = 1,2$: \begin{align} &\int_{0}^{\pi}x^{2}\ln^{n}\pars{\sin\pars{x}}\,\dd x= \int_{-\pi/2}^{\pi/2}\pars{x + {\pi \over 2}}^{2}\ln^{n}\pars{\cos\pars{x}}\,\dd x \\[3mm]&=\int_{0}^{\pi/2} \bracks{\pars{x + {\pi \over 2}}^{2} + \pars{-x + {\pi \over 2}}^{2}} \ln^{n}\pars{\cos\pars{x}}\,\dd x =\int_{0}^{\pi/2} \pars{2x^{2} + {\pi^{2} \over 2}}\ln^{n}\pars{\cos\pars{x}}\,\dd x \\[3mm]&=2\int_{0}^{\pi/2}x^{2}\ln^{n}\pars{\cos\pars{x}}\,\dd x + {\pi^{2} \over 2}\int_{0}^{\pi/2}\ln^{n}\pars{\cos\pars{x}}\,\dd x \end{align}

With this result, $\pars{1}$ is reduced to: \begin{align} I&={\pi \over 4}\,\ln^{2}\pars{2} -{3 \over 8}\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\cos\pars{x}}\,\dd x + {\pi^{2} \over 32}\ \overbrace{\int_{0}^{\pi/2}\ln^{2}\pars{\cos\pars{x}}\,\dd x} ^{\ds{{\pi^{3} \over 24} + {\pi \over 2}\,\ln^{2}\pars{2}}} \\[3mm]&-{1 \over 4}\,\ln\pars{2}\ \overbrace{\int_{0}^{\pi/2}x^{2}\ln\pars{\cos\pars{x}}\,\dd x} ^{\ds{-\,{\pi^{3} \over 24}\,\ln\pars{2} - {1 \over 4}\,\zeta\pars{3}}} -{\pi^{2} \over 16}\,\ln\pars{2}\ \overbrace{\int_{0}^{\pi/2}\ln\pars{\cos\pars{x}}\,\dd x} ^{\ds{-\,{\pi \over 2}\,\ln\pars{2}}} -\half\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\sin\pars{x}}\,\dd x \end{align}

$I$ is reduced to: $$I = C -\half\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\sin\pars{x}}\,\dd x -{3 \over 8}\int_{0}^{\pi/2}x^{2}\ln^{2}\pars{\cos\pars{x}}\,\dd x$$ where $C$ is given by: \begin{align} C &= {\pi \over 4}\,\ln^{2}\pars{2} + {\pi^{5} \over 728} + {\pi^{3} \over 64}\,\ln^{2}\pars{2} + {\pi^{3} \over 96}\,\ln^{2}\pars{2} + {1 \over 16}\,\ln\pars{2}\zeta\pars{3} + {\pi^{3} \over 32}\,\ln^{2}\pars{2} \\[3mm]&= {\pi \over 4}\,\bracks{\ln\pars{2} + {1 \over 4}\,\zeta\pars{3}}\ln\pars{2} + {\pi^{5} \over 728} + {1 \over 16}\,\ln\pars{2}\zeta\pars{3} + {11\pi^{3} \over 192}\,\ln^{2}\pars{2} \end{align} $\tt @sos440$ user had already derived results which are related to the remaining integrals.

• The first term of $C$ should be $\frac{\pi^3}{48}\ln^2(2)$. This little mistake came from integrating $\int_0^{\pi/2} \ln^2(2)dx$ instead of $\int_0^{\pi/2} \ln^2(2)x^2 dx$ Jun 13 at 23:00

Hint: Replace x by π/2- x

then simplify so we will get one term same as I

• When one writes Hint, one is asserting that the step which they indicate does lead to a proof. Yours does not.
– Did
Mar 14, 2013 at 6:59
• Let $$I_k = \int_{0}^{\frac{\pi}{2}} x^k \log \sin x \log \cos x, \, dx$$ for notation convenience. If we follow your hint, the resulting equation, after some cancellations, does not involve $I_2$. Rather, it can be used to find the relationship between $I_0$ and $I_1$. Mar 14, 2013 at 7:00
• This is clearly the crucial step. Mar 14, 2013 at 7:06
• hello,sos440,$I_{2}$ you can find value? Thank you ,I find if $I_{2}$ can evaluate,that we easy to find $I_{3}$ Mar 14, 2013 at 7:36
– Did
Feb 15, 2014 at 21:57

This is not quite a complete answer but goes a good way towards showing that the idea of @kalpeshmpopat is not so far off the mark - if we want to answer the question that was orginally asked.

First, numerical investigation indicates that the correct integral is

$$I=\displaystyle\int_0^{\pi/2}x\ln(\sin x)\ln(\cos x)dx=\dfrac{(\pi\ln{2})^2}{8}-\dfrac{\pi^4}{192}.$$

Now, as @kalpeshmpopat points out, a simple substitution, together with the facts that $\cos(\frac{\pi}{2}-x)=\sin(x)$ and vice-versa, shows that

$$\displaystyle\int_0^{\pi/2}x\ln(\sin x)\ln(\cos x)dx=\int_0^{\pi/2}(\frac{\pi}{2}-x)\ln(\sin x)\ln(\cos x)dx.$$

Thus, if we add these two together we get

$$\displaystyle\int_0^{\pi/2} \frac{\pi}{2} \ln(\sin x)\ln(\cos x)dx=2I.$$

All that remains to show is that

$$\displaystyle\int_0^{\pi/2} \frac{\pi}{2} \ln(\sin x)\ln(\cos x)dx = \frac{1}{96} \pi ^2 \left(6 \log ^2(4)-\pi^2\right),$$

which Mathematica can do. It's getting late, but my guess on this last integral would be to expand $\ln(\cos(x))$ into a power series (which is easy, since we know $\ln(1+y)$) and try to integrate $x^n \ln(\sin(x))$.

• Maybe you have realized this, but OP asks for an integral involving $x^2$, not the one you have worked on. OP also states that he may assume the value of a similar integral involving $x$, in case that helps in finding the answer. The question was always about the $x^2$-integral, but at first OP used the same name $I$ for both integrals, which was confusing. Mar 14, 2013 at 20:45
• @alex.jordan Clearly, the question currently asks for an integral involving $x^2$. However, it was edited by someone other than the OP, so I don't think it's necessarily clear what was asked. It wasn't confusing - it was unclear. Mar 14, 2013 at 20:50
• Hi Mark, do you know that you can see the complete edit history of a problem clicking the link displaying its last editor? Mar 14, 2013 at 20:58
• @alex.jordan Yes. Clearly, the OP is not a native speaker. He easily could have been asking for a verification of an integral whose value was known. Don't get me wrong, I think that Raghib's edit is a perfectly reasonable interpretation. Even so, the more interesting question, it seems to me, is why is the $p=0$ case true? It seems pretty clear given the answers that the substitution $x\rightarrow\pi/2-x$ yields a way to express $I(p)$ in terms of $I(q)$ using all integers $q<p$. Mar 14, 2013 at 21:05
• That substitution yields a way to express $I(p)$ in terms of $I(q)$ over $q<p$ when p is odd. Which is why it is not (immediately) helpful for $p=2$. Mar 14, 2013 at 21:11

I am going to continue @Felix answer above where he found

$$I = C-\frac12\int_0^{\pi/2}x^2\ln^2(\sin x)dx-\frac38\underbrace{\int_0^{\pi/2}x^2\ln^2(\cos x)dx}_{x\to \pi/2-x}$$

$$=C-\frac12\int_0^{\pi/2}x^2\ln^2(\sin x)dx-\frac38\int_0^{\pi/2}(\pi/2-x)^2\ln^2(\sin x)dx$$

$$=C-\int_0^{\pi/2}\left(\frac{7}{8}x^2-\frac{3\pi}{8}x+\frac{3\pi^2}{32}\right)\ln^2(\sin x)dx$$

Using

$$\ln^2(2\sin x)=\left(\frac{\pi}{2}-x\right)^2+2\sum_{n=1}^\infty\frac{H_{n-1}}{n}\cos(2nx),\quad 0

we have

$$\int_0^{\pi/2}\left(\frac{7}{8}x^2-\frac{3\pi}{8}x+\frac{3\pi^2}{32}\right)\ln^2(2\sin x)dx$$ $$=\int_0^{\pi/2}\left(\frac{\pi}{2}-x\right)^2\left(\frac{7}{8}x^2-\frac{3\pi}{8}x+\frac{3\pi^2}{32}\right)dx$$

$$+2\sum_{n=1}^\infty\frac{H_{n-1}}{n}\int_0^{\pi/2} \left(\frac{7}{8}x^2-\frac{3\pi}{8}x+\frac{3\pi^2}{32}\right)\cos(2nx)dx$$

$$=\frac{11\pi^5}{3840}+2\sum_{n=1}^\infty\frac{H_{n-1}}{n}\left(\frac{3\pi}{32 n^2}+\frac{(-1)^n \pi}{8n^2}\right)$$

$$=\frac{11\pi^5}{3840}+\frac{3\pi}{16}\sum_{n=1}^\infty\frac{H_{n-1}}{n^3}+\frac{\pi}{4}\sum_{n=1}^\infty\frac{(-1)^n H_{n-1}}{n^3}$$

$$=\frac{\pi}{2}\text{Li}_4(1/2)-\frac{7\pi^5}{2304}-\frac{\pi^3}{48}\ln^2(2)+\frac{7\pi}{16}\ln(2)\zeta(3)+\frac{\pi}{48}\ln^4(2).$$

What is remaining is to write $$\ln^2(2\sin x)=\ln^2(2)+2\ln(2)\ln(\sin x)+\ln^2(\sin x)$$ where the middle integral can be done using the Fourier series of $$\ln(\sin x)$$:

$$\int_0^{\pi/2}\left(\frac{7}{8}x^2-\frac{3\pi}{8}x+\frac{3\pi^2}{32}\right)\ln(\sin x)dx=-\frac{7\pi^3}{192}\ln(2).$$

Proof of (1): $$\begin{gather*} \sum_{n=1}^\infty(-1)^n\frac{H_{n-1}}{n}\cos(2nx)=\mathfrak{R}\sum_{n=1}^\infty(-1)^n\frac{H_{n-1}}{n}e^{2inx}\\ =\mathfrak{R}\sum_{n=1}^\infty\frac{H_{n-1}}{n}(-e^{2ix})^n\\ \{\text{replace x by -e^{2ix} in the generating function of \sum_{n=1}^\infty H_{n-1} x^n/n}\}\\ =\frac12\mathfrak{R}\ln^2(1+e^{2ix})\\ =\frac12\mathfrak{R}\left[\ln(2\cos x)+ix\right]^2\\ =\frac12\mathfrak{R}\left[\ln^2(2\cos x)+2ix\ln(2\cos x)-x^2\right]\\ =\frac12\ln^2(2\cos x)-\frac{x^2}{2}, \end{gather*}$$

replace $$x$$ by $$\frac{\pi}{2}-x$$ using $$(\cos(2n(\frac{\pi}{2}-x)))=(-1)^n\cos(2nx)$$ for integer $$n$$, we have

$$\ln^2(2\sin x)=\left(\frac{\pi}{2}-x\right)^2+2\sum_{n=1}^\infty\frac{H_{n-1}}{n}\cos(2nx),\quad 0