Integral $\int_{0}^{\frac{\pi}{4}}x\ln(\cos x)dx$ I would like to learn more about this integral:
$$\int_{0}^{\frac{\pi}{4}}x\ln(\cos x)dx=\frac{1}{128}\Big(16\pi \operatorname{C}-21\zeta(3)-4\pi^2\ln(2)\Big)$$
where $\operatorname{C}$ is the Catalan's constant.
I have tried integration by parts , substitution $y=\cos x$, etc. But, it reveals nothing. WA gives the anti-derivative in polylogarithmic functions that I don't know about.
I think it is a hard integral. If you have an elementary method to guide me, it would be nice.
Thanks a lot!
 A: Here is to integrate with elementary methods.
\begin{align}
& \int_{0}^{\frac{\pi}{4}}x\ln(\cos x)dx\\
=&\frac12 \int_0^{\frac\pi4 }x\ln\frac{\sin 2x}2 \overset{2x\to x}{dx }- \frac12\int_0^{\frac\pi4 }x\ln(\tan x) \overset{x\to \frac\pi2-x}{dx }\\
 =& - \frac{\pi^2}{64}\ln2  +\frac18\int_0^{\frac\pi2}x\ln(\sin x)dx-\frac14\int_0^{\frac\pi2}x\ln(\tan x) dx -\frac\pi8 \int_0^{\frac\pi4 }\ln(\tan x)dx\tag1
\end{align}
where $\int_0^{\frac\pi4 }\ln(\tan x)dx=-G$,
\begin{align}
&  \int_0^{\frac\pi2}x\ln(\tan x) dx\\
=&\int_0^\infty \frac{\ln t \tan^{-1}t}{1+t^2}dt
=\int_0^\infty \frac{\ln t}{1+t^2}
\left(\int_0^1 \frac{t}{1+t^2y^2}dy\right)\overset{t^2\to t}{dt}\\
 =& \>\frac14 \int_0^1 \int_0^\infty \frac{\ln t}{(1+t)(1+y^2t)}{dt}\>dy\>\>\>\>\>({t\to \frac1{y^2t}})\\
 =& \>\frac14 \int_0^1 \int_0^\infty \frac{-\ln y}{(1+t)(1+y^2t)}dt\>dy
 =\>\frac12 \int_0^1 \frac{\ln^2 y}{1-y^2}dy=\frac78\zeta(3)\\
\\
& \int_{0}^{\frac{\pi}{2}}x\ln(\sin x)dx\\
=&\>\frac12 \int_0^{\frac\pi2 }x\ln\frac{\sin 2x}2 \overset{2x\to x}{dx }+\frac12\int_0^{\frac\pi2 }x\ln(\tan x) dx\\
 =&\>\frac18\int_0^{\pi} x\ln(\sin x)\overset{x\to \pi-x}{dx}-\frac{\pi^2}{16}\ln2 +\frac12\cdot\frac7{8}\zeta(3)\\
 =&\>\frac\pi{16}\int_0^{\pi} \ln(\sin x){dx}-\frac{\pi^2}{16}\ln2 +\frac7{16}\zeta(3) = -\frac{\pi^2}{8} \ln2+\frac7{16}\zeta(3)
