# proof of $-\ln\left(2\sin\left(\frac x2\right)\right)=\sum_{k=1}^\infty \frac {\cos(kx)}{k}$?

There is an identity that I have seen pop up in a few questions on this stackexchange, and I was wondering what proof there is for it. It goes something like this: $$-\ln\left(2\sin\left(\frac x2\right)\right)=\sum_{k=1}^\infty \frac {\cos(kx)}{k}$$

Again, my question is:

How do you prove this identity?

• Equivalent to $$\sin(\frac{x}{2}) = \prod^{\infty}_{k=1} e^{\frac{1}{k}\cos(kx)}$$ Commented May 31, 2015 at 5:51
• how about expanding both sides? Commented May 31, 2015 at 6:02

$-\dfrac{\cos(kx)}k=$ real of $-\dfrac{e^{ikx}}k$

As $\ln(1-h)=-\sum_{r=1}^\infty\dfrac{h^r}r,$

$\sum-\dfrac{e^{ikx}}k=\ln\left[1-e^{ix}\right]$

$=\ln(e^{ix/2})+\ln(e^{ix/2}-e^{-ix/2})$

$=ix/2+\ln(i\cdot2\sin x/2)$

$=ix/2+\ln i+\ln(2\sin x/2)$

$i=e^{i\pi/2}\implies\ln(i)=i\pi/2$

• Where does the second line come from? Commented May 31, 2015 at 6:07
• @user7530,Please find the edited version Commented May 31, 2015 at 6:09
• So the identity only holds true for real $x$? Commented May 31, 2015 at 6:47
• @nbubis, What if $-\pi<\dfrac x 2<0\implies\sin \dfrac x2<0$ Commented May 31, 2015 at 7:16

Whenever I see a $\cos(kx)$ or $\sin(kx)$ I automatically think of the real or imaginary part of $e^{-kx}$.

So, let $f(x) =\sum_{k=1}^{\infty} \frac{e^{ikx}}{k}$. $f'(x) =\sum_{k=1}^{\infty} ie^{ikx} =\frac{ie^{ix}}{1-e^{ix}}$.

At this stage, I try to integrate $\frac{e^{ax}}{1-e^{ax}}$, so that I can later set $a = i$.

Being lazy, I throw it at Wolfram's integrator and get $\frac{-\ln(e^{ax}-1)}{a}$. I check that yes, this is correct.

Putting $a=i$, I get $\int \frac{ie^{ix}dx}{1-e^{ix}} =\frac{-i\ln(e^{-ix}-1)}{i} =-\ln(e^{-ix}-1)$.

Looking at that result, I get annoyed at myself for not immediately using $-\ln(1-x) =\sum_{k=1}^{\infty} \frac{x^k}{k}$.

At this point, I stop and give this to you to finish, leaving you the task of getting the $\ln$ of that complex expression and separating the real and imaginary parts.

## Here's is my proof :D

$$\sum_{k=1}^{\infty}\frac{cos(kx)}{k}=\frac{1}{2}\left(\sum_{k=1}^{\infty}\frac{e^{ikx}}{k}+\sum_{k=1}^{\infty}\frac{e^{-ikx}}{k}\right)=$$ $$\frac{-1}{2}\left(\ln(1-e^{ix})+\ln(1-e^{-ix}\right)=$$ $$\frac{-1}{2}\ln \left (2-2\cos(x)\right)=$$ $$-\frac{1}{2}\ln[(2\sin(x/2))^2]=-{\ln[2\sin(x/2)]}$$

$$\boxed{\therefore \sum_{k=1}^{\infty}\frac{cos(kx)}{k}=\ln[2\sin(x/2)]}$$

$$\large{\text{Note Section:}}$$ $$cos(x)=\frac{e^{ix}+e^{-ix}}{2}$$ $$\ln(1-x)=-\sum_{n=1}^{\infty} \frac{x^n}{n}$$

Using the identity $$\ln(1-x)=-\sum_{n=1}^\infty \frac{x^n}{n}$$, we have \begin{aligned}\sum_{k=1}^{\infty} \frac{\cos (k x)}{k} = & \sum_{k=1}^{\infty} \Re\left(\frac{e^{k x i}}{k}\right) \\ = & \Re \sum_{k=1}^{\infty} \frac{\left(e^{x i}\right)^k}{k}\\=&-\Re\left(\ln \left(1-e^{x i}\right)\right) \end{aligned} \begin{aligned} \ln \left(1-e^{x i}\right) = & \ln \left(\frac{x^{-\frac{x}{2} i}-e^{\frac{x }{2}i}}{e^{-\frac{x}{2} i}}\right) \\ = & \ln \left(-2 i \sin \frac{x}{2}\right)+\frac{x}{2} i \\ = & \ln \left(2 \sin \frac{x}{2}\right)-\frac{\pi}{2} i+\frac{x}{2} i \end{aligned} $$\boxed{\sum_{k=1}^{\infty} \frac{\cos (k x)}{k}=-\ln \left(2 \sin \frac{x}{2}\right)}$$