Show that $|\sin x−\cos x|≤ 2$ for all $x.$ Please help me out in answering this:
Show that $|\sin x−\cos x|≤ 2$ for all $x.$
I don't know where to start and I think we have to use the mean value theorem to show this.
 A: We will use the fact for all $x \in \mathbb{R}$, $|\sin x|, |\cos x| \le 1$.
Method 1 - Triangle inequality ( $|a + b| \le |a| + |b|$ for all $a, b \in \mathbb{R}$)
$$|\sin(x) - \cos(x)| \le |\sin(x)| + |\cos(x)| \le 1 + 1 = 2$$
Method 2 - difference formula for sine ( $\sin(\theta-\phi) = \sin\theta\cos\phi - \cos\theta\sin\phi$ for all $\theta, \phi \in \mathbb{R}$).
$$|\sin(x)-\cos(x)| = \sqrt{2}\left|\sin(x)\cos\frac{\pi}{4} -\cos(x)\sin\frac{\pi}{4}\right| = \sqrt{2}\left|\sin\left(x - \frac{\pi}{4}\right)\right| \le \sqrt{2} < 2$$
A: Notice that $\sin (x)$ and $\cos (x)$ are bounded by $1$, and use Triangle Inequality. Therefore you will get the wanted result
A: If you do not know where to start then ...start from determining the range of values $\sin x$ and $\cos x$ can take.
A: Guide:
$$-1 \leq \sin(x) \leq 1$$
$$-1 \leq \cos(x) \leq 1$$


*

*Work out the range that $-\cos(x)$ can take. 

*Work out the range that $\sin(x) - \cos(x)$ can take. 

*Work out the range that $|\sin(x) - \cos(x)|$ can take.

A: Note: 
$$|\sin x-\cos x|\le 2 \iff -2\le \sin x-\cos x\le 2 \iff$$
$$-2+\cos x\le \sin x\le 2+\cos x \iff $$
$$-2+\cos x\le -1\le \sin x\le 1\le 2+\cos x.$$
A: I have another method for you if you want to use some straight-up calculus optimization. Let us first determine the extrema of $\sin(x)-\cos(x)$. To do this, we take the derivative and set it equal to $0$. In this case, the derivative is $\cos(x) +\sin(x)$, so we want to solve $\cos(x) + \sin(x) = 0$, or $\cos(x) = -\sin(x)$. 
So when are $\sin(x)$ and $\cos(x)$ negatives of each other? This occurs precisely when $x = \frac{3\pi}{4}$ or $x= -\frac{\pi}{4}$. This means our extrema are at these values of $x$.
Let's now classify these extrema. First plug in $x = \frac{3\pi}{4}$ to $\sin(x)-\cos(x)$:
$$\sin\bigg(\frac{3\pi}{4}\bigg) -\cos\bigg(\frac{\pi}{4}\bigg) = \frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{2} = \sqrt{2}.$$
Now plug in $x= -\frac{\pi}{4}$:
$$\sin\bigg(-\frac{\pi}{4}\bigg) -\cos\bigg(-\frac{\pi}{4}\bigg) = -\frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2} = -\sqrt{2}.$$
Thus, we have found that $\sqrt{2}$ is a maxiumum of $\sin(x) -\cos(x)$ and $-\sqrt{2}$ is a minimum. That is to say
$$ -\sqrt{2} \leq \sin(x) -\cos(x) \leq \sqrt{2},$$
for all $x$. But by the definition of the absolute value, this means that
$$ |\sin(x) -\cos(x)| \leq \sqrt{2},$$
and $\sqrt{2} < 2$, so we have
$$ |\sin(x) -\cos(x)| \leq \sqrt{2} < 2.$$
And then we are done.
A: The mean value theorem also works, since 
$$
\sin(x+\pi/2)-\sin x=-\frac{\pi}{2}\cos\xi,
$$
where $\xi\in(x,x+\pi/2)$.  It follows that $|\cos x-\sin x|\le \pi/2$.  [This is, of course, not as sharp as achille hui's approach.]
A: We have better inequality Since $|\cos a|\le 1$ and 
$$ \sqrt 2 (\cos(x+\frac{\pi}{4})) =\sqrt 2 (\cos x\cos\frac\pi4-\sin x\sin\frac\pi4)  =\sin x -\cos y .$$
we have, 
$$\color{blue}{|\sin x -\cos y|  =\sqrt 2|\cos(x+\frac{\pi}{4})|\le\sqrt2<2.}$$
