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

$$\int_0^{\pi/2} \ln{(x^2 + \ln^2{(\cos{x})})} \,\mathrm{d}x$$

I was given this integral yesterday by someone on a forum and after a few hours of having a go at it I didn't really get anywhere significant.

My first idea was to use a series of substitutions which would simply the integral into a form where taylor expansions could be used to solve it. Another idea of mine was to use complex numbers to get rid of some of the log terms, changing the $\ln^2{(\cos{x})}$ term could possibly make this integral a lot more manageable.

I'd prefer if someone could help me solve this using basic methods although if there is a more complicated but elegant solution (using contour integration for example) it could still be beneficial to someone else. We don't do the equivalent of Calc III in my school so I am not very familiar with methods which go beyond the Calc II syllabus (DUDIS, Laplace ect..).

## marked as duplicate by Fabian, Lucian, Em., hardmath, user147263 Jan 30 '16 at 22:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• Why do you believe that there is a closed-form solution? – Mark Viola Jan 30 '16 at 16:14
• @Dr.MV It was given to me after I had spent quite a while on it that the closed form was $\pi \ln{(\ln{2})}$, I was also told that it was possible using methods I was familiar with. – Loua Jan 30 '16 at 16:17
• I think the one idea here would be to use something like $x^2+\log(\cos(x))=|\log(\frac{1+e^{2 i x}}{2})|^2$ and map everything ($z=e^{ix}$) to the unit circle (or some deformed version of it) to employ residue theorem. maybe someone else may finish it from here, i'm much to busy today ... – tired Jan 30 '16 at 16:30
• Actually the $2\pi i \times \text{Res}(z=0)=\pi \log(\log(2))$ so this seems definitly a way to go! Have fun with it guys :) – tired Jan 30 '16 at 16:34
• Other evaluations are here: math.stackexchange.com/questions/915175/… – nospoon Jan 30 '16 at 17:20

## 2 Answers

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.

• Nice Ron! A neat variant of the approach i proposed in the comments! (+1) – tired Jan 30 '16 at 17:00
• @tired: thanks. This is the way I had worked it out before I saw your comments. Nice, you may want to consider putting your thought in an answer. – Ron Gordon Jan 30 '16 at 17:20
• Dr.MV already did this (pretty well) :) – tired Jan 30 '16 at 17:22

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.

• like i had done it! (+1) as always! Maybe u should mention that in prinicpal one has singularities on the contour of integration which luckily turn out to be integrable... – tired Jan 30 '16 at 17:12
• @tired Yes, I saw your comment and proceeded along that line. I'll add some explanation as to the subtleties. Thanks for the up vote!! - Mark – Mark Viola Jan 30 '16 at 17:21
• Dr MV Very cool... – imranfat Jan 30 '16 at 17:29
• @imranfat Thank you! Much appreciated. - Mark – Mark Viola Jan 30 '16 at 17:31