\end{align}
Substitute into (1) to obtain
$$\int_{0}^{\frac{\pi}{4}}x\ln(\cos x)dx
=  -\frac{\pi^2}{32} \ln2-\frac{21}{128}\zeta(3)+\frac\pi8G
$$
A: By the Fourier series of $\ln (\cos x)$
$$
\ln (\cos x)=-\ln 2+\sum_{k=1}^{\infty} \frac{(-1)^{k+1}}{k} \cos (2 k x),
$$
we have $$
x \ln (\cos x)=-x \ln 2+\sum_{k=1}^{\infty}\frac{(-1)^{k+1}}{k} x \cos (2 k x)
$$
$$
\begin{aligned}
\int_{0}^{\frac{\pi}{4}} x \ln (\cos x) d x&=-\ln 2 \int_{0}^{\frac{\pi}{4}} x d x+\sum_{k=1}^{\infty} \frac{(-1)^{k+1}}{k} \int_{0}^{\frac{\pi}{4}} x \cos (2 k x) d x \\
&=-\frac{\pi^{2} \ln 2}{8}+\sum_{k=1}^{\infty} \frac{(-1)^{k+1}}{k} \int_{0}^{\frac{\pi}{4}} x \cos (2 k x) d x
\end{aligned}
$$
$$
\begin{aligned}
\int_{0}^{\frac{\pi}{4}} x \cos (2 k x) d x &=\frac{1}{2 k} \int_{0}^{\frac{\pi}{4}} x d(\sin (2 k x)) \\
&=\left[\frac{x \sin (2 k x)}{2 k}\right]_{0}^{\frac{\pi}{4}}-\frac{1}{2 k} \int_{0}^{\frac{\pi}{4}} \sin (2 k x) d x \\ \\
&= \frac{\pi}{8 k} \sin \left(\frac{k \pi}{2}\right)+\frac{1}{4 k^{2}}\left(\cos \frac{k \pi}{2}-1\right)
\end{aligned}$$
$$
\begin{aligned}
\int_{0}^{\frac{\pi}{4}} x \ln (\cos x) d x&= -\frac{\pi^{2} \ln 2}{32}+\frac{\pi}{8} \sum_{k=1}^{\infty} \frac{(-1)^{k+1} \sin \left(\frac{k \pi}{2}\right)}{k^{2}}+  \frac{1}{4} \sum_{k=1}^{\infty} \frac{(-1)^{k+1}}{k^{3}}\left(\cos \frac{k \pi}{2}-1\right)\\&=-\frac{\pi^{2} \ln 2}{32}+\frac{\pi G}{8}+\frac{1}{4}S, 
\end{aligned}$$
where $G$ is the Catalan’s Constant.
$$\begin{aligned}S&=2 \sum_{k=1}^{\infty} \frac{(-1)^{k}}{k^{3}}\left(\sin ^{2} \frac{k \pi}{4}\right)\\&
=2\left[-\frac{1}{2} \sum_{k=0}^{\infty} \frac{1}{(2 k+1)^{3}}+\frac{1}{2^{3}} \sum_{k=1}^{\infty} \frac{1}{(2 k+1)^{3}}\right] \\
&=2\left[-\frac{3}{8} \sum_{k=0}^{\infty} \frac{1}{(2 k+1)^{3}}\right] \\
&=-\frac{3}{4}-\frac{7}{8}\zeta(3) \\
&=-\frac{21}{32} \zeta(3) \end{aligned}$$
Now we can conclude that$$
\boxed{\int_{0}^{\frac{\pi}{4}} x \ln (\cos x) d x= -\frac{\pi^{2} \ln 2}{32}+\frac{\pi G}{8}-\frac{21}{128} \zeta(3)} $$
A: Not an answer but some transformations which might be useful. Didn't go beyond double series.
$$\int_{0}^{\frac{\pi}{4}}x\ln(\cos(x))dx= \color{blue}{(\cos x=t)} $$
$$ =\int_{1/\sqrt{2}}^1 \arccos t \ln t \frac{dt}{\sqrt{1-t^2}}=\color{blue}{(1-t^2=u^2)} $$
$$ = \frac12 \int_0^{1/\sqrt{2}} \frac{du}{\sqrt{1-u^2}} \arcsin u \ln (1-u^2)=$$
$$=\frac12 \int_0^{1/\sqrt{2}} \int_0^1 \frac{udv du}{\sqrt{1-u^2}\sqrt{1-u^2 v^2}} \ln (1-u^2)= \color{blue}{(u=\sqrt{w})}$$
$$=\frac14 \int_0^{1/2} \int_0^1 \frac{dv dw}{\sqrt{1-w}\sqrt{1-w v^2}} \ln (1-w)= $$
$$ =-\frac14 \sum_{k=1}^\infty \frac{1}{k} \int_0^1\int_0^{1/2}  \frac{w^k dw dv}{\sqrt{1-w}\sqrt{1-w v^2}}=\color{blue}{(w=\frac{s}{2})} $$
$$=-\frac18 \sum_{k=1}^\infty \frac{1}{k2^k} \int_0^1\int_0^1  \frac{s^k ds dv}{\sqrt{1-s/2}\sqrt{1-s v^2/2}}=$$ 
$$=-\frac18 \sum_{k=1}^\infty \frac{1}{k2^k} \sum_{n=0}^\infty \binom{2n}{n} \frac{1}{8^n} 
 \int_0^1\int_0^1  \frac{s^{k+n} v^{2n}  ds dv}{\sqrt{1-s/2}}=$$
