Evaluate the following integrals:
$\int \frac{1}{\cos -\sin x} d x$
Given $I=\int \frac{1}{\cos x-\sin x} d x$
We know that $\sin x=\frac{2 \tan \frac{x}{2}}{1+\tan \frac{2}{2}}$ and $\cos x=\frac{1-\tan ^{2} \frac{x}{2}}{1+\tan ^{2} \frac{x}{2}}$
$\Rightarrow \int \frac{1}{-\sin x+\cos x} d x=\int \frac{1}{-\frac{2 \tan \frac{x}{2}}{1+\tan \frac{2 x}{2}}+\frac{1-\tan \frac{2 x}{2}}{1+\tan \frac{2 x}{2}}} d x$
$=\int \frac{1+\tan ^{2} \frac{x}{2}}{-2 \tan \frac{x}{2}+1-\tan ^{2} \frac{x}{2}} d x$
Replacing $1+\tan ^{2} x / 2$ in numerator by $\sec ^{2} x / 2$ and putting $\tan x / 2=t$ and $\sec ^{2} x / 2 d x=2 d t$,
$\Rightarrow \int \frac{1+\tan ^{2} \frac{x}{2}}{-2 \tan \frac{x}{2}+1-\tan ^{2} \frac{x}{2}} d x=\int \frac{\sec ^{2} \frac{x}{2}}{-\tan ^{2} \frac{x}{2}-2 \tan \frac{x}{2}+1} d x$
$=-\int \frac{2 d t}{t^{2}+2 t-1}$
$=-2 \int \frac{1}{(t+1)^{2}-(\sqrt{2})^{2}} d t$
$=2 \int \frac{1}{(\sqrt{2})^{2}-(t+1)^{2}} d t$
We know that $\int \frac{1}{a^{2}-x^{2}} d x=\frac{1}{2 a} \log \left|\frac{a+x}{a-x}\right|+c$
$\Rightarrow 2 \int \frac{1}{(\sqrt{2})^{2}-(t+1)^{2}} d t=\frac{2}{2 \sqrt{2}} \log \left|\frac{\sqrt{2}+t+1}{\sqrt{2}-t-1}\right|+c$
$=\frac{1}{\sqrt{2}} \log \left|\frac{\sqrt{2}+\tan \frac{x}{2}+1}{\sqrt{2}-\tan \frac{x}{2}-1}\right|+c$
$\therefore \mathrm{I}=\int \frac{1}{\cos \mathrm{x}-\sin \mathrm{x}} \mathrm{dx}=\frac{1}{\sqrt{2}} \log \left|\frac{\sqrt{2}+\tan \frac{\mathrm{x}}{2}+1}{\sqrt{2}-\tan \frac{\mathrm{x}}{2}-1}\right|+\mathrm{c}$