<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] Here's another way: 
$$ \cos^2(x) = 1 - (\frac{1}{2})^2 $$  and 
$$ \cos^2(x) = 1 - \sin^2(x) $$ so immediately we have
$$ \sin(x) = \pm\frac{1}{2} $$  then, since $\sin(x) = \frac{opp}{hyp}$ we have from the reference triangle,  $$ \cos(x) = \frac{adj}{hyp} = \pm\frac{\sqrt{3}}{2} $$ and also
$$ \tan(x) = \frac{opp}{adj} =\pm \frac{1}{\sqrt{3}} $$

</s>