# Which differential coefficient is correct and why?

Given $$\cot{\theta} = \frac{\sqrt{1+\sin(x)}+\sqrt{1-\sin(x)}}{\sqrt{1+\sin(x)}-\sqrt{1-\sin(x)}}$$ I have to find its differential coefficient w.r.t $x$ i.e. $\dfrac{d \theta }{dx}$.

Now I can find it in the following two ways:

(1). When I write $\sqrt{1-\sin(x)}=\cos(x/2)-\sin(x/2)$, I get $$\cot(\theta) = \frac{\cos(x/2) + \sin(x/2) + \cos(x/2) - \sin(x/2)}{\cos(x/2) + \sin(x/2) - \cos(x/2) + \sin(x/2)} = \cot(x/2)$$ $$\theta=x/2 \implies \frac{d \theta}{dx} = \frac12$$

(2). When I write $\sqrt{1-\sin(x)}=\sin(x/2)-\cos(x/2)$, I get $$\cot(\theta) = \frac{\cos(x/2) + \sin(x/2) - \cos(x/2) + \sin(x/2)}{\cos(x/2) + \sin(x/2) + \cos(x/2) - \sin(x/2)} = \tan(x/2)$$ $$\theta=\pi/2 - x/2 \implies \frac{d \theta}{dx} = -\frac12$$ Which of the above two answers is correct and why? Please help me know it. Thanks.

-
Dear Sanjeev Verma, welcome to math stackexchange. Kindly refer here (meta.math.stackexchange.com/questions/107/…) on how to typeset (i.e. how to write equations etc) the question. Currently, it is very hard to read what you have typed out. – user17762 May 20 '12 at 5:41
Very well done @Marvis. – Gigili May 20 '12 at 6:00
Thanks @Gigili. – user17762 May 20 '12 at 6:15
thank you very much Marvis for your help and also for giving the above link – Sanjeev Verma May 20 '12 at 8:36

Neither. When you deal in half-angle formulas, you have to be careful about sign.

Notice that $\sqrt{1-\sin x}$ is always positive, while $\sin (x/2)-\cos(x/2)$ and $\cos(x/2)-\sin(x/2)$ may be positive or negative depending on $x$. The correct statement is $\sqrt{1-\sin x}=|\cos(x/2)-\sin(x/2)|$; from there, you'll need to do some case analysis to compute the derivative you want.

-
Thanks for your answer Micah – Sanjeev Verma May 20 '12 at 8:23

\begin{align} \frac{\sqrt{1+\sin(x)}+\sqrt{1-\sin(x)}}{\sqrt{1+\sin(x)}-\sqrt{1-\sin(x)}}\cdot\frac{\sqrt{1+\sin(x)}+\sqrt{1-\sin(x)}}{\sqrt{1+\sin(x)}+\sqrt{1-\sin(x)}}&=\frac{2+2\sqrt{1-\sin^2(x)}}{2\sin(x)}\\ \cot(\theta)&=\frac{1+|\cos(x)|}{\sin(x)} \end{align}
Now the chain rule, quotient rule, and the derivative of $|x|$ (which is $|x|/x$) will give you $\frac{d\theta}{dx}$ in terms of $x$ and $\csc^2(\theta)$ without dealing with any more square roots or half-angle formulas. If you like, $\csc^2(\theta)$ can be subbed out for $1+\cot^2(\theta)$, which can be written in terms of $x$ alone.