# Prove $\int\limits_{-\pi}^{\pi}{\log^2{(\cos{\frac{x}{2})}}dx} = 2\pi\log^2{2} + \frac{\pi^3}{6}$

How to prove

$$\int\limits_{-\pi}^{\pi}{\log^2{(\cos{\frac{x}{2})}}dx} = 2\pi\log^2{2} + \frac{\pi^3}{6}$$

I got this result using Fourier representation of $$|\log(\cos(\frac{x}{2}))|$$ and Parseval's identity. But I am wondering if there is a direct way to calculate this integral.

• Confirmed by Mathematica. – David G. Stork Oct 30 '20 at 17:01
• You may find some answers here or here – Paul Enta Oct 30 '20 at 17:46
• @PaulEnta I believe those are rather circular because they use Fourier series. – Parcly Taxel Oct 30 '20 at 18:13
• These answers 1, 2, 3, 4 don't use Fourier series. – Paul Enta Oct 30 '20 at 18:49

With $$t= \frac x2$$

\begin{align} I& = \int\limits_{-\pi}^{\pi}{\log^2{(\cos{\frac{x}{2})}}dx}\\ &= 4\int_0^{\frac\pi2}\ln^2 (\cos t) dt= 2\int_0^{\frac\pi2}(\ln^2 (\cos t)+ \ln^2 (\sin t) )dt \\ &=\int_0^{\frac\pi2}\left( \ln^2 (\sin t\cos t) + \ln^2 \frac{\sin t}{\cos t} \right)dt =J+K\tag1 \end{align} where \begin{align} J &= \int_0^{\frac\pi2}\ln^2 (\sin t\cos t) dt \overset{2t\to t}= \frac12 \int_0^{\pi}\ln^2 (\frac12\sin t)dt= \int_0^{\frac\pi2}\ln^2 (\frac12\sin t)dt\\ &= \int_0^{\frac\pi2}\left( \ln^2 2 -2\ln2 \ln\sin t +\ln^2(\sin t ) \right)dt\\ &= \frac\pi2\ln^22 -2\ln 2(-\frac\pi2\ln2) +\int_0^{\frac\pi2}\ln^2(\sin t )dt = \frac{3\pi}2\ln^22 +\frac14I\\ K&=\int_0^{\frac\pi2} \ln^2 (\frac{\sin t}{\cos t}) dt\overset{u=\tan t}= \int^\infty_0 \frac{\ln^2 u} {1+u^2} du=\frac{\pi^3}8 \end{align} Plug $$J$$ and $$K$$ into (1) to obtain

$$I = 2\pi\ln^22 +\frac{\pi^3}6$$

Let us write $$I=\int_{-\pi}^{\pi} \ln^2(\cos(x/2)) dx=4\int_{0}^{\pi/2} \ln^2 \cos y dy$$ Let $$\cos y=t$$, then $$I=4\int_{0}^{1} \frac{ln^2 t}{\sqrt{1-t^2}} dt =4\int_{0}^{1} \sum_{k=0}^{\infty} \ln^2 t ~ C_k ~(-1)^k~t^{2k} dt, C_k={-1/2,\choose k}$$ Let $$t=e^{-u}$$, then $$I=4\int_{0}^{1}\sum_{k=0}^{\infty} (-1)^k C_k u^2 e^{-(2k+1)u} =8\sum_{k=0}^{\infty} \frac{(-1)^k ~ C_k}{(2k+1)^3}$$

I may get back.

In my favorite CAS is has two identic forms integrate in the sense of an unbounded general integral. I can only do screenshots because the MathML is ill-posed. This can be looked up in books with integreal relationsships and representations like Abramovitch, Stegun.

First a longer one: Now are either integration done automatically or looked up in formula collections.

Evaluating this at the limits of the given integral is:

+∞


doubly singular. The signs do not change for -/+ 𝜋. So the limits have to be taken. These are not too easy and need complex theory and residue methodology.

The problem gets simpler with the substitution t=x/2 and the knowledge that the function is even. For t=0 and t=𝜋/2 the term is positive ∞.

This is the graph of the function of the question: With the substitution z=Cos[t] from @z-ahmed we get something even easier: The process path can be gone in this direction and reverse. Mind the minus sign.

Our limit for z->0 is now 0.

The limit for z->1 is 1/24 𝜋 (𝜋^2 + 3 Log5^2)

We remember our factor 4.

So the result is

This can be simplified with 4 Log^2 - Log^2==0.