# Showing $\int^{\frac{\pi}{2}}_{-\frac{\pi}{2}} \log(\cos(\phi))\cos(\phi) \ d\phi = \log(4) - 2$

This is a minor detail of a proof in 'Chaotic Billiards' by Chernov and Markarian which I foolishly decided to verify.

It's page 44 of the book, during the proof that lyapunov exponents exist almost everywhere in the collision space (Theroem 3.6) in case anyone is familiar. Though the integral problem stated is independent of any knowledge of this field.

I've tried integration by parts but I end up with:

$\int^{\frac{\pi}{2}}_{-\frac{\pi}{2}} \sin(\phi)\tan(\phi) \,d\phi$

which is non-convergent on the given interval. All help is appreciated!

quick edit: log is the natural logarithm

You can replace $\cos(x)$ inside the log with $\sqrt{1-\sin(x)^2}$, then use the properties of the logarithm to expand it into:

$$\dfrac{1}{2}\int (\log(1-\sin(x)) + \log(1+\sin(x)))\cos(x) dx$$

Now you can integrate the individual summands using $u$-substitution.

• That's clever and clean and I'm semi-kicking myself that I didn't think of it. Maybe I'm just out of practice with rolling my sleeves up and integrals... Is this a normal way of approaching log integrals that you have seen before? – tin_feuler Apr 1 '14 at 1:37
• Thanks. I haven't really used or seen this before, but as these things have been studied over centuries, I'm sure it is a standard technique that can be found somewhere in dealing with trig functions. – Braindead Apr 1 '14 at 1:41

Here is one alternate method. Since $$\log(\cos(\theta))=\frac12\left[\log\left(1+e^{2i\theta}\right)+\log\left(1+e^{-2i\theta}\right)-\log(4)\right]$$ we get \begin{align} &\int_{-\pi/2}^{\pi/2}\left[-\log(2)-\sum_{k=1}^\infty(-1)^k\frac{\cos(2k\theta)}{k}\right]\cos(\theta)\,\mathrm{d}\theta\\ &=-2\log(2)-\sum_{k=1}^\infty(-1)^k\int_{-\pi/2}^{\pi/2}\frac{\cos((2k+1)\theta)+\cos((2k-1)\theta)}{2k}\mathrm{d}\theta\\ &=-2\log(2)-\sum_{k=1}^\infty\left[\frac1{k(2k+1)}-\frac1{k(2k-1)}\right]\\ &=-2\log(2)-\sum_{k=1}^\infty\left[\color{#C00000}{\frac2{2k}-\frac2{2k-1}}+\color{#00A000}{\frac2{2k}-\frac2{2k+1}}\right]\\[6pt] &=-2\log(2)-[\color{#C00000}{-2\log(2)}+\color{#00A000}{2-2\log(2)}]\\[16pt] &=2\log(2)-2 \end{align}

Integration by parts works as well. but it requires more than one application. \begin{align} &\int\log(\cos(\theta))\cos(\theta)\,\mathrm{d}\theta\\ &=\int\log(\cos(\theta))\,\mathrm{d}\sin(\theta)\\ &=\sin(\theta)\log(\cos(\theta))+\int\sin(\theta)\tan(\theta)\,\mathrm{d}\theta\\ &=\sin(\theta)\log(\cos(\theta))-\int\tan(\theta)\,\mathrm{d}\cos(\theta)\\ &=\sin(\theta)\log(\cos(\theta))-\sin(\theta)+\int\cos(\theta)\sec^2(\theta)\,\mathrm{d}\theta\\ &=\sin(\theta)\log(\cos(\theta))-\sin(\theta)+\int\frac1{1-\sin^2(\theta)}\,\mathrm{d}\sin(\theta)\\[3pt] &=\sin(\theta)\log(\cos(\theta))-\sin(\theta)+\log(\sec(\theta)+\tan(\theta))+C \end{align} Since $\log(\sec(\theta)+\tan(\theta))=-\log(\sec(\theta)-\tan(\theta))$, we can evaluate the antiderivative at $+\pi/2$ and $-\pi/2$: \begin{align} \text{at }+\pi/2:&-1+\log(2)+C\\ \text{at }-\pi/2:&+1-\log(2)+C \end{align} Thus, we get that $$\int_{-\pi/2}^{\pi/2}\log(\cos(\theta))\cos(\theta)\,\mathrm{d}\theta=2\log(2)-2$$

• fixed a sign error in the third line of the integration – robjohn Apr 1 '14 at 2:31


\begin{align}&\color{#00f}{\large% \int_{-\pi/2}^{\pi/2}\ln\pars{\cos\pars{\phi}}\cos\pars{\phi}\,\dd\phi} =2\int_{0}^{\pi/2}\ln\pars{\cos\pars{\phi}}\cos\pars{\phi}\,\dd\phi \\[3mm]&=2\int_{1}^{0}\ln\pars{t}t\,\pars{-\,{\dd t \over \root{1 - t^{2}}}} =2\lim_{\mu \to 1}\totald{}{\mu}\int_{0}^{1}t^{\mu}\pars{1 - t^{2}}^{-1/2}\,\dd t \\[3mm]&=2\lim_{\mu \to 1}\totald{}{\mu} \int_{0}^{1}t^{\mu/2}\pars{1 - t}^{-1/2}\,\half\,t^{-1/2}\dd t =\lim_{\mu \to 1}\totald{}{\mu} \int_{0}^{1}t^{\pars{\mu - 1}/2}\pars{1 - t}^{-1/2}\,\dd t \\[3mm]&=\lim_{\mu \to 1}\totald{{\rm B}\pars{\bracks{\mu + 1}/2,1/2}}{\mu} =\lim_{\mu \to 1}\totald{}{\mu} \bracks{\Gamma\pars{\bracks{\mu + 1}/2}\Gamma\pars{1/2} \over \Gamma\pars{\mu/2 + 1}} \\[3mm]&=\Gamma\pars{\half}\braces{% {\Gamma\pars{1} \over \Gamma\pars{3/2}}\, \half\bracks{\Psi\pars{1} - \Psi\pars{3 \over 2}}} =\Gamma\pars{\half}\braces{{1 \over \Gamma\pars{1/2}/2}\, \half\bracks{\ln\pars{4} - 2}} \\[3mm]&= \color{#00f}{\large\ln\pars{4} - 2} \end{align}

$\ds{{\rm B}\pars{x,y}}$ is the Beta Function. $\ds{\Gamma\pars{z}}$ is the Gamma Function. $\ds{\Psi\pars{z}}$ is the Digamma Function.

We used well known properties of those functions.