a question how to prove:$\sum_{n=1}^{\infty}{{(-1)}^{n-1}{\cos(nx)}\over {n}}=\ln(2\cos(x/2))$ 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?
 A: Put $\cos(nx)={\rm Re}\, e^{inx}$ and use 
$$\ln\left(\frac{1}{1-x}\right)=x+\frac{x^2}{2}+\frac{x^3}{3}+\frac{x^4}{4}+\frac{x^5}{5}+\dots$$ 
A: $$\log(1+e^{ix}) = \sum_{n=1}^{\infty}\frac{(-1)^{n-1}e^{ixn}}{n}$$
Taking the Real part of both, we get
$${\rm Re}\log(1+e^{ix}) = \sum_{n=1}^{\infty}\frac{(-1)^{n-1}\cos(nx)}{n}$$
and notice that
$${\rm Re}\log(1+e^{ix}) = \log|1+e^{ix}| = \log2|e^{-ix/2}+e^{ix/2}| = \log(2\cos(x/2))$$
A: 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}.$$
A: Edit: I have added a complete solution
\begin{align}
\sum_{n \ge 1}\frac{(-1)^{n-1}\cos{nx}}{n}
&=\sum_{n \ge 1}(-1)^{n}\int \sin{nx} dx\\
&=\int \Im\left(\sum_{n \ge 1} (-e^{ix})^n \right)dx\\
&=-\int\Im\left(\frac{e^{ix}}{1+e^{ix}}\right)dx\\
&=-\int\Im\left(\frac{e^{ix/2}}{e^{-ix/2}+e^{ix/2}}\right)dx\\
&=-\frac{1}{2}\int\Im\left(\frac{\cos(x/2)+i\sin(x/2)}{\cos(x/2)}\right)dx\\
&=-\frac{1}{2}\int\tan(x/2)dx\\
&=\ln(\cos(x/2))+c
\end{align}
We see that
\begin{align}
c
&=\sum_{n \ge 1}\frac{(-1)^{n-1}}{n}\\
&=\sum_{n \ge 0}(-1)^n\int^1_0x^n \ dx\\
&=\int^1_0\frac{1}{1+x}dx\\
&=\ln{2}\\
\end{align}
(Alternatively, one could just recognise the Taylor series of $\ln(1+x)$ and determine the value of $c$ directly.) Therefore
$$\sum_{n \ge 1}\frac{(-1)^{n-1}\cos{nx}}{n}=\ln(\cos(x/2))+\ln(2)=\ln(2\cos(x/2))$$
