<s>[INST] If $ f(x) = \frac{\sin^2 x+\sin x-1}{\sin^2 x-\sin x+2},$ then value of $f(x)$ lies in the interval If $\displaystyle f(x) = \frac{\sin^2 x+\sin x-1}{\sin^2 x-\sin x+2},$ then value of $f(x)$ lies in the interval
assume $\sin x= t$ where $|\sin x|\leq 1$
let $\displaystyle y = \frac{t^2+t-1}{t^2-t+1}$
$\displaystyle yt^2-yt+y=t^2+t-1$
$(y-1)t^2-(y+1)t+(y-1)=0$
for real roots $(y+1)^2-4(y-1)^2\geq 0$ or $(y+1)^2-(2y-2)^2\geq0$
$(3y-3)(3y-1)\leq 0$ or $\displaystyle \frac{1}{3}\leq y\leq 1$ 
but walframalpha shows different answer
https://www.wolframalpha.com/input/?i=range+of+f(x)+%3D+%5Cfrac%7B%5Csin%5E2+x%2B%5Csin+x-1%7D%7B%5Csin%5E2+x-%5Csin+x%2B2%7D
could some help me with this, thanks
 [/INST] hint: $y = 1+\dfrac{2t-3}{t^2-t+2}, -1 \le t \le 1, $ and proceed to find critical values of $t$ for $y'(t) = 0$. Then consider the values of $y$ at $\pm 1$, and those of critical values of $t$ above.
</s>