<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] Plugging in $\frac{\pi}{4}$ for $x$, we see that it is of the form $0/0$, thus we can apply l'Hopital's rule. This gives us: 
\begin{align}
\lim_{x\to\frac{\pi}{4}}\frac{\cos(2x)}{\cos(x)-\sin(x)}&=\lim_{x\to\pi/4}\frac{-2\sin(2x)}{-\sin(x)-\cos(x)}\\&=\lim_{x\to\pi/4}\frac{2\sin(2x)}{\cos(x)+\sin(x)}\\&=\frac{2}{\sqrt{2}}\\&=\sqrt{2}.
\end{align}
</s>