TITLE: How to simpify $\cos x - \sin x$
QUESTION [6 upvotes]: How does one simplify 

$$\cos x - \sin x$$ 

I tried multiplying by $\cos x + \sin x$, but that just gets me $$\cos x - \sin x = \frac{\cos 2x}{\cos x + \sin x}$$ which is worse. 
Yet wolframalpha gives me $\cos x - \sin x = \sqrt{2}\sin\left(\dfrac{\pi}{4}-x\right)$. How does one obtain this algebraically?

REPLY [3 votes]: $$
s = \cos x - \sin x \\
s^2 = \cos^2 x - 2 \cos x \sin x + \sin^2 x = 1 - \sin 2x \\
= 1 - \cos (\frac{\pi}2 -2 x)\\
= 1 - \left(1 - 2 \sin^2(\frac{\pi}4 - x)\right)\\
=2 \sin^2(\frac{\pi}4 - x)
$$
so
$$
s = \pm \sqrt{2} \sin(\frac{\pi}4 - x)
$$
and evaluating at $x=0$ shows that the positive sign must be taken