How to solve $\int_0^{\pi/2} \ln{(x^2 + \ln^2{(\cos{x})})} \,\mathrm{d}x$ [duplicate]

Solution 1:

Note that the integral is

$$2 \operatorname{Re}{\int_0^{\pi/2} dx \, \log{(\log{\cos{x}} + i x)}} $$

which, by using various manipulations of the integrand around the unit circle, we find to be

$$\frac12 \operatorname{Re}{\int_{-\pi}^{\pi} dx \, \log{(\log{\cos{x}} + i x)}} $$

which integral we may express as an integral over a slightly deformed unit circle:

$$-\frac{i}{2} \oint_C \frac{dz}{z} \log{\left [\log{\left(\frac{z+z^{-1}}{2} \right)}+\log{z} \right ]} = -\frac{i}{2} \oint_C \frac{dz}{z} \log{\left [\log{\left(\frac{z^2+1}{2} \right)} \right ]}$$

where $C$ is the unit circle with small semicircular indentations at the poles $z=\pm i$. The contributions from these indentations to the integral is zero as the radius of the indentations goes to zero.

Thus, we have the integral of a holomorphic function over the boundary of a region in which there is a single, simple pole at the origin. By Cauchy's theorem/ the residue theorem, the integral we seek is thus the real part of

$$i 2 \pi \left (-\frac{i}{2} \right ) \log{\log{\frac12}} $$

or $\pi \log{\log{2}} $.

ADDENDUM

Let me fill in the gaps. Imagine

$$I = \int_{0}^{\pi/2} dx \, \log{(\log{\cos{x}} + i x)}$$

and

$$\begin{align}I' &= \int_{\pi/2}^{\pi} dx \, \log{(\log{\cos{x}} + i x)} \\ &= \int_{0}^{\pi/2} dx \, \log{\left [\log{\left (-\cos{\left (\frac{\pi}{2} - x \right )}\right )} + i x+i \frac{\pi}{2}\right ]} \\ &= \int_{0}^{\pi/2} dx \, \log{\left [\log{\left (\cos{x}\right )} - i \pi + i \left (\frac{\pi}{2}-x \right )+i \frac{\pi}{2}\right ]}\\ &= \int_{0}^{\pi/2} dx \, \log{(\log{\cos{x}} - i x)}\end{align}$$

Then

$$I+I' =\int_0^{\pi} dx \, \log{(\log{\cos{x}} + i x)}= \int_0^{\pi/2} dx \, \log{(\log^2{\cos{x}}+x^2)} $$

Thus,

$$\operatorname{Re}{\int_{-\pi}^{\pi} dx \, \log{(\log{\cos{x}} + i x)}} = 2 \int_0^{\pi/2} dx \, \log{(\log^2{\cos{x}}+x^2)}$$

as was to be shown.

Solution 2:

Following the comment left by @tired, we note that we can factor the argument of the quadratic as

$$x^2+\log^2(\cos(x))=(\log(\cos(x)+ix)(\log(\cos(x)-ix)$$

Writing $ix=\log(e^{ix})$ we have

$$x^2+\log^2(\cos(x))=\left|\log(\cos(x)e^{ix})\right|^2=\left|\log\left(\frac{1+e^{i2x}}{2}\right)\right|^2$$

Next, we write the integral of interest as

$$\int_0^{\pi/2}\log(x^2+\log^2(\cos(x)))\,dx=\frac14\int_{-\pi}^{\pi}\log\left(\left|\log\left(\frac{1+e^{ix}}{2}\right)\right|^2\right)\,dx$$

We move to the complex plane by letting $z=e^{ix}$. The integral of interest becomes

$$\begin{align} \int_0^{\pi/2}\log(x^2+\log^2(\cos(x)))\,dx&=\frac12\oint_{|z|=1}\log\left(\left|\log\left(\frac{1+z}{2}\right)\right|\right)\frac{1}{iz}\,dz\\\\ &=\frac12\text{Re}\left(\oint_{|z|=1}\log\left(\log\left(\frac{1+z}{2}\right)\right)\frac{1}{iz}\,dz\right)\\\\ &=\frac12 \text{Re}\left(2\pi i \left(\frac{\log(\log(2))+i\pi}{i}\right)\right)\\\\ &=\pi \log(\log(2)) \end{align}$$

where we tacitly deformed the contour around the branch point singularities at $z=1$ and $z=-1$ and noted that the contributions from integrations around the deformations are zero.