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
 A: This is an answer without using derivative.
As you did, let $t=\sin x$. 
First of all, we have $y\not=1$ since for $y=1$ we get $t=\frac 32\gt 1$.
Since $y\not=1$, we have
$$\begin{align}y=\frac{t^2+t-1}{t^2-t+2}&\iff  (y-1)t^2+(-y-1)t+2y+1=0\\&\iff t^2+\frac{-y-1}{y-1}t+\frac{2y+1}{y-1}=0\\&\iff \left(t-\frac{y+1}{2y-2}\right)^2+\frac{7y^2-6y-5}{4(y-1)^2}=0\tag1\end{align}$$
Let $g(t)$ be the LHS of $(1)$.
Note that we want to find the condition on $y$ such that $g(t)=0$ has at least one real solution satisfying $-1\le t\le 1$.
Here, $Y=g(t)$ is a parabola whose vertex is $(\alpha,\beta)$ where $\alpha=\frac{y+1}{2y-2},\beta=\frac{7y^2-6y-5}{4(y-1)^2}$.
Case 1 : When $\alpha\lt -1$, we have to have $\beta\lt 0$ and $g(-1)\le 0$ and $g(1)\ge 0$
In this case, we have $\frac 13\lt y\le \frac 12$.
Case 2 : When $\alpha=-1$, we have to have $\beta\le 0$ and $g(1)\ge 0$
In this case, we have $y=\frac 13$.
Case 3 : When $-1\lt\alpha\lt 1$, we have to have $\beta\le 0$ and "$g(-1)\ge 0$ or $g(1)\ge 0$"
In this case, we have $\frac{3-2\sqrt{11}}{7}\le y\lt\frac 13$.
Case 4 : When $\alpha=1$, we have to have $\beta\le 0$ and $g(-1)\ge 0$
There are no such $y$.
Case 5 : When $\alpha\gt 1$, we have to have $\beta\lt 0$ and $g(-1)\ge 0$ and $g(1)\le 0$
There are no such $y$.
Hence, the answer is
$$\color{red}{\frac{3-2\sqrt{11}}{7}\le y\le\frac 12}$$
A: 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.
A: Where DeepSea has left off,  let $2t-3=-u\implies1\le u\le5$
As $u>0,$
$$y=1-\dfrac{4u}{u^2-4u+11}=1-\dfrac4{u+\dfrac{11}u-4}$$
Now $u+\dfrac{11}u=\left(\sqrt u-\sqrt{\dfrac{11}u}\right)^2+2\sqrt{11}\ge2\sqrt{11}$
$\implies\dfrac1{u+\dfrac{11}u-4}\le\dfrac1{2\sqrt{11}-4}=\dfrac{2\sqrt{11}+4}{44-4^2}=\dfrac{\sqrt{11}+2}{14}$
$\implies y=1-\dfrac4{u+\dfrac{11}u-4}\ge1-\dfrac{4(\sqrt{11}+2)}{14}$
Again with $1\le u\le5,$ clearly, $\dfrac u{u^2-4u+11}=\dfrac u{7+(u-2)^2}>0$
Trying to prove $\dfrac u{u^2-4u+11}\ge\dfrac18$
