Primitive of x over Power of Sine of a x

Theorem

 * $\displaystyle \int \frac {x \ \mathrm d x} {\sin^n a x} = \frac {- x \cos a x} {a \left({n - 1}\right) \sin^{n - 1} a x} - \frac 1 {a^2 \left({n - 1}\right) \left({n - 2}\right) \sin^{n - 2} a x} + \frac {n - 2} {n - 1} \int \frac {x \ \mathrm d x} {\sin^{n - 2} a x}$

Proof
With a view to expressing the primitive in the form:
 * $\displaystyle \int u \frac {\mathrm d v}{\mathrm d x} \ \mathrm d x = u v - \int v \frac {\mathrm d u}{\mathrm d x} \ \mathrm d x$

let:

and let:

Then: