A question I'm attempting is:
Find the derivative of $ y = \sqrt {1 - \sin x} ; 0 < x <\pi/2$.
I did this: $y = \sqrt {1 - \sin x} = \sqrt {\cos^2\frac{x}{2} + \sin^2\frac{x}{2} - 2\sin \frac{x}{2}\cos \frac{x}{2}} = \sqrt { (\sin \frac{x}{2}-\cos \frac{x}{2})^2} = \sin \frac{x}{2} - \cos \frac{x}{2}$
So, $\frac{dy}{dx} = \frac{1}{2} \cdot (\cos\frac{x}{2} + \sin\frac{x}{2})$.
But apparently this is wrong. The correct solution is: $\frac{dy}{dx} = -\frac{1}{2}\cdot(\cos\frac{x}{2} + \sin\frac{x}{2})$.
So I want to know what I have done wrongly here. Why is my answer not right?
Hint: $y = |\sin(x/2)-\cos(x/2)|$ and $|\sin(x/2)-\cos(x/2)|=\color{red}{-}(\sin(x/2)-\cos(x/2))$ for $0 \le x \le \pi/2$.