Primitive of Reciprocal of p by Sine of a x plus q by Cosine of a x minus Root of p squared plus q squared

Theorem

 * $\ds \int \frac {\d x} {p \sin a x + q \cos a x - \sqrt {p^2 + q^2} } = \frac {-1} {a \sqrt {p^2 + q^2} } \map \tan {\frac \pi 4 + \frac {a x + \arctan \frac q p} 2} + C$

Proof
Let $\theta = \arctan \dfrac p q$.

Then by the definitions of sine, cosine and tangent:

Now consider:

Then let $\theta' = \arctan \dfrac q p$.

From Arctangent of Reciprocal equals Arccotangent:


 * $\theta' = \arccot \dfrac p q$.

Hence:

Thus:

Also see

 * Primitive of Reciprocal of p by Sine of a x plus q by Cosine of a x plus r: the general case for where $r^2 \ne p^2 + q^2$