How to simpify $\cos x - \sin x$ 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? 
 A: It's the magic of $$\sin\left(\frac\pi4\right)=\cos\left(\frac\pi4\right)=\frac{1}{\sqrt2}$$
$$\cos x - \sin x=\sqrt2\left[\frac{\cos x-\sin x}{\sqrt2} \right]=\sqrt2\left[\frac{1}{\sqrt2}\cos x - \frac{1}{\sqrt2}\sin x\right]$$
Now use 

$$\sin(a-b)=\sin a\cos b-\cos a\sin b$$ with using $b=x$ and $a=\dfrac\pi4$

A: $$
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
A: A rather remarkable identity is that, for any $\alpha$ and $\beta$, we can find a $\theta$ and $c$ such that:
$$\alpha\sin(x)+\beta\cos(x)=c\sin(x+\theta).$$
To show this, we can expand the right-hand side by the angle-sum identity for sine:
$$\alpha\sin(x)+\beta\cos(x)=c\sin(x)\cos(\theta)+c\cos(x)\sin(\theta)$$
and if we group coefficients of $\sin$ and $\cos$ together, we get
$$\alpha = c\cos(\theta)$$
$$\beta = c\sin(\theta)$$
which has a really nice intuitive interpretation: the point $(\alpha,\beta)$ is equal to $(c,\theta)$ in polar coordinates. In particular, we can find $c$ and $\theta$ by algebraic means. Firstly, square both the above equations and add the results. This gives
$$\alpha^2+\beta^2=c^2(\cos(\theta)^2+\sin(\theta)^2)=c^2$$
so $c=\sqrt{\alpha^2+\beta^2}$. Then, if we take the ratio of the two equations, we get
$$\frac{\beta}{\alpha}=\tan(\theta)$$
$$\theta=\tan^{-1}\left(\frac{\beta}{\alpha}\right)$$
(though we have to be careful since $\tan$ is periodic in $\pi$ - we need to ensure that we don't get the wrong inverse tangent, which is why I include the interpretation that $\theta$ is the angle to $(\alpha,\beta)$ from the $x$-axis).
Putting things back together, this gives
$$\alpha\sin(x)+\beta\cos(x)=\sqrt{\alpha^2+\beta^2}\sin\left(x+\tan^{-1}\left(\frac{\beta}{\alpha}\right)\right)$$
and plugging in $\alpha=1$ and $\beta=-1$ gives the identity you found.
A: The reason that it seems like it's hard to simplify this is because it is already in arguably the most simple form. 
cosx-sin is just what it is
if this was cosx-tanx you could do something like this:
cosx- ((sinx)/(cosx))
(((cosx)^2)/(cosx))-((sinx)/(cosx))
(((cosx)^2)-sinx)/(cosx)
but with what you have, you cannot do something like this. 
