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

Theorem

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

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

Proof
The discriminant of $p u^2 + 2 q u + p$ is $4 q^2 - 4 p^2$.

Thus: