# Finding out the range of $g(x)=\sin x + \cos x$

If $x$ is such that $$\lfloor2\sin x\rfloor+\lfloor{\cos x}\rfloor=-3$$ for some $x \in [0,25]$ then the question is to find out the range of the function $$g(x)=\sin x+\cos x$$Here the function $g(x)$ assumes those values of $x$ which satisfies the above equation in the given interval

$\lfloor.\rfloor$ represents greatest integer function.

I tried rewriting the equation as $$2 \sin x+\cos x -2\lbrace(\sin x)\rbrace-\lbrace(\cos x)\rbrace=-3$$ which can be rewritten as $$g(x)=-3+2\lbrace(\sin x)\rbrace+\lbrace(\cos x)\rbrace-\sin x$$ I again rewrote it as $$g(x)=-3-\lfloor\sin x\rfloor+\lbrace(\sin x)\rbrace+\lbrace(\cos x)\rbrace$$ $\lfloor\sin x\rfloor=\lbrace 0,-1 \rbrace$.I tried to further find out the range of this but failed.Any ideas?Thanks.

Here $\lbrace.\rbrace$ represents fractional part.

• Your first sentence "If $x$ is such that ... for some $x$ ... then the question is to find the range of the function $g(x)=\ldots$" makes no sense at all. Either $x$ is fixed, or it it quantified (some $x$), you cannot have both. And besides $x$ is a dummy variable in the definition of $g$, so the statement the question is about does not involve $x$ at all anyway. Mar 31, 2017 at 6:25
• @MarcvanLeeuwen It is some $x$ in the interval which satisfies the equation. Mar 31, 2017 at 6:27
• @MarcvanLeeuwen suppose $x=5,6,7$ satisfies the equation.Then the question is all about finding out the range of values $g(x)$ takes with these values Mar 31, 2017 at 6:37
• Hint: the first equation implies $\lfloor 2 \sin x \rfloor = -2\,$, $\lfloor \cos x \rfloor = -1\,$. Solve that to get the eligible intervals for $x\,$, then work out the range of $g$ for $x$ in those intervals.
– dxiv
Mar 31, 2017 at 6:37
• @MarcvanLeeuwen I know that somewhere the values of x satisfying the equation is not discrete but lies on an interval and so the question is to find out the interval in the given interval which satisfies the equation and hence the range of $g(x)$ with that interval. Mar 31, 2017 at 6:38

## 3 Answers

Note that $\lfloor \cos x \rfloor$ only takes values $-1,0,1$.

Let $S = \{x \in [0,2 \pi] | \lfloor \cos x \rfloor + \lfloor 2\sin x \rfloor = -3 \}$.

If $\lfloor \cos x \rfloor = 0$, then we would need to have $\lfloor 2\sin x \rfloor = -3$ which is impossible.

If $\lfloor \cos x \rfloor = 1$, then we would need to have $\lfloor 2\sin x \rfloor = -4$ which is impossible.

Hence we must have $\lfloor \cos x \rfloor =-1$ and so

If $\lfloor \cos x \rfloor =-1$, then we must have $\lfloor 2\sin x \rfloor = -2$, and hence $x \in ({7 \over 6} \pi, {9 \over 6} \pi)$.

Hence $S = ({7 \over 6} \pi, {9 \over 6} \pi)$.

We note that $g$ has a (global) $\min$ at $x={5 \over 4} \pi$, and $g({5 \over 4} \pi) = -\sqrt{2}$.

Since $g$ is unimodal in $S$, we see that $g(S) = [-\sqrt{2}, -1)$ (since $\max(g({7 \over 6} \pi), g({9 \over 6} \pi)) = -1$).

• This is wrong. You confuse the solution set of $\left\lfloor \cos x\right\rfloor = -1$ with that of $\cos x = -1$.
– J.G.
Mar 31, 2017 at 6:46
• @J.G.: Thanks for catching that. Mar 31, 2017 at 6:47
• This site is becoming more & more like SO everyday. Mar 31, 2017 at 7:19
• Stack Overflow?
– J.G.
Mar 31, 2017 at 8:54

Considering functions' periods, without loss of generality we can restrict to $x\in\left[ 0,\,2\pi\right)$.

The first insight you missed is that each integer part in the problem statement must minimise its value to achieve $-3$. We can then restate the constraint as $\sin x\in\left[ -1,\,-\frac{1}{2}\right),\,\cos x\in\left[ -\frac{\sqrt{3}}{2},\,0\right)$, the latter result tightened with $\sin^2 x+\cos^2 x=1$. The range of "legal" values is $S:=\left(\frac{7\pi}{6},\,\frac{3\pi}{2}\right)$.

The second insight you need is a restatement of the function we wish to extremise. We seek the range of $\sqrt{2}\sin\left( x+\frac{\pi}{4} \right)$ on $S$. We reach a minimum of $-\sqrt{2}$ at $x=\frac{5\pi}{4}$ and a supremum of $-1$ at $x=\frac{3\pi}{2}$ (since $\sin\frac{7\pi}{4}=-\frac{1}{\sqrt{2}}$), which is technically outside $S$. The range is thus $\left[ -\sqrt{2},\,-1\right)$.

Hint: Here is a visualization.

The red lines are the graph of $f(x) = \lfloor2\sin x\rfloor+\lfloor{\cos x}\rfloor$. The blue line is $h(x) = -3$. And the green line is $g(x) = \sin x+\cos x$.

The $x$ coordinates of the intersection of the graphs of $f$ and $h$, intersected with $[0,25]$ will determine a set $A$ of $x$ values. What you seek is $g(A)$.