# Prove this integral identity

Prove the following identity where $$n\in\mathbb{N}$$ $$\int\frac{dx}{\sin^{n-1}(x)\prod_{i=1}^n(\cot(x)-\cot((i+1)x))}=\frac{-\cos((n+1)x)}{n+1}$$

This was a subpart in a massive problem. I was able to solve everything except this. According to wolframalpha I guess that this result is true but I am not able to prove it. Can anyone help me cause this small thing is preventing me from proceeding further in the massive problem.

Any help is greatly appreciated.

First, by the difference of cotangents formula, we have for an arbitrary $$i$$ that \begin{align*} \cot(x) - \cot([i+1]x) &= \cot(x) - \frac{\cot(ix)\cot(x) - 1}{\cot(ix) + \cot(x)}\\ &= \frac{\cot^2(x) + 1}{\cot(ix) + \cot(x)} \\ &= \frac{\csc^2(x)}{\cot(ix) + \cot(x)} \end{align*} Then, the denominator of the integral is \begin{align*} \sin^{n-1}(x)\prod_{i=1}^n \left\{\cot(x) - \cot([i+1]x)\right\} &= \frac{1}{\sin^{n+1}(x)}\prod_{i=1}^n\frac{1}{\cot(ix) + \cot(x)} \\ &= \frac{1}{\sin^{n+1}(x)}\prod_{i=1}^n\frac{\sin(x)\sin(ix)}{\sin(ix)\cos(x) + \cos(ix)\sin(x)} \\ &= \frac{1}{\sin(x)}\prod_{i=1}^n\frac{\sin(ix)}{\sin([i+1]x)} \\ &= \frac{1}{\sin(x)}\frac{\sin(x)}{\sin([n+1]x)} \end{align*} And then the integral is \begin{align*} \int \frac{\text{d}x}{\sin^{n-1}(x)\prod_{i=1}^n \left\{\cot(x) - \cot([i+1]x)\right\}} &= \int \sin([n+1]x)\text{d}x \\ &= - \frac{\cos([n+1]x)}{n+1}. \end{align*}