<s>[INST] Square roots of complex numbers I know that the square root of a number x, expressed as $\displaystyle\sqrt{x}$, is the number y such that $y^2$ equals x. But is there any simple way to calculate this with complex numbers? How?
 [/INST] Write $(x+iy)^2=a+ib$, thus $x^2-y^2=a$ and $2xy=b$.
Now, $-x^2y^2=-b^2/4$, so $x^2$ and $-y^2$ are the solutions of $t^2-at-b^2/4=0$.
Then $\Delta=a^2+b^2$, and $t=\frac{a \pm \sqrt{a^2+b^2}}{2}$.
Obviously, since $x^2 \geq 0$ and $-y^2 \leq 0$, we have
$$x^2 = \frac{\sqrt{a^2+b^2}+a}{2}$$
$$y^2 = \frac{\sqrt{a^2+b^2}-a}{2}$$
Then, using the fact that $xy$ has the same sign than $b$, we have the two square roots of $a+ib$,
$$x+iy = \pm \left( \sqrt{\frac{\sqrt{a^2+b^2}+a}{2}} + i \ \mathrm{sign}(b) \sqrt{\frac{\sqrt{a^2+b^2}-a}{2}}\right)$$
with $\mathrm{sign}(x)=1$ if $x\ge0$ and $-1$ otherwise.
</s>