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 \;,&amp; \displaystyle 0 \leq x\leq \frac{\pi}{2} \\\\ 
\displaystyle \sin x \;,&amp; \displaystyle \frac{\pi}{2} \leq x\leq \pi \\\\ 
 \displaystyle -\sin x\;, &amp; \displaystyle\pi \leq x\leq \frac{3\pi}{2} \\\\ 
 \displaystyle -\sin x \;,&amp; \displaystyle\frac{3\pi}{2} \leq x\leq 2\pi
\end{matrix}\right.$ and $\displaystyle |\cos x|=\left\{\begin{matrix}
\displaystyle \cos x \;,&amp; \displaystyle 0 \leq x\leq \frac{\pi}{2} \\\\ 
\displaystyle -\cos x \;,&amp; \displaystyle \frac{\pi}{2} \leq x\leq \pi \\\\ 
 \displaystyle -\cos x \;,&amp; \displaystyle\pi \leq x\leq \frac{3\pi}{2} \\\\ 
 \displaystyle \cos x \;,&amp; \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$
if sinx>=0 and cosx>=0 : f(x)=0
if sinx>=0 and cosx&lt;=0 (90&lt;=x&lt;=180) : f(x)=-2sinx.cosx=-sin(2x)  

180&lt;=2x&lt;=360 :   -1&lt;=sin(2x)&lt;=0  :     0&lt;=-sin(2x)&lt;=1   :   0&lt;=f(x)&lt;=1

if sinx&lt;0 and cosx&lt;0 : f(x)=0

if sinx&lt;=0 and cosx>=0 : (-90&lt;=x&lt;=0) : f(x)=2sinx.cosx=sin(2x) 

-180&lt;=2x&lt;=0 :  -1&lt;=sin2x&lt;=0 :   -1&lt;=f(x)&lt;=0

So -1&lt;=f(x)&lt;=1