why $\lim_{x \to \frac{\pi}{4}} \frac{\cos 2x}{\sin x-\cos x}=-\sqrt{2}$? I have this very simple limit to find
$$\lim_{x \to \frac{\pi}{4}} \frac{\cos (2x)}{\sin x-\cos x}$$
which is equal to $-\sqrt{2}$. However I can get the outcome as mentioned, or $\sqrt{2}$ in the following way:
$$\lim_{x \to \frac{\pi}{4}} \frac{\cos (2x)}{\sin x-\cos x}=\lim_{x \to \frac{\pi}{4}} \frac{\cos ^2x-\sin^2x}{\sin x-\cos x}=\lim_{x \to \frac{\pi}{4}} \frac{(\cos x-\sin x)(\cos x+\sin x)}{\sin x-\cos x}$$
$$=\lim_{x \to \frac{\pi}{4}} (\sin x+\cos x)=\sin\frac{\pi}{4}+\cos\frac{\pi}{4}=\frac{\sqrt{2}}{2}+\frac{\sqrt{2}}{2}=\sqrt{2}$$
Why the mentioned solution method is wrong?
Is limit outcome dependent on the expression rearrangement?

Note that  $$\cos x-\sin x\not=\sin x-\cos x.$$ 
We have
$$\frac{(\cos x-\sin x)(\cos x+\sin x)}{\sin x-\cos x}=\frac{-(\color{red}{\sin x-\cos x})(\cos x+\sin x)}{\color{red}{\sin x-\cos x}}$$
