What's the mistake in $\sin(\frac{a}{2})=\pm\sqrt{\frac{1\pm \cos(a)}{2}}$? When I was encountered with the formula of $\sin(\frac{a}{2})$, I tried to derive it. First, I tried from the formula of $\cos(2a)$ and I successfully did that but after a while I was curious about if that can be derived from sine's double angle formula and for which I came up with the equation above in the title, totally wrong, as that is kind of combination of sine's and cosine's half angle formula. Here is the derivation:-
$$\sin(2a)=2\sin(a)\cos(a)$$ 
or, $$\sin(a)=2\sin(\frac{a}{2})\cos(\frac{a}{2}) $$
or, $$\sin^2(a)=4\sin^2(\frac{a}{2})(1-\sin^2(\frac{a}{2})) $$
or, $$\sin^4(\frac{a}{2})-\sin^2(\frac{a}{2})=-\frac{\sin^2(a)}{4}$$
which by completing the square or by applying quadratic formula I got:-
$$\sin^2(\frac{a}{2})= \frac{1\pm \sqrt{1- \sin^2(a)}}{2}$$
or, $$\sin^2(\frac{a}{2})=\frac{1\pm \cos(a)}{2}$$ 
or, $$\sin(\frac{a}{2})=\pm \sqrt{\frac{1\pm \cos(a)}{2}}$$
Even though I haven’t broke the algebraic rules, I know there is some mistakes and that's what I'm trying to trace. Where is the problem actually? How's the 'minus' thing became 'plus-minus' thing?? Help me please.
Thanks in advance--

I think, it's better
$$\left|\sin\frac{\alpha}{2}\right|=\sqrt{\frac{1-\cos\alpha}{2}}$$ and
$$\left|\cos\frac{\alpha}{2}\right|=\sqrt{\frac{1+\cos\alpha}{2}}$$
Your mistake is that $\sqrt{x^2}=\pm x$ is wrong.
The right identity it's:
$$\sqrt{x^2}=|x|.$$
For example,  after 
$$\sin^4\frac{\alpha}{2}-\sin^2\frac{\alpha}{2}+\frac{\sin^2\alpha}{4}=0$$ we obtain:
$$\sin^2\frac{\alpha}{2}=\frac{1+\sqrt{1-\sin^2\alpha}}{2}$$ or
$$\sin^2\frac{\alpha}{2}=\frac{1-\sqrt{1-\sin^2\alpha}}{2},$$ which is
$$\sin^2\frac{\alpha}{2}=\frac{1+|\cos\alpha|}{2}$$ or
$$\sin^2\frac{\alpha}{2}=\frac{1-|\cos\alpha|}{2},$$ which is
$$\sin^2\frac{\alpha}{2}=\frac{1+\cos\alpha}{2}$$ or
$$\sin^2\frac{\alpha}{2}=\frac{1-\cos\alpha}{2},$$ which 
 does not give a mistake, but also, does not give any sense. 
Also, squaring of the both sides in $\sin\alpha=2\sin\frac{\alpha}{2}\cos\frac{\alpha}{2}$ gave a wrong case.
Because $a=b$ is not equivalent to $a^2=b^2.$
