<s>[INST] Evaluating $\int_{0}^{\frac{\pi}{2}} x^{2} \ln (\cos x) d x$ Latest Edit
As suggested by Mr Claude Leibovici, I go further to investigate the integral in general,
$$I_{m}:=\int_{0}^{\frac{\pi}{2}} x^{m} \ln (\cos x) d x$$
By the Fourier Series of ln(cos x)
,
$ \displaystyle \ln (\cos x)=-\ln 2+\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n} \cos (2 n x) \tag*{(*)} $
Multiplying (*) by $ x^m$ and then Integrating both sides from $0 $ to $\frac{\pi}{2}$ yields
$$\begin{aligned}
I_m&=-\int_{0}^{\frac{\pi}{2}} x^{m} \ln 2 d x+\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n !} \int_{0}^{\frac{\pi}{2}} x^{m} \cos (2 n x) d x\\&= -\frac{\pi^{m+1}\ln 2}{(m+1) 2^{m+1}}+\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n} J(m, n)\end{aligned}
$$
Next we need a reduction formula on $J(m,n)$.
Applying integration by parts twice, we obtain
$$
\begin{aligned}J(m, n)&=\frac{1}{2 n} \int_{0}^{\frac{\pi}{2}} x^{m} d(\sin 2 n x)\\ &= -\frac{m}{2 n} \int_{0}^{\frac{\pi}{2}} x^{m-1} \sin 2 n x d x\\&=\frac{m}{4 n^{2}} \int_{0}^{\frac{\pi}{2}} x^{m-1} d(\cos 2 n x)\\&=\frac{(-1)^{n} \pi^{m-1} m}{2^{m+1} n^{2}} -\frac{m(m-1)}{4 n^{2}} J (m-2, n)\end{aligned}
$$
By the reduction formula of $J(m,n)$, we can find $I_m$ by plugging $J(m,n)$.

By the Fourier Series of ln(cos x)
,
$ \displaystyle \ln (\cos x)=-\ln 2+\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n} \cos (2 n x) \tag*{(*)} $
Multiplying (*) by $ x^2$ and then Integrating both sides from $0 $ to $\frac{\pi}{2}$ yields
$\displaystyle I=-\underbrace{\int_{0}^{\frac{\pi}{2}} x^{2} \ln 2 d x}_{\frac{\pi^{3} \ln 2}{24}}+\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n} \underbrace{ \int_{0}^{\frac{\pi}{2}} x^{2} \cos (2 n x) d x}_{J_n}\tag*{} $
Integrating by parts twice yields
$\displaystyle \begin{aligned}J_{n} &=\frac{1}{2 n} \int_{0}^{\frac{\pi}{2}} x^{2} d(\sin 2 n x) \\&=\frac{1}{2 n}\left[x^{2} \sin 2 n x\right]_{0}^{\frac{\pi}{2}}-\frac{1}{n} \int_{0}^{\frac{\pi}{2}} x \sin 2 n x d x \\&=\frac{1}{2 n^{2}} \int_{0}^{\frac{\pi}{2}} x d(\cos 2 n x) \\&=\left[\frac{1}{2 n^{2}} x \cos 2 n x\right]_{0}^{\frac{\pi}{2}}-\frac{1}{2 n^{2}} \int_{0}^{\frac{\pi}{2}} \cos 2 n x d x \\&=\frac{\pi}{4 n^{2}} \cos n \pi-\frac{1}{2 n^{2}}\left[\frac{\sin 2 n x}{2 n}\right]_{0}^{\frac{\pi}{2}} \\&=\frac{\pi}{4 n^{2}} \cos n \pi\end{aligned}\tag*{} $
We can now conclude that
$\displaystyle \begin{aligned}I &=-\frac{\pi^{3} \ln 2}{24}+\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n} \cdot \frac{\pi}{4 n^{2}} \cos n \pi \\&=-\frac{\pi^{3} \ln 2}{24}+\frac{\pi}{4} \sum_{n=1}^{\infty} \frac{(-1)^{n+1}(-1)^{n}}{n^{3}} \\&=-\frac{\pi^{3} \ln 2}{24}-\frac{\pi}{4} \sum_{n=1}^{\infty} \frac{1}{n^{3}} \\&=\boxed{-\frac{\pi^{3} \ln 2}{24}-\frac{\pi}{4} \zeta(3)}\end{aligned}\tag*{} $
Is there any other method to evaluate $I$?
 [/INST] Disclaimer: not an efficient way, just a doable one.
We may reduce the integral to standard hypergeometric series / Euler sums, since
$$ I = \int_{0}^{\pi/2}\left(\frac{\pi}{2}-x\right)^2\log(\sin x)\,dx=\int_{0}^{1}\left(\frac{\pi}{2}-\arcsin(x)\right)^2\frac{\log(x)}{\sqrt{1-x^2}}\,dx $$
and
$$ \int_{0}^{1}\frac{\log(x)}{\sqrt{1-x^2}}\,dx = -\frac{\pi}{2}\log(2) \tag{WellKnown} $$
$$\int_{0}^{1}\arcsin(x)\frac{\log(x)}{\sqrt{1-x^2}}\,dx=\int_{0}^{\pi/2}x\log(\sin x)\,dx =\frac{7}{16}\zeta(3)-\frac{\pi^2}{8}\log(2)\tag{ByFourierSeries}$$
$$ \arcsin^2(x)=\sum_{n\geq 1}\frac{4^n x^{2n}}{2n^2\binom{2n}{n}} \tag{SquaredArcsin}$$
as shown here. Since
$$ \int_{0}^{1}\frac{x^{2n}\log(x)}{\sqrt{1-x^2}}\,dx = -\frac{\pi}{4^{n+1}}\binom{2n}{n}\left(H_n-H_{n-1/2}\right)$$
by differentiation of a Beta function and $\sum_{n\geq 1}\frac{H_n}{n^2}=2\zeta(3)$ is also well-known, the whole problem boils down to the evaluation of
$$ \sum_{n\geq 1}\frac{H_{n-1/2}}{n^2} $$
which can be performed through standard tricks. The last series equals $-\frac{\pi^2}{3}\log(2)+\frac{7}{2}\zeta(3)$.
</s>