TITLE: Evaluating $\int_{0}^{\pi}\ln (1+\cos x)\, dx$
QUESTION [14 upvotes]: The problem is
$$\int_{0}^{\pi}\ln (1+\cos x)\ dx$$
What I tried was using standard limit formulas like changing $x$ to $\pi - x$ and I also tried integration by parts on it to no avail. Please help. Also this is my first question so please tell if I am wrong somewhere.

REPLY [7 votes]: Another way to solve is to use the Cauchy Integral Formula
$$ f(z)=\frac{1}{2\pi i}\int_{\partial D}\frac{f(\xi)}{\xi-z}d\xi$$
where $f(z)$ is analytic in $D$ and continuous in $\bar{D}$. Note that
$$ |1+\cos t+i\sin t|^2=2(1+\cos t).$$
So
\begin{eqnarray}
&&\int_{0}^\pi\log(1+\cos t)\; dt\\
&=&\frac12\int_{0}^{2\pi}\log(1+\cos t)\; dt\\
&=&\frac12\int_{0}^{2\pi}\log|1+\cos t+i\sin t|\; dt-\pi\log2\\
&=&\frac12\int_{0}^{2\pi}\Re\left[\log(1+\cos t+i\sin t)\right]\; dt-\pi\log2\\
&=&\frac12\Re\left[\int_{0}^{2\pi}\log(1+\cos t+i\sin t)\; dt\right]-\pi\log2\\
&=&\frac12\Re\left[\int_{|z|=1}\log(1+z)\; \frac{dz}{iz}\right]-\pi\log2\\
&=&\frac12\times2\pi \log 1-\pi\log2\\
&=&-\pi\log2.
\end{eqnarray}