Range of $f(x) = \frac{\sin^2 x + \sin x - 1}{\sin^2 x - \sin x + 2} $ Here's what I did :
$$\text{Let }\quad y = \frac{\sin^2 x + \sin x - 1}{\sin^2 x - \sin x + 2} $$
$$\text{Let } \sin^2x=t$$
$$\Rightarrow\  (y-1)t^2-(y+1)t+2y+1=0 $$
$$\text{Since } t= \sin x\text{ is real,} $$
$$\text{Discriminant} \geqslant 0 $$
$$ \Rightarrow (y+1)^2-4(y-1)(2y+1) \geqslant 0$$
$$ \Rightarrow\ -7y^2+6y+5 \geqslant 0$$
$$\Rightarrow\  7y^2-6y-5 \leqslant 0$$
$$\Rightarrow \ y\in\left[\frac{3-2\sqrt{11}}{7},\frac{3+2\sqrt{11}}{7}\right] $$
But the correct answer (according to wolfram) is
$$y \in \left[\frac{3-2\sqrt{11}}{7},\frac{1}{2}\right] $$
Please guide me how I should proceed further .

Introducing $t = \sin{x}, t\in [-1, 1]$, gives a new function $y(t) = \frac{t^2+t-1}{t^2-t+2}$, and a task is to find a $\min_{t\in [-1, 1]}y(t)$ and $\max_{t\in [-1, 1]}y(t)$.
1) $y'(t) = \frac{(2t+1)(t^2-t+2) - (2t-1)(t^2-t+2)}{(t^2-t+2)^2} = \frac{-2t^2+8t}{(t^2-t+2)^2} = 0 \Leftrightarrow \left\{\begin{aligned}-2t^2 + 8t &= 0 \\t^2 -t +2 &\ne 0\\\end{aligned}\right. \Leftrightarrow t = 0 \text{ and } t = 4 ( \notin [-1, 1])$
2) 
- $y(0) = -\frac{1}{2}$


*

*$y(-1) = \frac{(-1)^2+(-1)-1}{(-1)^2-(-1) + 2} = \frac{1}{4}$

*$y(1) = \frac{1^2+1-1}{1^2- 1 + 2} = \frac{1}{2}$
range of $y = \left[-\frac{1}{2}, \frac{1}{2}\right]$
