A toughie

Evaluate $\int \frac{dx}{\cos x + \csc x} $

Answer:

$\int \frac{dx}{\cos x + \csc x} $

$=\int \frac{\sin x}{\sin x \cos x + 1} \; dx$

$=\int \frac{2\sin x}{(\cos x + \sin x)^2 + 1} \; dx$

Substitute $u = \cos x + \sin x $ and get

$du = (\cos x - \sin x) \; dx = (\cos x + \sin x) \; dx - 2\sin x \; dx$

or, $2\sin x \; dx = (\cos x + \sin x) \; dx - du $;

and $\int \frac{2\sin x}{(\cos x + \sin x)^2 + 1} \; dx$

$=\int \frac{(\cos x + \sin x)}{(\cos x + \sin x)^2 + 1} \; dx - \int \frac{du}{(\cos x + \sin x)^2 + 1}$

$= \int \frac{(\cos x + \sin x)}{(\cos x + \sin x)^2 + 1} \; dx - \int \frac{du}{u^2 + 1} $

$= \int \frac{(\cos x + \sin x)}{3 - (\sin x - \cos x)^2} \; dx - \int \frac{du}{u^2 + 1} $

Substitute $w = \sin x - \cos x$ to get

$dw = (\cos x + \sin x) \; dx $ and

$\int \frac{(\cos x + \sin x)}{3 - (\sin x - \cos x)^2} \; dx - \int \frac{du}{u^2 + 1} $

$= \int \frac{dw}{3 - w^2} \; dx - \int \frac{du}{u^2 + 1} $

$= \frac{1}{2\sqrt{3}} ln\left(\frac{w + \sqrt{3}}{w - \sqrt{3}}\right) - \tan^{-1} u + C $

$= \frac{1}{2\sqrt{3}} ln\left(\frac{\cos x - \sin x + \sqrt{3}}{\cos x - \sin x - \sqrt{3}}\right) - \tan^{-1} ( \cos x + \sin x) + C $