Primitive of Reciprocal of Sine of a x plus Cosine of a x

Theorem

$\displaystyle \int \frac {\d x} {\sin a x + \cos a x} = \frac 1 {a \sqrt 2} \ln \size {\map \tan {\frac {a x} 2 + \frac \pi 8} } + C$

Proof 1

 $\displaystyle \int \frac {\d x} {\sin a x + \cos a x}$ $=$ $\displaystyle \int \frac {\d x} {\sqrt 2 \map \cos {a x - \dfrac \pi 4} }$ Sine of x plus Cosine of x: Cosine Form $\displaystyle$ $=$ $\displaystyle \frac 1 {\sqrt 2} \int \map \sec {a x - \dfrac \pi 4} \rd x$ Secant is Reciprocal of Cosine

Let:

 $\displaystyle z$ $=$ $\displaystyle a x - \dfrac \pi 4$ $\displaystyle \leadsto \ \$ $\displaystyle \frac {\d z} {\d x}$ $=$ $\displaystyle a$ Derivative of Identity Function and Derivatives of Function of $a x + b$ $\displaystyle \leadsto \ \$ $\displaystyle \frac 1 {\sqrt 2} \int \map \sec {a x - \dfrac \pi 4} \rd x$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \int \sec z \rd z$ Integration by Substitution $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \ln \size {\map \tan {\frac z 2 + \frac \pi 4} } + C$ Primitive of $\sec a x$ $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \ln \size {\map \tan {\frac 1 2 \paren {a x - \dfrac \pi 4} + \frac \pi 4} } + C$ substituting for $z$ $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \ln \size {\map \tan {\frac {a x} 2 + \frac \pi 8} } + C$ simplifying

$\blacksquare$

Proof 2

 $\displaystyle \int \frac {\d x} {\sin a x + \cos a x}$ $=$ $\displaystyle \frac 1 a \int \frac {\dfrac {2 \rd u} {1 + u^2} } {\dfrac {2 u} {1 + u^2} + \dfrac {1 - u^2} {1 + u^2} }$ Weierstrass Substitution: $u = \tan \dfrac {a x} 2$ $\displaystyle$ $=$ $\displaystyle \frac 2 a \int \frac {\d u} {- u^2 + 2 u + 1}$ simplifying $\displaystyle$ $=$ $\displaystyle \frac 2 a \paren {\frac 1 {\sqrt 8} \ln \size {\frac {-2 u + 2 - \sqrt 8} {-2 u + 2 + \sqrt 8} } } + C$ Primitive of $\dfrac 1 {a x^2 + b x + c}$ $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \ln \size {\frac {u - 1 + \sqrt 2} {u - 1 - \sqrt 2} } + C$ simplifying $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \ln \size {\frac {\tan \dfrac {a x} 2 - \paren {1 - \sqrt 2} } {\tan \dfrac {a x} 2 - \paren {1 + \sqrt 2} } } + C$ substituting for $u$ $\displaystyle$ $=$ $\displaystyle \frac 1 {a \sqrt 2} \ln \size {\frac {\tan \dfrac {a x} 2 - \tan \dfrac \pi 8} {\tan \dfrac {a x} 2 - \tan \dfrac {3 \pi} 8} } + C$ Tangent of $\dfrac \pi 8$ and Tangent of $\dfrac {3 \pi} 8$