$$=-\frac18 \sum_{k=1}^\infty \frac{1}{k2^k} \sum_{n=0}^\infty \binom{2n}{n} \frac{1}{(2n+1)8^n} \int_0^1  \frac{s^{k+n}  ds }{\sqrt{1-s/2}}=$$
$$=-\frac14 \sum_{k=1}^\infty \frac{1}{k} \sum_{n=0}^\infty \binom{2n}{n} \frac{B_{1/2} \left(\frac12,k+n+1 \right)}{(2n+1)4^n}=$$
$$=- \sum_{k=1}^\infty \frac{4^k}{k} \sum_{n=0}^\infty \binom{2n}{n} \frac{B_{1/2-1/\sqrt{8}} \left(k+n+1,k+n+1 \right)}{2n+1}$$
Where we have incomplete Beta function. Note that in this case incomplete Beta is a polynomial with order $n+k+2$.
A: First, notice that, by the properties of the natural logarithm and its Taylor expansion around $1$,
$$\begin{split}
\ln(\cos x) &= \ln\left(\frac{e^{ix}+e^{-ix}}{2} \right)=\ln\left(\frac {e^{ix}} 2(1+e^{-2ix})  \right) = \ln(1/2) + \ln(e^{ix})+\ln(1+e^{-2ix})\\
&={-}\ln2+ix+ \sum_{n=1}^\infty (-1)^{n+1} \frac{(e^{-2ix})^n}{n},
\end{split}$$
for all $x \in [0,\pi/4]$. Here we have chosen a branch cut for $\ln$ going along the negative real axis. Since the series is regular enough, in order to find an antiderivative of $\ln(\cos x)$ we may integrate term by term: for $k \in \mathbb C$,
$$\begin{split}
\int \ln(\cos x) dx &= -x\ln 2 +\frac{ix^2}{2}+\sum_{n=1}^\infty (-1)^{n+1} \frac 1 n \int e^{-2inx} dx  \\
&= - x \ln2+ \frac{ix^2}{2} + \sum_{n=1}^\infty (-1)^{n+1} \frac{e^{-2inx}}{-2in^2} +k\\
&=-x\ln2+ \frac{ix^2}{2} - \frac i 2 \sum_{n=1}^\infty \frac{(-e^{2ix})^n}{n^2}+k.
\end{split}$$
Now, since the $s$-polylogarithm is defined via the following power series:
$$\operatorname{Li}_s(z) = \sum_{n=1}^\infty \frac {z^n}{n^s}, $$
we recognize the dilogarithm in the formula above. Therefore
$$\int \ln(\cos x) dx = -x\ln 2 + \frac{ix^2}{2} - \frac i 2 \operatorname{Li}_2(-e^{-2ix})+k. $$
The dilogarithm has the following special values, which we'll need:
$$\begin{split}
\operatorname{Li}_2(-1) &= \sum_{n=1}^\infty \frac {(-1)^n}{n^2} = -\eta(2)= -\frac{\pi^2}{12}, \\ 
\operatorname{Li}_2(-e^{-i\pi/2}) &= \sum_{n=1}^\infty \frac{(-1)^ne^{-i \pi n /2}}{n^2} = \sum_{n=1}^\infty (-1)^n\frac {\cos(\pi n /2)} {n^2}  - i\sum_{n=1}^\infty (-1)^n \frac {\sin(\pi n/2)}{n^2} \\
&= \sum_{n=1}^\infty \frac {(-1)^n}{(2n)^2} + i\sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)^2}  \\
&= -\frac 1 4 \eta(2) + i C = - \frac{\pi^2}{48} + iC,
\end{split}$$
where $\eta$ is the Dirichlet eta function. Employing these identities, we are able to calculate
$$\int_0^{\pi/4} \ln(\cos x) dx = \left(\frac 1 2 C - \frac \pi 4 \ln 2 + i \frac{\pi^2}{24}  \right) - \left(i \frac{\pi^2}{24} \right) = \frac 1 2 C - \frac \pi 4 \ln 2. $$
Then you should be able to evaluate your original integral by parts.
A: Too long for a comment  (since you already received several good answers).
If you want to avoid polylogarithms and numerical integration, you could use the series expansion
$$\log[\cos(x)]=\frac 18\sum _{n=1}^{\infty }(-1)^n \frac{  E_{2 n-1}(1)-E_{2 n-1}(0) }{n \,(2 n-1)!} \,(2x)^{2
   n}$$
$$x\log[\cos(x)]=\frac 1{16}\sum _{n=1}^{\infty }(-1)^n \frac{  E_{2 n-1}(1)-E_{2 n-1}(0) }{n \,(2 n-1)!} \,(2x)^{2 n+1}$$
$$\int_0^t x\log[\cos(x)]\,dx=\frac 1{64}\sum _{n=1}^{\infty }(-1)^n \frac{E_{2 n-1}(1)-E_{2 n-1}(0) }{ n (n+1) (2 n-1)!}\,(2t)^{2 n+2}$$ which converges very fast when $t \leq \frac 12$ (which is the case in your problem).
