ALREADY ANSWERED
I was trying to prove the result that the OP of this question is given as a hint.
That is to say: imagine that you are not given the hint and you need to evaluate:
$$I = \int^{\pi/2}_0 \log{\cos{x}} \, \mathrm{d}x \color{red}{\overset{?}{=} }\frac{\pi}{2} \log{\frac{1}{2}} \tag{1}$$
How would you proceed?
Well, I tried the following steps and, despite it seems that I am almost there, I have found some troubles:
- Taking advantage of the fact: $$\cos{x} = \frac{e^{ix}+e^{-ix}}{2}, \quad \forall x \in \mathbb{R}$$
- Plugging this into the integral and performing the change of variable $z = e^{ix}$, so the line integral becomes a contour integral over a quarter of circumference of unity radius centered at $z=0$, i.e.: $$ I = \frac{1}{4i} \oint_{|z|=1}\left[ \log{ \left(z+\frac{1}{z}\right)} - \log{2} \right] \, \frac{\mathrm{d}z }{z}$$
$\color{red}{\text{We cannot do this because the integrand is not holomorphic on } |z| = 1 }$
- Note that the integrand has only one pole lying in the region enclosed by the curve $\gamma : |z|=1$ and it is holomorphic (is it?) almost everywhere (except in $z =0$), so the residue theorem tells us that:
$$I = \frac{1}{4i} \times 2\pi i \times \lim_{z\to0} \color{red}{z} \frac{1}{\color{red}{z}} \left[ \underbrace{ \log{ \left(z+\frac{1}{z}\right)} }_{L} - \log{2} \right] $$
- As I said before, it seems that I am almost there, since the result given by eq. (1) follows iff $L = 0$, which is not true (I have tried L'Hôpital and some algebraic manipulations).
Where did my reasoning fail? Any helping hand?
Thank you in advance, cheers!
Please note that I'm not much of an expert in either complex analysis or complex integration so please forgive me if this is trivial.
Notation: $\log{x}$ means $\ln{x}$.
A graph of the function $f(z) = \log{(z+1/z)}$ helps to understand the difficulties:
where $|f(z)|$, $z = x+i y$ is plotted and the white path shows where $f$ is not holomorphic.