Primitive of Cosine of a x over Sine of a x plus phi

Theorem

 * $\displaystyle \int \frac {\cos a x \ \mathrm d x} {\sin \left({a x + \phi}\right)} = \frac {\ln \left\vert {\sin \left({a x + \phi}\right)}\right\vert} {a \cos \phi} + \tan \phi \int \frac {\sin a x \ \mathrm d x} {\sin \left({a x + \phi}\right)} + C$

Proof
First note that:

Then: