<s>[INST] Derivative of a trigonometric function $\arctan$ Will someone help me explain this example please? 

$$y=\arctan \dfrac{\sqrt{1-\cos (x)}}{\sqrt{1+\cos (x)} }$$

Solution:
$$\sin^2 (x/2)=\dfrac{1-\cos (x)}{2}\Rightarrow \sqrt{2}\sin (x/2)=\sqrt{1-\cos (x)}$$
$$\cos^2 (x/2)=\dfrac{1+\cos (x)}{2}\Rightarrow \sqrt{2} \cos (x/2)=\sqrt{1+\cos (x)}$$
$$y=\arctan\dfrac{\sqrt{1-\cos (x)}}{\sqrt{1+\cos (x)}}=\arctan\dfrac{\sin (x/2)}{\cos (x/2)}=\arctan (\tan (x/2))=\dfrac{x}{2}$$
$$y=\dfrac{x}{2}\rightarrow \dfrac{dy}{dx}=\dfrac{1}{2}$$
 [/INST] Without the preliminary simplifications.
Let $$y=\tan^{-1}(u) \qquad \text{with} \qquad u=\dfrac{\sqrt{1-\cos (x)}}{\sqrt{1+\cos (x)} } $$
$$\frac{dy}{dx}=\frac 1 {1+u^2}\frac{du}{dx}=\cos ^2\left(\frac{x}{2}\right)\,\frac{du}{dx}$$ Now $$\log(u)=\frac 12 \log(1-\cos(x))-\frac 12 \log(1+\cos(x))$$ Differentiate both sides
$$\frac{du}u=\frac{1}{2} \left(\frac{\sin (x)}{1-\cos (x)}+\frac{\sin (x)}{1+\cos (x)}\right)\,dx=\csc (x)\,dx\implies \frac{du}{dx}=\csc (x)\dfrac{\sqrt{1-\cos (x)}}{\sqrt{1+\cos (x)} }$$ Now, we make the simplifcation to get
$$\frac{du}{dx}=\sqrt{\tan ^2\left(\frac{x}{2}\right)} \csc (x)\implies \frac{dy}{dx}=\frac{1}{2} \frac{\sqrt{\tan ^2\left(\frac{x}{2}\right)}}{ \tan \left(\frac{x}{2}\right)}$$ and you see the problem related to the sign of $\tan \left(\frac{x}{2}\right)$
</s>