Show that $\displaystyle sin^2x + \frac{1}{2}cos x = \frac{17}{16}-(\cos x-\frac{1}{4})^2 $

I can do this part .

Hence , state the range

$\displaystyle \frac{1}{2\sin^2 x+\cos x-1}$ for $\displaystyle 0\leq x\leq 2\pi$

Need help with this part . Thanks .