<s>[INST] calculate $\lim_{x\rightarrow\frac{\pi}{4}}\frac{\cos2x}{\cos x-\sin x}$ $$\lim_{x\rightarrow\frac{\pi}{4}}\frac{\cos(2x)}{\cos(x)-\sin(x)}=\lim_{x\rightarrow\frac{\pi}{4}}\frac{2\cos^{2}(x)-1}{\cos(x)-\sqrt{1-\cos^{2}(x)}}$$
$$t=\cos(x)$$
$$\lim_{x\rightarrow\frac{\pi}{4}}\frac{2t^{2}-1}{t-\sqrt{1-t^{2}}}=\lim_{x\rightarrow\frac{\pi}{4}}\frac{(2t^{2}-1)(t+\sqrt{t^{2}-1})}{2t^{2}-1}$$
$$\lim_{x\rightarrow\frac{\pi}{4}}(2t^{2}-1)(t-\sqrt{t^{2}-1})=3(\sqrt{2}-1)$$
Please help me to find an error. Correct answer is $\sqrt{2}$. Thanks
 [/INST] The third line is in error: you forgot to cancel the factor of $2 t^2 - 1$ and you switched the sign of $\sqrt{1-t^2}$.  If you correct, you'll see that
$$ \lim_{x \rightarrow \frac{\pi}{4}} \frac{\cos{2 x}}{\cos{x} - \sin{x}} = \lim_{t \rightarrow \frac{1}{\sqrt{2}}} \left [ t + \sqrt{1-t^2} \right ] = \sqrt{2} $$
</s>