<s>[INST] Find the range of the function $f(x) = \cos(x)[\sin(x) + \sqrt{\sin^2(x) + \frac{1}{2}}]$ 
$f(x) = \cos(x)[\sin(x) + \sqrt{\sin^2(x) + \frac{1}{2}}]$

First of all, I tried to convert $\sqrt{\sin^2(x) + \frac{1}{2}}$ into perfect square, I tried many attempts but  I failed to do so.
Next, I thought of differentiating it, and the find the maxima/minima, but the expression I got after differentiation was pretty horrible
and in the last I thought of a step wise process:

*

*$0 \le \sin^2(x) \le 1$

*$\frac{1}{2} \le \sin^2(x)+\frac{1}{2} \le
   \frac{3}{2}$

*$\sqrt{\frac{1}{2}} \le \sqrt{\sin^2(x)+\frac{1}{2}} \le
   \sqrt{\frac{3}{2}}$
and I was stuck here. Please try to provide hint, rather than full solution. I would like to try it myself.
Thanks in advanced.
 [/INST] $$f(x)-\cos x\sin x=\cos x\sqrt{\frac{1}{2}+\sin^2 x}\Rightarrow
f(x)^2-2f(x)\cos x\sin x=\frac{1}{2}\cos^2 x\Rightarrow\\ 4f(x)\cos x\sin x=2f(x)^2-\cos^2 x\Rightarrow 16f(x)^2\cos^2 x(1-\cos^2 x)=(2f(x)^2-\cos^2 x)^2$$
$$f(x)^2=y,\ \cos^2 x=t:$$
$$16yt(1-t)=(2y-t)^2\Rightarrow 4y^2+(16t^2-20t)y+t^2=0\Rightarrow\\ 8yy'+(16t^2-20t)y'+(32t-20)y+2t=0$$
Here $y'=\frac{dy}{dt}$. In critical points $\frac{df(x)}{dx}=0 \Rightarrow \frac{dy}{dt}=0$
$$(32t-20)y+2t=0\Rightarrow y=-\frac{t}{16t-10} \Rightarrow \frac{4t^2}{(16t-10)^2}-\frac{t(16t^2-20t)}{16t-10}+t^2=0\Rightarrow\\ 4t^2-t(16t^2-20t)(16t-10)+t^2(16t-10)^2=0 \Rightarrow 32t^2(5t-3)=0$$
$t=0$ gives minimum $y=0$. $t=\frac{3}{5}$ gives maximum $y=\frac{3}{2}$.
Minimum $f(x)=-\sqrt{\frac{3}{2}}$ is obtained at $\cos x=-\sqrt{\frac{3}{5}}$, $\sin x=\sqrt{\frac{2}{5}}$.
Maximum $f(x)=\sqrt{\frac{3}{2}}$ is obtained at $\cos x=\sqrt{\frac{3}{5}}$, $\sin x=\sqrt{\frac{2}{5}}$.
</s>