Solution:
Suppose
$\mathrm{I}=\int \frac{\cos 2 x}{(\cos \mathrm{x}+\sin \mathrm{x})^{2}} d x$
On substituting the formula, we obtain
$=\int \frac{\cos ^{2} x-\sin ^{2} x}{(\cos x+\sin x)^{2}} d x$
On simplifying, we obtain
$=\int \frac{\cos x-\sin x}{\cos x+\sin x} d x$
Putting $\sin x+\cos x=t$
$\Rightarrow-\sin x+\cos x=\frac{d t}{d x}$
By rearranging
$\begin{array}{l}
\Rightarrow(\cos x-\sin x) d x=d t \\
\therefore I=\int \frac{1}{t} d t \\
=\ln |t|+C
\end{array}$
Substituting the value of $t$, we obtain
$=\operatorname{In}|\cos x+\sin x|+C$