<s>[INST] How to solve $\int\frac{\cos(2x)}{\cos x-\sin x}dx$? $$\int\frac{\cos(2x)}{\cos x-\sin x}dx$$
$\cos(2x) = \cos^2(x) - \sin^2(x)$  thus the integral becomes:
$$\int\frac{\cos^2(x)}{\cos x-\sin x} -\int\frac{\sin^2(x)}{\cos x-\sin x}  $$
I am not sure what to do next, I'd appreciate any kind of help.
 [/INST] Note that $\cos(2x) = \cos^2(x) - \sin^2(x) = (\cos(x)+\sin(x))(\cos(x)-\sin(x))$. Thus, we have
$$\begin{aligned}
\displaystyle \int \dfrac{\cos(2x)}{\cos(x) - \sin(x)} \; \mathrm{d}x &= \displaystyle \int \dfrac{(\cos(x)+\sin(x))(\cos(x)-\sin(x))}{\cos(x) - \sin(x)} \; \mathrm{d}x\\
&= \displaystyle \int \cos(x)+\sin(x) \; \mathrm{d}x\\
&= \sin(x) - \cos(x) + C
\end{aligned}$$
Therefore, the answer is $\sin(x) - \cos(x) + C$.
</s>