<s>[INST] 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?
 [/INST] Note that your question is same as proving
$$\int_{0}^{\frac \pi 2} \sin (2nx)\cot (x)\;\text{d}x = \frac \pi 2$$
Let
$$f_n=\int_{0}^{\frac \pi 2} \sin (2nx)\cot (x)\;\text{d}x$$
We will first show that $f_{n+1}-f_n=0$ for any $n\in \mathbb N$.
\begin{align*}
f_{n+1}-f_n&=\int_{0}^{\frac \pi 2}(\sin(2(n+1)x)-\sin(2nx))\cot(x)\;\text{d}x\\
&=\int_{0}^{\frac \pi 2} 2\cos\left(\frac{2(n+1)x+2nx}2\right)\sin\left(\frac{2(n+1)x-2nx}2\right)\cot(x)\;\text{d}x\\
&=\int_{0}^{\frac \pi 2} 2\cos\left(\frac{2(n+1)x+2nx}2\right)\sin(x)\frac{\cos (x)}{\sin (x)}\;\text{d}x\\
&=\int_{0}^{\frac \pi 2} 2\cos\left(\frac{2(n+1)x+2nx}2\right)\cos (x)\;\text{d}x\\
&=\int_{0}^{\frac \pi 2} 2\cos\left(\frac{2(n+1)x+2nx}2\right)\cos\left(\frac{2(n+1)x-2nx}2\right)\;\text{d}x\\
&=\int_{0}^{\frac \pi 2} \cos(2(n+1)x)+\cos(2nx))\;\text{d}x\\
&=\frac 1{2(n+1)}\sin(2(n+1)x)+\frac 1{2n}\sin(2nx)\bigg|_{0}^{\frac \pi 2}\\
&=\frac 1{2(n+1)}\sin((n+1)\pi)+\frac 1{2n}\sin(n\pi)-\frac 1{2(n+1)}\sin(0)-\frac 1{2n}\sin(0)\\
&=0
\end{align*}
Now, just calculate $f_1=\frac \pi 2$ and complete the proof.
</s>