Integral $\int_0^\pi \cot(x/2)\sin(nx)\,dx$

It seems that $$\int_0^\pi \cot(x/2)\sin(nx)\,dx=\pi$$ for all positive integers $n$.

But I have trouble proving it. Anyone?

Solutions Collecting From Web of "Integral $\int_0^\pi \cot(x/2)\sin(nx)\,dx$"

Use this famous sum:

$$1+2\cos x+2\cos 2x+\cdots+2\cos nx=\frac{\sin (n+\frac{1}{2})x}{\sin \frac{x}{2}}=\sin nx\cot\left(\frac{x}{2}\right)+\cos nx$$

Hence

$$\int_0^{\pi}\cot \left(\frac{x}{2}\right)\sin n x\,dx=\int_0^{\pi}1+2\cos x+2\cos 2x+\cdots +\cos nx\,dx$$

All cosine terms obviously evaluate to zero.

We can prove this via induction. For $n=1$:

$$\int_0^{\pi} dx \: \cot{(x/2)} \sin{x} = 2 \int_0^{\pi} dx \: \cos^2{(x/2)} = \pi$$

Assume this works for $n$. Now show it works for $n+1$:

$$\begin{align}\int_0^{\pi} dx \: \cot{(x/2)} \sin{(n+1) x} &= \int_0^{\pi} dx \: \cot{(x/2)} \sin{(n x)} \cos{x}\\ &+ \int_0^{\pi} dx \: \cot{(x/2)} \cos{(n x)} \sin{x}\\ &=\pi + 2 \int_0^{\pi} dx \: \cos{(x/2)} \cos{(n+1/2) x} \end{align}$$

That last step combined a number of trig identities and should be verified by the reader. Now we need to show that that last integral is zero. We do so by substituting $u=x/2$ and using a trig identity:

$$\begin{align}\int_0^{\pi} dx \: \cos{(x/2)} \cos{(n+1/2) x} &= 2\int_0^{\pi/2} du \: \cos{u} \cos{(2n+1) u}\\ &= \int_0^{\pi/2} du \: [ \cos{(2 n u)} + \cos{2 (n+1) u}]\\ &= \frac{\sin{n \pi}}{2 n} + \frac{\sin{(n+1) \pi}}{2 (n+1)}\end{align}$$

which is zero for $n \in \mathbb{Z}$ and $n \ge 1$. Therefore, the stated identity holds.