Primitive of Reciprocal of Sine of a x minus Cosine of a x

Theorem

 * $\ds \int \frac {\d x} {\sin a x - \cos a x} = \frac 1 {a \sqrt 2} \ln \size {\map \tan {\frac {a x} 2 - \frac \pi 8} } + C$

Proof
Let:

Also see

 * Primitive of $\dfrac 1 {\sin a x + \cos a x}$