<s>[INST] How did they get this result? Please, explain these computations:
1) $-\left(\frac{1}{2}\right)^2 +1 =  \cos^2x$
$\frac{\sqrt{3}}{2}  =  \cos x$
How did we get  $\frac{\sqrt{3}}{2}$   from   $-\left(\frac{1}{2}\right)^2 +1$?
2) $-\left(\frac{\sqrt{2}}{2}\right)^2 +1 = \cos^2x$
$\frac{\sqrt{2}}{2} = \cos x$
How did we get $ \frac{\sqrt{2}}{2}$   from  $-\left(\frac{\sqrt{2}}{2}\right)^2 +1 $?
 [/INST] $$\sqrt{-\left(\frac12\right)^2 +1} = \sqrt{-\frac14 +1} = \sqrt{\frac34} = \frac{\sqrt{3}}{2}$$ 
$$\sqrt{-\left(\frac{\sqrt{2}}{2}\right)^2 +1} = \sqrt{-\frac24 +1} = \sqrt{\frac24} = \frac{\sqrt{2}}{2}$$ 
though you should also consider the negative square roots.
</s>