The range of the function $f(x)=\frac{\sin x}{\sqrt{1+\tan^2x}}-\frac{\cos x}{\sqrt{1+\cot^2x}}$ Find the range of the function $f(x)=\frac{\sin x}{\sqrt{1+\tan^2x}}-\frac{\cos x}{\sqrt{1+\cot^2x}}$.
By simply looking at the problem and simplifying trigonometrically,it looks as if range is zero but not.I think there is some trick to solve this.I am perplexed.I tried to find the domain first but not successful.Please help....

Using $\displaystyle |\sin x|=\left\{\begin{matrix}
\displaystyle \sin x \;,& \displaystyle 0 \leq x\leq \frac{\pi}{2} \\\\ 
\displaystyle \sin x \;,& \displaystyle \frac{\pi}{2} \leq x\leq \pi \\\\ 
 \displaystyle -\sin x\;, & \displaystyle\pi \leq x\leq \frac{3\pi}{2} \\\\ 
 \displaystyle -\sin x \;,& \displaystyle\frac{3\pi}{2} \leq x\leq 2\pi
\end{matrix}\right.$ and $\displaystyle |\cos x|=\left\{\begin{matrix}
\displaystyle \cos x \;,& \displaystyle 0 \leq x\leq \frac{\pi}{2} \\\\ 
\displaystyle -\cos x \;,& \displaystyle \frac{\pi}{2} \leq x\leq \pi \\\\ 
 \displaystyle -\cos x \;,& \displaystyle\pi \leq x\leq \frac{3\pi}{2} \\\\ 
 \displaystyle \cos x \;,& \displaystyle\frac{3\pi}{2} \leq x\leq 2\pi
\end{matrix}\right.$ 
So $$\displaystyle f(x)=\frac{\sin x}{\sqrt{1+\tan^2x}}-\frac{\cos x}{\sqrt{1+\cot^2x}} = \sin x\cdot \left|\cos x\right|-\cos x\cdot \left|\sin x\right|$$
Here Function $f(x)$ is Periodic With Time Period $= 2\pi.$
So we will Calculate for Only one Time Period.
In $\bullet \displaystyle \; 0 \leq x\leq \frac{\pi}{2}\;,$ We get $f(x) = \sin  x\cdot \cos x-\cos x\cdot \sin x = 0$
In $\bullet \displaystyle \; \frac{\pi}{2} \leq x\leq \pi\;,$ We get $f(x)=-\sin 2x .$ So $0 \leq f(x)\leq 1$ 
In $\bullet \displaystyle \; \pi \leq x\leq \frac{3\pi}{2}\;,$ We get $f(x)=0 .$
In $\bullet \displaystyle \; \frac{3\pi}{2} \leq x\leq 2\pi\;,$ We get $f(x)=\sin 2x .$ So $-1 \leq f(x)\leq 0$
So Here We get $\displaystyle -1 \leq f(x)\leq 1$   
