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?
 A: 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.
A: 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.
A: 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.
