Evaluate $\int_0^{\pi/2}\log\cos(x)\,\mathrm{d}x$ How can you evaluate $$\int\limits_0^{\pi/2}\log\cos(x)\,\mathrm{d}x\;?$$

Here is another solution: As we have $\cos(x)=\frac{e^{ix}+e^{-ix}}{2}=\frac{e^{2ix}+1}{2e^{ix}}$ we get:
$$I=\int_0^{\frac{\pi}{2}} \ln(\cos(x))dx=\int_0^{\frac{\pi}{2}} \ln(e^{2ix}+1)dx-\int_0^{\frac{\pi}{2}} \ln(2)dx-\int_0^{\frac{\pi}{2}} ixdx$$
By using the series expansion of $\ln(x)$ and by calculating the two simple integrals we obtain:
$$I=\int_0^{\frac{\pi}{2}} \sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot e^{2ix(k+1)}dx-\frac{\pi}{2}\cdot \ln(2)-i\frac{\pi^2}{8}$$
By swapping the integral and the sum, the integral of the infinite sum can be calculated as follows:
$$\int_0^{\frac{\pi}{2}} \sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot e^{2ix(k+1)}dx=\sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot \int_0^{\frac{\pi}{2}}e^{2ix(k+1)}dx=\sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot \left(\frac{e^{i\pi(k+1)}-1}{2i(k+1)}\right)=\frac{i}{2}\cdot\sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot \left(\frac{1-(-1)^{k+1}}{(k+1)}\right)$$
Here I used, that $\frac{1}{i}=-i$. Now, when $k$ is uneven, the expression after the sigma is equal to $0$, this yields:
$$\frac{i}{2}\cdot\sum_{k=0}^\infty \frac{(-1)^k}{k+1}\cdot \left(\frac{1-(-1)^{k+1}}{(k+1)}\right)=\frac{i}{2}\cdot\sum_{k=0}^\infty \frac{2\cdot(-1)^{2k}}{(2k+1)^2}=i\cdot\sum_{k=0}^\infty \frac{1}{(2k+1)^2}=i\cdot\left(\sum_{k=1}^\infty \frac{1}{k^2}-\sum_{k=1}^\infty \frac{1}{(2k)^2}\right)=i\cdot\frac{3}{4}\cdot\zeta(2)=i\frac{\pi^2}{8}$$
Therefore, $I$ can be expressed as follows:
$$I=i\frac{\pi^2}{8}-\frac{\pi}{2}\cdot \ln(2)-i\frac{\pi^2}{8}=-\frac{\pi}{2}\cdot \ln(2)$$
