Prove this integral problem Image of the question : 
My attempt : $$I_{n-1} + I_{n+1} = \int_0^{2\pi} \frac{\cos((n-1)x) + \cos((n+1)x)}{1 - \cos x} \, dx$$
$$= \int_0^{2\pi} \frac{2\cos nx\cos x}{1 - \cos x} \, dx$$
$$\int_0^{2\pi} \frac{\cos nx}{1 - \cos x}dx - 2\int_0^{2\pi} \cos nx \, dx$$
Any hints or any constructive suggestion to complete thus problem.
 A: HINT:
$$I_n-I_{n-1}=\int_0^{2\pi}\dfrac{\cos nx-\cos(n-1)x}{1-\cos x}dx =-\int_0^{2\pi}\dfrac{\sin\dfrac{2n-1}2x}{\sin\dfrac x2}dx$$
$$=-2\int_0^\pi\dfrac{\sin(2n-1)y}{\sin y}dy=J_n\text{(say)}$$
Now find $J_m-J_{m-1}$ and $J_1=?$
A: $$
\begin{align}
\int_0^{2\pi}\frac{\cos((n-1)x)-\cos(nx)}{1-\cos(x)}\,\mathrm{d}x
&=\int_0^{2\pi}\frac{2\sin\left(\left(n-\frac12\right)x\right)\sin\left(\frac x2\right)}{2\sin^2\left(\frac x2\right)}\,\mathrm{d}x\\[3pt]
&=\int_0^{2\pi}\frac{\sin\left(\left(n-\frac12\right)x\right)}{\sin\left(\frac x2\right)}\,\mathrm{d}x\\
&=2\int_0^\pi\frac{\sin\left(\left(2n-1\right)x\right)}{\sin\left(x\right)}\,\mathrm{d}x\\
&=\int_0^{2\pi}\frac{\sin\left(\left(2n-1\right)x\right)}{\sin\left(x\right)}\,\mathrm{d}x\\
&=\int_0^{2\pi}\sum_{k=-(n-1)}^{n-1}\cos(2kx)\,\mathrm{d}x\\[6pt]
&=2\pi
\end{align}
$$
The sum identity can be proven using induction and the identity
$$
\sin((2n+1)x)=\sin((2n-1)x)+2\cos(2nx)\sin(x)
$$

Caveat: The integral in the image
$$
\int_0^{2\pi}\frac{\cos(nx)}{1-\cos(x)}\,\mathrm{d}x
$$
diverges. However, one might use
$$
\int_0^{2\pi}\frac{1-\cos(nx)}{1-\cos(x)}\,\mathrm{d}x
$$
instead.
