A integral equation Prove that : 
$$\displaystyle \int_0^{\frac{\pi}{2}}p(x)\cot x\text{d}x=2\sum_{k=1}^{\infty}\int_0^{\frac{\pi}{2}}p(x)\sin (2kx)\text{d}x$$
where $\displaystyle p(x)=x^n$
 A: Using the formula for the sum of a geometric series:
$$
\begin{align}
2\sum_{k=1}^{m-1}\sin(2kx)
&=-i\sum_{k=1}^{m-1}(e^{i2kx}-e^{-i2kx})\\
&=-i\left(\frac{e^{i2x}-e^{i2mx}}{1-e^{i2x}}-\frac{e^{-i2x}-e^{-i2mx}}{1-e^{-i2x}}\right)\\
&=-i\left(\frac{e^{ix}-e^{i(2m-1)x}}{e^{-ix}-e^{ix}}-\frac{e^{-ix}-e^{-i(2m-1)x}}{e^{ix}-e^{-ix}}\right)\\
&=i\frac{e^{ix}+e^{-ix}}{e^{ix}-e^{-ix}}-i\frac{e^{i(2m-1)x}+e^{-i(2m-1)x}}{e^{ix}-e^{-ix}}\\[6pt]
&=\frac{\cos(x)}{\sin(x)}-\frac{\cos((2m-1)x)}{\sin(x)}\\[9pt]
&=\cot(x)-\frac{\cos((2m-1)x)}{\sin(x)}
\end{align}
$$
Therefore, if $p(x)/x$ is integrable, then by the Riemann-Lebesgue Lemma
$$
\begin{align}
2\sum_{k=1}^\infty\int_0^{\pi/2}p(x)\sin(2kx)\,\mathrm{d}x
&=\lim_{m\to\infty}2\sum_{k=1}^{m-1}\int_0^{\pi/2}p(x)\sin(2kx)\,\mathrm{d}x\\
&=\lim_{m\to\infty}\int_0^{\pi/2}p(x)\left(\cot(x)-\frac{\cos((2m-1)x)}{\sin(x)}\right)\,\mathrm{d}x\\
&=\int_0^{\pi/2}p(x)\cot(x)\,\mathrm{d}x-{\small\lim_{m\to\infty}\int_0^{\pi/2}\frac{p(x)}{\sin(x)}\cos((2m-1)x)\,\mathrm{d}x}\\
&=\int_0^{\pi/2}p(x)\cot(x)\,\mathrm{d}x
\end{align}
$$
