<s>[INST] Function range problem $(sin^2\theta  +\sin\theta -1)/(sin^2\theta -\sin\theta+ 2)$ .
It is asked to find the range of this function.
Here i was assumed a variable 
$z=sin\theta$ so that i get
$-1<=z<=1 $
and then i obtained a quadratic equation as :-
$(y-1)z^2 -(y+1)z + 2y +1 =0$  from here i need some help or if there's some other way for this  problem that might also help. Thanks!
 [/INST] Let $f(x)=\frac{\sin^2 x+\sin x-1}{\sin^2 x-\sin x+2}$
Then $g(z):=f(\sin^{-1} z)=\frac{z^2+z-1}{z^2-z+2}$ $$g'(x)=\frac{(2x+1)(x^2-x+2)-(2x-1)(x^2+x-1)}{(x^2-x+2)^2}=\frac{-2x^2+6x+1}{(x^2-x+2)^2}$$
In order to find maxima and minima, set $g'(x)=0$: $-2x^2+6x+1=0$.  Thus $x=\frac{3\pm\sqrt{11}}{2}$.  Note that $\frac{3+\sqrt{11}}{2}>1$ and is not an element of the domain.
You should be able to finish the thought process.
</s>