# How to evaluate $\int_{0}^{\pi} \log(2+\cos x)dx$? [duplicate]

This question already has an answer here:

I tried integrating it by part but it didn't work. I konw it can be solved by the Gauss Mean Value theorem .Is there some elementary method for evaluate it or just some others? It seems there are at least four differential ways(page 4 (17)) but I cannot think out any(the link only says there are four but not give any way).

-

## marked as duplicate by nbubis, Lord_Farin, Vedran Šego, Davide Giraudo, Julian KuelshammerSep 26 '13 at 10:06

Related to this question. – user37238 Sep 26 '13 at 9:26
@user37238 I wish I see your comment before wasting time in composing an answer. – achille hui Sep 26 '13 at 10:05

It depends on what counts as elementary. One way is to consider \begin{align}I(a)&=\int_0^{\pi}\ln\left(\frac{a+a^{-1}}{2}+\cos x\right)dx=\\ &= \frac12\int_0^{2\pi}\ln\left(\frac{a+a^{-1}}{2}+\cos x\right)dx=\\ &=\frac12\int_0^{2\pi}\left[-\ln 2a+\ln\left(1+ae^{ix}\right)+\ln\left(1+ae^{-ix}\right)\right]dx. \end{align} with $0<a<1$. The integrals of $\ln\left(1+ae^{\pm ix}\right)$ are equal to zero. To show this, just expand the logarithms in Taylor series in $a$ and integrate termwise. Therefore, $$I(a)=-\pi\ln 2 a.$$ In your case, $a+a^{-1}=4$ so that $a=2-\sqrt{3}$.

-
Great ! How does the ideal of using $I(a)$ or $ln（\frac{a+a^{-1}}{2}+cosx)$ come out? – Jebei Sep 26 '13 at 9:38
@frame99 Essentially, the aim is to write $\alpha+\cos x$ as $\beta (1+ \gamma e^{i x}) (1+ \delta e^{-i x})$ with some $\beta$, $\gamma$, $\delta$ (with $|\gamma|, |\delta| <1$). Writing $2\alpha=a+a^{-1}$ is just a convenient parameterization of these coefficients (note that for $e^{\pm ix}= -a$ the expression $\alpha+\cos x$ vanishes). – Start wearing purple Sep 26 '13 at 9:45
As it is a trigonometry form. Is it a natural way to think the Euler formula? – Jebei Sep 26 '13 at 9:57
@frame99 The exponentials are in most cases better than the sines and cosines. But if you find this derivation not-intuitive, there many others. For example, you can consider instead of $\ln(2+\cos x)$ a more general function $\ln(2+t \cos x)$. Then differentiating the integral with respect to parameter $t$ you will get rid of the logarithm and will be able to compute the antiderivative. Then integrate back the result with respect to $t$. This is very similar in the spirit to the answer of achille hui. – Start wearing purple Sep 26 '13 at 10:03

Another way: differentiate under integral sign!

Let $\displaystyle\quad J(a) = \int_0^\pi \log(a + \cos x) dx,\quad$ and $t = \tan\frac{x}{2}$, we have:

\begin{align} J'(a) = & \int_0^\pi \frac{dx}{a + \cos x} = \int_0^{\infty} \frac{\frac{2 dt}{1+t^2}}{a + \frac{1-t^2}{1+t^2}} = \frac{2}{a+1}\int_0^{\infty}\frac{dt}{1 + \frac{a-1}{a+1}t^2}\\ = & \frac{2}{\sqrt{a^2-1}}\int_0^\infty \frac{ds}{1+s^2} = \frac{\pi}{\sqrt{a^2-1}} \end{align} Let $a = \cosh\theta$, and integrate over $a$, we get

\begin{align} F(a) = & \int F'(a) da = \pi \int \frac{d\cosh\theta}{\sqrt{\cosh^2\theta-1}}\\ = & \pi \theta + C = \pi\cosh^{-1}(a) + C = \pi \log( a + \sqrt{a^2 - 1} ) + C\tag{*1} \end{align} for some integration constant $C$. For large $a$, we have

$$\log(a + \cos x) = \log a + \frac{\cos x}{a} + O(\frac{1}{a^2}) \quad\implies\quad J(a) = \pi \log a + O(\frac{1}{a})\tag{*2}$$ Compare $(*1)$ with $(*2)$, we find $C = -\pi \log 2$ and hence:

$$J(a) = \pi\log\left(\frac{a + \sqrt{a^2-1}}{2}\right)$$

In particular, the integral we want to calculate is $\displaystyle\quad J(2) = \pi\log\left(\frac{2+\sqrt{3}}{2}\right)$.

-