Primitive of Reciprocal of Square of 1 minus Sine of a x

Theorem

 * $\displaystyle \int \frac {\mathrm d x} {\left({1 - \sin a x}\right)^2} = \frac 1 {2a} \tan \left({\frac \pi 4 + \frac {a x} 2}\right) + \frac 1 {6 a} \tan^3 \left({\frac \pi 4 + \frac {a x} 2}\right) + C$

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: