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

## Theorem

$\displaystyle \int \frac {\mathrm d x} {\sin a x - \cos a x} = \frac 1 {a \sqrt 2} \ln \left\vert{\tan \left({\frac {a x} 2 - \frac \pi 8}\right)}\right\vert + C$

## Proof

 $\displaystyle \int \frac {\mathrm d x} {\sin a x - \cos a x}$ $=$ $\displaystyle \int \frac {\mathrm d x} {\sqrt 2 \cos \left({a x - \dfrac {3 \pi} 4}\right)}$ Sine of x minus Cosine of x: Cosine Form $\displaystyle$ $=$ $\displaystyle \frac 1 {\sqrt 2} \int \sec \left({a x - \dfrac {3 \pi} 4}\right) \ \mathrm d x$ Secant is Reciprocal of Cosine

Let:

 $\displaystyle z$ $=$ $\displaystyle a x - \dfrac {3 \pi} 4$ $\displaystyle \implies \ \$ $\displaystyle \frac {\mathrm d z} {\mathrm d x}$ $=$ $\displaystyle a$ Derivative of Identity Function and Derivatives of Function of $a x + b$ $\displaystyle \implies \ \$ $\displaystyle \frac 1 {\sqrt 2} \int \sec \left({a x - \dfrac {3 \pi} 4}\right) \ \mathrm d x$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \int \sec z \ \mathrm d z$ Integration by Substitution $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \ln \left\vert{\tan \left({\frac z 2 + \frac \pi 4}\right)}\right\vert + C$ Primitive of $\sec a x$ $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \ln \left\vert{\tan \left({\frac 1 2 \left({a x - \dfrac {3 \pi} 4}\right) + \frac \pi 4}\right)}\right\vert + C$ substituting for $z$ $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \ln \left\vert{\tan \left({\frac {a x} 2 - \frac \pi 8}\right)}\right\vert + C$ simplifying

$\blacksquare$