TITLE: a question how to prove:$\sum_{n=1}^{\infty}{{(-1)}^{n-1}{\cos(nx)}\over {n}}=\ln(2\cos(x/2))$
QUESTION [5 upvotes]: I found a complicated question in my textbook, I can't solve it?
How to prove $$\sum_{n=1}^{\infty}{{(-1)}^{n-1}{\cos nx}\over {n}}=\ln(2\cos(x/2))$$
where $x\in(-\pi,\pi)$.
My tried method: I tried to take the derivative of $\ln(2\cos(x/2))$, and the derivative is $$\frac{-\sin(x/2)}{2\cos(x/2)}=\frac{-1}{2}\tan(x/2)$$. 
I tried to compute its Taylor series of ${-1\over 2}\tan(x/2)$. However, I don't think it does work using the method.  I also tried to use Fourier series to solve it, but integrating $\ln(2\cos(x/2))\cos(nx)$ is so hard. I don't know how to solve it? Can someone tell me how to solve this question?

REPLY [2 votes]: Here's a hint on the required "non-complex-analysis" solution. As you noted, one of the ways is to use Fourier series, but your problem is with integrating $\ln(2\cos(x/2))\cos nx$, so let me help you with that. Using integration by parts, we get
$$I=\int_0^\pi \ln(2\cos(x/2))\cos nx\,dx=\frac1n\int_0^\pi \ln(2\cos(x/2))\,d\sin nx=\frac1n\int_0^\pi \frac{\sin nx\sin(x/2)}{4\cos(x/2)}\,dx=\frac1n\int_0^{2\pi} \frac{\sin 2nx\sin x}{2\cos x}\,dx=\frac1{2n}\int_0^{2\pi} \frac{\cos (2n-1)x-\cos(2n+1)x}{\cos x}\,dx=\frac1{2n}(I_{n-1}-I_n),$$
where
$$I_n=\int_0^{2\pi} \frac{\cos (2n+1)x}{\cos x}\,dx=\int_0^{2\pi} \frac{2\cos x\cos 2nx-\cos(2n-1)x}{\cos x}\,dx=-I_{n-1}.$$
Since $I_0=2\pi$, from $I_n=-I_{n-1}$ we conclude that $I_n=2\pi(-1)^n$. Therefore,
$$I=\frac{\pi}{n}(-1)^{n-1}.$$