# Show that $|\sin x−\cos x|≤ 2$ for all $x.$ [closed]

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.

## closed as off-topic by José Carlos Santos, Arnaud D., Guy Fsone, Brian Borchers, dawNov 9 '17 at 17:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – José Carlos Santos, Arnaud D., Guy Fsone, Brian Borchers, daw
If this question can be reworded to fit the rules in the help center, please edit the question.

• Here's a better problem: prove that $|\sin x-\cos x|\le\sqrt2$ for all $x$. – Lord Shark the Unknown Nov 9 '17 at 6:55
• Have you heard of the triangle inequality? – luthien Nov 9 '17 at 6:56
• Nope haven't heard of it. – hel Nov 9 '17 at 7:02
• The triangle inequality states that $|a+b| \leq |a|+|b|$. In this case you can treat $\sin(x)$ as $a$ and $-\cos(x)$ as $b$. Then consider the range of $\cos(x)$ and $\sin(x)$. What are the maximum values that they can take? – luthien Nov 9 '17 at 7:04
• @hel Start with right triangle having sides $1,\cos x, \sin x$ – Narasimham Nov 9 '17 at 17:31

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

Notice that $\sin (x)$ and $\cos (x)$ are bounded by $1$, and use Triangle Inequality. Therefore you will get the wanted result

If you do not know where to start then ...start from determining the range of values $\sin x$ and $\cos x$ can take.

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.

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

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.

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.]

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