Question:
Evaluate the following integrals:
$\int e^{x}\left(\cot x-\operatorname{cosec}^{2} x\right) d x$
Solution:
Let $\mathrm{I}=\int \mathrm{e}^{\mathrm{x}}\left(\cot \mathrm{x}-\operatorname{cosec}^{2} \mathrm{x}\right) \mathrm{dx}$
$=\int e^{x} \cot x d x-\int e^{x} \operatorname{cosec}^{2} x d x$
Integrating by parts,
$=\cot \int e^{x} d x-\int \frac{d}{d x} \cot \int e^{x} d x-\int e^{x} \operatorname{cosec}^{2} x d x$
$=\cot x e^{x}+\int e^{x} \operatorname{cosec}^{2} x d x-\int e^{x} \operatorname{cosec}^{2} x d x$
$=e^{x} \cot x+c$