6

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?

Aditya Hase
  • 8,851

4 Answers4

14

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.

Milo Brandt
  • 60,888
4

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$

Aditya Hase
  • 8,851
3

$$ 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

David Holden
  • 18,040
1

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.

  • 1
    It's not the most simple form if you need to calculate it because it requires two sine/cosine calculations, whereas the "simplified" form is just one sine calculation. – Suzu Hirose Nov 26 '14 at 02:06
  • quite right, "simplest" depends on context. for example the maximum and minimum can be read off directly from the form $\sqrt{2}\sin(\frac{\pi}4-x)$. an even more basic example comes from the representation of integers. is the binary form simpler than the decimal form? or again, if you want the highest common factor of two numbers then it is easy if they are given as, say, $2^3 3^3 5^4$ and $2^4 3^2 5^3$, but if you want their difference it is easier with the decimal representations $135000$ and $18000$ – David Holden Nov 26 '14 at 02:26