Primitive of Reciprocal of p plus q by Cosine of a x

Theorem

 * $\displaystyle \int \frac {\mathrm d x} {p + q \cos a x} = \begin{cases}

\displaystyle \frac 2 {a \sqrt {p^2 - q^2} } \arctan \left({\sqrt {\frac {p - q} {p + q} } \tan \dfrac {a x} 2}\right) + C & : p^2 > q^2 \\ \displaystyle \frac 1 {a \sqrt {q^2 - p^2} } \ln \left\vert{\frac {\tan \dfrac {a x} 2 + \sqrt {\dfrac {q + p} {q - p} } } {\tan \dfrac {a x} 2 - \sqrt {\dfrac {q + p} {q - p} } } }\right\vert + C & : p^2 < q^2 \\ \end{cases}$

Proof
Let $p^2 > q^2$.

Then, by Sign of Quotient of Factors of Difference of Squares:
 * $\dfrac {p - q} {p + q} > 0$

Thus, let $\dfrac {p - q} {p + q} = d^2$.

Then:

Now let $p^2 < q^2$.

Then, by Sign of Quotient of Factors of Difference of Squares:
 * $\dfrac {p - q} {p + q} < 0$

Thus, let:
 * $-\dfrac {p - q} {p + q} = d^2$

or:
 * $\dfrac {q - p} {q + p} = d^2$

Then:

Also see

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