# Primitive of Reciprocal of p by Sine of a x plus q by 1 plus Cosine of a x

## Theorem

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

## Proof

Let $z = a x + \arctan \dfrac {-p} q$.

Then:

 $\displaystyle \int \frac {\mathrm d x} {p \sin a x + q \left({1 + \cos a x}\right)}$ $=$ $\displaystyle \int \frac {\mathrm d x} {q + \sqrt {p^2 + q^2} \cos \left({a x + \arctan \dfrac {-p} q}\right)}$ Multiple of Sine plus Multiple of Cosine $\displaystyle$ $=$ $\displaystyle \frac 1 a \int \frac {\mathrm d z} {q + \sqrt {p^2 + q^2} \cos z}$ Primitive of Function of $a x + b$

Let $d = \sqrt {p^2 + q^2}$.

We have that $q^2 < p^2 + q^2$ and so:

 $\displaystyle$  $\displaystyle \frac 1 a \int \frac {\mathrm d z} {q + \sqrt {p^2 + q^2} \cos z}$ $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt {p^2 + q^2 - q^2} } \ln \left\vert{\frac {\tan \dfrac z 2 + \sqrt {\dfrac {\sqrt {p^2 + q^2} - q} {\sqrt {p^2 + q^2} + q} } } {\tan \dfrac z 2 - \sqrt {\dfrac {\sqrt {p^2 + q^2} - q} {\sqrt {p^2 + q^2} + q} } } }\right\vert + C$ Primitive of $\dfrac 1 {p + q \cos a x}$ $\displaystyle$ $=$ $\displaystyle \frac 1 {a p} \ln \left\vert{\frac {\tan \dfrac z 2 + \sqrt {\dfrac {\left({\sqrt {p^2 + q^2} - q}\right)^2} {\left({\sqrt {p^2 + q^2} + q}\right) \left({\sqrt {p^2 + q^2} - q}\right)} } } {\tan \dfrac z 2 - \sqrt {\dfrac {\left({\sqrt {p^2 + q^2} - q}\right)^2} {\left({\sqrt {p^2 + q^2} + q}\right) \left({\sqrt {p^2 + q^2} - q}\right)} } } }\right\vert + C$ $\displaystyle$ $=$ $\displaystyle \frac 1 {a p} \ln \left\vert{\frac {\tan \dfrac z 2 + \sqrt {\dfrac {\left({\sqrt {p^2 + q^2} - q}\right)^2} {p^2 + q^2 - q^2} } } {\tan \dfrac z 2 - \sqrt {\dfrac {\left({\sqrt {p^2 + q^2} - q}\right)^2} {p^2 + q^2 - q^2} } } }\right\vert + C$ Difference of Two Squares $\displaystyle$ $=$ $\displaystyle \frac 1 {a p} \ln \left\vert{\frac {\tan \dfrac z 2 + \sqrt {\dfrac {\left({\sqrt {p^2 + q^2} - q}\right)^2} p} } {\tan \dfrac z 2 - \sqrt {\dfrac {\left({\sqrt {p^2 + q^2} - q}\right)^2} p} } }\right\vert + C$ simplifying $\displaystyle$ $=$ $\displaystyle \frac 1 {a p} \ln \left\vert{\frac {p \tan \dfrac z 2 + \sqrt {\left({\sqrt {p^2 + q^2} - q}\right)^2} } {p \tan \dfrac z 2 - \sqrt {\left({\sqrt {p^2 + q^2} - q}\right)^2} } }\right\vert + C$ simplifying