Prove that $\int_0^{\pi/2}\ln^2(\cos x)\,dx=\frac{\pi}{2}\ln^2 2+\frac{\pi^3}{24}$

Prove that \begin{equation} \int_0^{\pi/2}\ln^2(\cos x)\,dx=\frac{\pi}{2}\ln^2 2+\frac{\pi^3}{24} \end{equation}


I tried to use by parts method and ended with \begin{equation} \int \ln^2(\cos x)\,dx=x\ln^2(\cos x)+2\int x\ln(\cos x)\tan x\,dx \end{equation} The latter integral seems hard to evaluate. Could anyone here please help me to prove it preferably with elementary ways (high school methods)? Any help would be greatly appreciated. Thank you.

Addendum:

I also found this nice closed-form \begin{equation} -\int_0^{\pi/2}\ln^3(\cos x)\,dx=\frac{\pi}{2}\ln^3 2+\frac{\pi^3}{8}\ln 2 +\frac{3\pi}{4}\zeta(3) \end{equation} I hope someone here also help me to prove it. (>‿◠)✌


Solution 1:

Let's get all powers of $\ln(\cos(x))$ at once, using an exponential generating function:

$$ G(z) = \int_0^{\pi/2} \sum_{j=0}^\infty \dfrac{\ln^j(\cos(x)) z^j}{j!}\; dx = \int_0^{\pi/2} \exp(z \ln(\cos(x)))\; dx$$

Change variables: $\cos(x) = t^{1/2}$, and using the Beta function:

$$\eqalign{\dfrac{1}{2} &\int_0^1 \dfrac{t^{(z-1)/2}}{\sqrt{1-t}}\; dt = \dfrac{1}{2} B\left(\dfrac{1}{2}, \dfrac{z+1}{2}\right) = \dfrac{\Gamma(1/2)\Gamma((z+1)/2)}{2\; \Gamma(1+z/2)}\cr &= {\frac {\pi }{2}}-{\frac {\pi \,\ln \left( 2 \right) }{2}}z+ \left( {\frac {{\pi }^{3}}{48}}+{\frac {\pi \, \left( \ln \left( 2 \right) \right) ^{2}}{4}} \right) {z}^{2}-{\frac {\pi \, \left( 4\, \left( \ln \left( 2 \right) \right) ^{3}+{\pi }^{2}\ln \left( 2 \right) +6 \,\zeta \left( 3 \right) \right) }{48}}{z}^{3}+\ldots } $$

Solution 2:

Have a look at this other question. We have that $\log(2\cos x)$ has a nice Fourier series:

$$ \log(2\cos x) = \sum_{n=1}^{+\infty}\frac{(-1)^{n+1}}{n}\cos(2n x)\tag{1}$$ and since: $$ \int_{0}^{\pi/2}\cos(2nx)\cos(2mx)\,dx = \frac{\pi}{4}\delta_{m,n}\tag{2}$$ it follows that: $$ \int_{0}^{\pi/2}\log^2(2\cos x)\,dx = \frac{\pi}{4}\sum_{n=1}^{+\infty}\frac{1}{n^2}=\frac{\pi}{4}\zeta(2) = \frac{\pi^3}{24},\tag{3}$$ while $$\int_{0}^{\pi/2}\log(\cos x)\,dx = -\frac{\pi}{2}\log 2\tag{4}$$ is a well-known result. $(3)$ and $(4)$ proves your claim: $$\int_0^{\pi/2}\ln^2(\cos x)\,dx=\frac{\pi}{2}\ln^2 2+\frac{\pi^3}{24}.$$


Since $$\log(2\sin x)=-\sum_{n=1}^{+\infty}\frac{\cos(2nx)}{n}\tag{5}$$ and $$\int_{0}^{\pi/2}\cos(2n_1 x)\cos(2n_2 x)\cos(2n_3 x)\,dx = \frac{\pi}{8}\delta_{2\cdot\max n_i=(n_1+n_2+n_3)}\tag{6}$$ it follows that $$\int_{0}^{\pi/2}\log^3(2\sin x)\,dx = -\frac{3\pi}{4}\sum_{n=1}^{+\infty}\frac{H_{n-1}}{n^2}=-\frac{3\pi}{4}\zeta(3),\tag{7}$$ from which it is easy to prove your second claim, too.

Solution 3:

I think I get an idea from Prof. Robert Israel's answer. Let $\cos x=\sqrt{t}$ and $dx=\dfrac{dt}{2\sqrt{t}\sqrt{1-t}}$, then \begin{align} \int_0^{\pi/2}\ln^2(\cos x)\,dx&=\frac{1}{8}\int_0^1\dfrac{\ln^2t}{\sqrt{t}\sqrt{1-t}}dt\\ &=\frac{1}{8}\lim_{x\to\frac{1}{2}}\lim_{y\to\frac{1}{2}}\frac{\partial^2}{\partial x^2}\int_0^1 t^{x-1}(1-t)^{y-1}dt\\ &=\frac{1}{8}\lim_{x\to\frac{1}{2}}\lim_{y\to\frac{1}{2}}\operatorname{B}(x,y)\left[(\Psi(x)-\Psi(x+y))^2+\Psi_1(x)-\Psi_1(x+y)\right] \end{align} where $\operatorname{B}(x,y)$ is beta function and $\Psi_k(z)$ is polygamma function. The same approach also works for $$ \int_0^{\pi/2}\ln^3(\cos x)\,dx $$ but for this one, we use third derivative of beta function.

Solution 4:

We are all familiar with the famous Wallis integrals, $W_n=\displaystyle\int_0^\frac\pi2\sin^{n-1}x~dx=\int_0^\frac\pi2\cos^{n-1}x~dx$

$=\dfrac12B\bigg(\dfrac12,~\dfrac n2\bigg)$, see beta function for more details. It follows then that our integral is nothing

other than $W''(1)$, which can be evaluated in terms of the digamma and trigamma functions, for

arguments $\dfrac12$ and $1$. The former can be expressed as $\psi_{_0}(k+1)=H_k-\gamma$, where $\gamma\approx\dfrac1{\sqrt3}~$ is the

Euler-Mascheroni constant, and $H_k=\displaystyle\int_0^1\frac{1-x^k}{1-x~~}dx=-\int_0^1\ln\Big(1-\sqrt[^k]x\Big)~dx$ is the harmonic

number. Thus, that $H_1=1$ is self-evident, and that $H_\frac12=2~(1-\ln2)$ can be shown by a simple

substitution. The values are also found here. For the latter we have $~\psi_{_1}(x)=\displaystyle\sum_{k=0}^\infty\frac1{(k+x)^2}$, which

implies $\psi_{_1}(1)=\zeta(2)=\dfrac{\pi^2}6$, and $\psi_{_1}\bigg(\dfrac12\bigg)=4\bigg(1-\dfrac14\bigg)\zeta(2)=\dfrac{\pi^2}2$. See Basel problem for more

information.