Compute the square root of a complex number This is a follow up to a previous question. I solved the equation $z^4 - 6z^2 + 25 = 0$ and I found four answer to be $z = \pm\sqrt{3 \pm 4i}$. 
However someone in the comment said that the answer is going to be $2+i$, $2-i$, $-2+i$, $-2-i$. I cannot understand how we can find these roots from the answer that I found. How are we supposed to compute the square root of a complex number?
 A: Hint: 
Let $x  + yi = \sqrt{a  + bi}$. Then $(x+ yi)^2 = a + bi$. Then solve for $x$ and $y$ and you will generally have two sets of values for the square root $ \sqrt{a  + bi}$ 
Example: 
Say you want to compute $\sqrt{3 + 4i}$. Then assume the square root is $a + bi$. That is $a + bi = \sqrt{3 + 4i} \implies (a + bi)^2 = (a^2 - b^2) + 2abi = 3 + 4i$. Now solve the equations $ (a^2 - b^2) = 3$ and $2ab = 4$ to find $a$ and $b$. 
A: Let $$\sqrt{3+4i}=r(\cos\theta+i\sin\theta)$$ for some $r,\theta$. Squaring both sides, and using de Moivre, we get $$3+4i=r^2(\cos2\theta+i\sin2\theta)$$ so $$3=r^2\cos2\theta,\qquad4=r^2\sin2\theta$$ Squaring and adding gives $$25=3^2+4^2=r^4(\cos^22\theta+\sin^22\theta)=r^4$$ so $r=\sqrt5$. Dividing gives $$\tan2\theta=4/3$$ and $\theta=(1/2)\arctan(4/3)$. So, $$\sqrt{3+4i}=\sqrt5(\cos((1/2)\arctan(4/3))+i\sin((1/2)\arctan(4/3)))$$ This isn't exactly what you want, so let's have a look at that arctangent. Recall $$\tan2\theta={2\tan\theta\over1-\tan^2\theta}={2u\over1-u^2}$$ where I introduce the abbreviation $u=\tan\theta$. So, $${2u\over1-u^2}={4\over3}$$ This is $2u^2+3u-2=0$, $u=(-3\pm5)/4$. Let's take the plus sign, $u=1/2=\tan\theta$, so $\cos\theta=2/\sqrt5$, $\sin\theta=1/\sqrt5$. Now $$\sqrt{3+4i}=r(\cos\theta+i\sin\theta)=\sqrt5((2/\sqrt5)+i(1/\sqrt5))=2+i$$ With a little more care, you get the other three solutions. 
It would seem de Moivre is not the best way to go, here. 
A: Suppose $(x+iy)^2 = a+ib$ with $a,b$ real and you want to find real values for $x$ and $y$.
Then $(x^2-y^2) + i(2xy) = a+ib$. Since $a,b,x,y$ are real, this is equivalent to $x^2-y^2 = a$ and $2xy = b$
$(x^2+y^2)^2 = (x^2-y^2)^2 + 4x^2y^2 = a^2+b^2$, so $x^2+y^2 = \sqrt {a^2+b^2}$. You always pick the positive root because $x^2+y^2$ is positive.
Then, $x^2 = \frac {\sqrt {a^2+b^2}+a}2$, so that $x = \pm \sqrt \frac {\sqrt {a^2+b^2}+a}2$, and finally $y = \frac b{2x}$ if $x \neq 0$.
If $x = 0$ you have to use $y = \pm \sqrt \frac {\sqrt {a^2+b^2}-a}2$ instead.
Here, for $a=3, b=4$, $a^2+b^2 = 9+16 = 25 = 5^2$ so that $x = \pm \sqrt {\frac{5+3}2} = \pm 2$, and $y = \frac 4 {2x} = \pm 1$ (with the same sign as $x$). This gives the two square roots of $3+4i$ .
A: 
How are we supposed to compute the square root of a complex number?

If $z$ is a nonpositive real number, the square roots are $\pm\sqrt{-z}\cdot\mathrm i$. Otherwise, the square roots of $z$ are

$$
\pm\sqrt{r}\cdot\frac{z+r}{|z+r|},\qquad\text{with}\ r=|z|.
$$

The formula is legit because $z+r\ne0$. The whole procedure requires to use the usual operations $+$, $-$, $\times$, $\div$, and to compute thrice the square root of some positive real number... but nothing else.

Example: If $z=3+4\mathrm i$ then $r^2=3^2+4^2$ hence $r=5$, $z+r=8+4\mathrm i$, that is, $z+r=4(2+\mathrm i)$, $|z+r|=4|2+\mathrm i|=4\sqrt5$ and the square roots are
$$
\pm\sqrt5\cdot\frac{4(2+\mathrm i)}{4\sqrt5}=\pm(2+\mathrm i).
$$
For a somewhat less made up example, consider $z=3+2\mathrm i$, then the identity above shows that the square roots of $z$ are
$$
\pm\frac{3+\sqrt{13}+2\mathrm i}{\sqrt2\cdot\sqrt{3+\sqrt{13}}}.
$$
