# Primitive of Reciprocal of p plus q by Tangent of a x

## Theorem

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

## Proof

First, let $\arctan \dfrac p q = \phi$.

Let $z = a x + \phi$.

 $\displaystyle z$ $=$ $\displaystyle \sin \left({a x + \phi}\right)$ $\displaystyle \implies \ \$ $\displaystyle \frac {\mathrm d z} {\mathrm d x}$ $=$ $\displaystyle a \cos \left({a x + \phi}\right)$ Derivative of $\sin a x$ etc. $\displaystyle$ $=$ $\displaystyle a \cos z$

Then:

 $\displaystyle \int \frac {\mathrm d x} {p + q \tan a x}$ $=$ $\displaystyle \int \frac {\mathrm d x} {p + q \dfrac {\sin a x} {\cos a x} }$ Tangent is Sine divided by Cosine $\displaystyle$ $=$ $\displaystyle \int \frac {\cos a x \ \mathrm d x}{p \cos a x + q \sin a x}$ multiplying top and bottom by $\cos a x$ $\displaystyle$ $=$ $\displaystyle \int \frac {\cos a x \ \mathrm d x} {\sqrt {p^2 + q^2} \sin \left({a x + \phi}\right)}$ Multiple of Sine plus Multiple of Cosine: Sine Form $\displaystyle$ $=$ $\displaystyle \frac 1 {\sqrt {p^2 + q^2} } \int \frac {\cos a x \ \mathrm d x} {\sin \left({a x + \phi}\right)}$ Primitive of Constant Multiple of Function $\displaystyle$ $=$ $\displaystyle \frac 1 {\sqrt {p^2 + q^2} } \left({\frac {\ln \left\vert {\sin \left({a x + \phi}\right)}\right\vert} {a \cos \phi} + \tan \phi \int \frac {\sin a x \ \mathrm d x} {\sin \left({a x + \phi}\right)} + C}\right)$ Primitive of $\dfrac {\cos a x} {\sin \left({a x + \phi}\right)}$