If I want to calculate range of $$f(x)=\sin(x) - \cos(x) $$

Watching solution I got to know that we have to change this in a single trigonometric ratio (that is whole equation in form of sine or cosine) And then range will be $[-\sqrt2,\sqrt2]$

But my doubt is that why can't we use method like below

As we know $$ -1\le \sin(x) \le1$$ $$ -1\le \cos(x) \le1$$

Then $$ -2 \le \sin(x) - \cos(x) \le 2$$ But it is wrong

I want explaination that why using this method I am getting wrong

  • $\begingroup$ MathJax hint: if you put a backslash before common functions you get the right font and spacing, so \sin x gives $\sin x$ instead of sin x giving $sin x$ $\endgroup$ Commented Jan 17, 2023 at 4:27
  • 1
    $\begingroup$ Hi: the range is a circle so sin(x) and cos(x) are not independent. you are assuming that the values are independent which is not the case. For example, sin(x) and cos(x) can't both be -1. $\endgroup$
    – mark leeds
    Commented Jan 17, 2023 at 4:31
  • $\begingroup$ Because when $\sin x=1,$ $\cos x=0.$ Certainly, the range is a subset of $[-2,2],$ but the maximum and minimum are when $\sin(x)+\cos(x)=0$ and thus the actual range is $[-\sqrt2,\sqrt2].$ $\endgroup$ Commented Jan 17, 2023 at 4:32
  • $\begingroup$ Are you familiar with any calculus? If so you can find the range by setting the derivative to 0 and solving for $x$, then calculating the values at those points. $\endgroup$ Commented Jan 17, 2023 at 4:32
  • $\begingroup$ @moboDawn_φ actually I have not started calculus but I know some basic formulas $\endgroup$ Commented Jan 17, 2023 at 4:49

2 Answers 2


Your statement and the logic leading to $-2 \le \sin x - \cos x \le 2$ are correct. The error is assuming that the outer bounds cannot be compressed, that the range of $\sin x - \cos x$ is all the way from $-2$ to $2$. There is no $x$ where $\sin x=1$ and simultaneously $\cos x=-1$, so the difference cannot attain $2$ and similarly for $-2$

  • $\begingroup$ Yes you are right. I wonder even after listening that in class I am doing this type of mistakes. Thank you one more time! $\endgroup$ Commented Jan 17, 2023 at 4:50

Here is a way to derive the real bounds of $\sin x - \cos x.$ Using some basic physics knowledge, we can see that adding two states of simple harmonic motion gives another state of simple harmonic motion, so adding (or subtracting) two sine waves gives another sine wave. (Don't worry if you didn't get the physics. The point that I'm trying to make is that we can easily guess that it is a sine wave.) We can start by attempting to write it as $c\sin(x+y)$ for fixed $y.$ Since $\sin(x+y) = \sin x \cos y + \cos x \sin y, c\sin(x+y) = c\sin x \cos y + c\cos x \sin y.$ We would therefore try to make the first term of this new expression match $\sin x$ and the second term match $\cos x.$ Therefore, $c \cos y = 1$ and $c \sin y = -1.$ Therefore, $-1 =\frac{\sin y}{\cos y} = \tan y.$ We can easily take an inverse tangent to get that we can set $y = -\pi/4.$ Evaluating $c$ by using $c \cos y = 1$ gives $c = \sqrt{2}.$ This is the amplitude of our sine wave, so the bounds would be $[-\sqrt{2},\sqrt{2}].$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .