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 .
 A: We substitute rather $s=\sin x$ and have to find the image of the help function $h:I:=[-1,1]\to \Bbb R$,
$$
h(s)
= \frac {s^2+s-1}{s^2-s+2}
= 1+\frac {2s-3}{s^2-s+2}
\ .
$$
The denominator does not vanish (on $I=[-1,1]$). We compute the extremal points of $h$ on $I$.  We have (using the second formula for $h$ or a CAS like mathematica or sage)
$$
h'(s)
=
-\frac
{2s^2 - 6s - 1}{(s^2 - s + 2)^2}
\ .
$$
The equation $h(s)=0$ has two solutions, $\frac 12(3\pm{\sqrt{3^2+2}})$, among them only 
$$a:=\frac 12(3-\sqrt {11})$$ is in $I$, the interval of definition of $h$.
The sign of $h'$ is minus on $[-1,a)$ and plus on $(a,1]$. So $h$ is decreasing on the first interval, then increasing on the second one. 


*

*The minimal value of $h$ is thus $h(a)=\frac 17(3-2\sqrt{11})$. 

*The maximal value is either $h(-1)$ or $h(1)$, the bigger of them. We compute $h(-1)=-\frac 14$ and $h(1)=\frac 12$. So the absolute maximum is $\frac 12$.



Later EDIT: There is a question in the comments about getting the value for $h(a)$, since i need some more space, the details are added to the answer. The above computations were supported by computer, else the answer would not have been there in time. I was using sage, here are some pieces of code that support the above computations. Just a small comment on the choice of the CAS, sage is free (including access to the deepest piece of code), and supporting mathematical computations in a structural way. To get the factorization for $h'$, it is enough to ask for...
sage: var('s');
sage: h(s) = (s^2 + s - 1) / (s^2 - s + 2)
sage: diff( h(s), s ).factor()
-(2*s^2 - 6*s - 1)/(s^2 - s + 2)^2

The roots of the numerator can be computed with bare hands or with a CAS, so the root $a=(3-w)/2$, $w:=\sqrt{11}$, is the root we need. Let us compute now $h(a)$. 
sage: def h(s):    return (s^2 + s -1) / (s^2 - s +2)
sage: # we nee above h to be a true function, rather than an expression
sage: K.<w> = QuadraticField(11)    # so w is the sqrt of 11...
sage: a = (3-w)/2
sage: h(a)
-2/7*w + 3/7

A: $$y-1=\dfrac{2t-3}{t^2-t+2}$$
Let $z=3-2t\implies5\ge z\ge1$
$$\dfrac4{1-y}+4=4+\dfrac {z^2-4z+11}z=z+\dfrac{11}z\ge2\sqrt{z\cdot\dfrac{11}z}$$ which is attained if $z^2=11$
$$y\ge?$$
Now for $5\ge a>b\ge1,$
$$a+11/a-(b+11/b)=\dfrac{(a+b-11)(a-b)}{ab}<0$$
So, $z+\dfrac{11}z$ will be maximum for the the minimum value of $z$ which is $=1$ here
Can you take it from here?
A: Note that to find the maximum value of the range you can just simply reason as follows: 
Max($\sin^2(x)) = 1$ = Max($\sin(x)$). Hence the max is
$$y_{\text{max}} = \frac{1+1-1}{1-1+2} = \frac{1}{2}$$
A: 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]$
