How can one find the square roots of a complex number (say -7+13i, or more generally a+bi) using de Moivre's formula? 
How can one find the square roots of a complex number (say $-7+13i$, or more generally $a+bi$) using de Moivre's formula?

I've begun a course on complex variables recently and one of the first things we've covered is complex numbers in polar form, where de Moivre's formula emerges. But in this, I know it can be used to find the two square roots of a complex number, but I'm really not sure how. I feel I might be getting lost in the trigonometry.
 A: Write the complex number $z$ as $r(\cos\theta+i\sin\theta)$ and use De'Moivre's formula to claim that
$$\sqrt z=r^{\frac 12}\left(\cos \left(\frac \theta 2\right)+i\sin \left(\frac \theta 2\right)\right)$$
A: Well, we know that:
$$\text{z}=\Re\left(\text{z}\right)+\Im\left(\text{z}\right)i=\left|\text{z}\right|\exp\left(\left(\text{Arg}\left(\text{z}\right)+2\pi\text{k}\right)i\right)\tag1$$
Where $\text{Arg}\left(\text{z}\right)$ is the principle value of the argument, $\text{k}\in\mathbb{Z}$ and $\left|\text{z}\right|=\sqrt{\Re\left(\text{z}\right)^2+\Im\left(\text{z}\right)^2}$.
Now, taking the square root gives:
\begin{equation}
\begin{split}
\sqrt{\text{z}}&=\text{z}^\frac{1}{2}\\
\\
&=\left(\left|\text{z}\right|\exp\left(\left(\text{Arg}\left(\text{z}\right)+2\pi\text{k}\right)i\right)\right)^\frac{1}{2}\\
\\
&=\left|\text{z}\right|^\frac{1}{2}\cdot\exp\left(\frac{1}{2}\cdot\left(\text{Arg}\left(\text{z}\right)+2\pi\text{k}\right)i\right)\\
\\
&=\sqrt{\left|\text{z}\right|}\cdot\exp\left(\left(\frac{\text{Arg}\left(\text{z}\right)}{2}+\pi\text{k}\right)i\right)\\
\\
&=\sqrt{\left|\text{z}\right|}\cos\left(\frac{\text{Arg}\left(\text{z}\right)}{2}+\pi\text{k}\right)+\sqrt{\left|\text{z}\right|}\sin\left(\frac{\text{Arg}\left(\text{z}\right)}{2}+\pi\text{k}\right)i
\end{split}\tag2
\end{equation}
A: First you should find $r$ and $\theta$ like below. Since $r^2=a^2+b^2$
$$\sqrt{a^2+b^2}=\sqrt{r^2}=\begin{cases}
r,~~~r>0\\
-r,~~~r<0
\end{cases}$$
But since $r$ is positive,
$$r=\sqrt{a^2+b^2}$$
Also $\tan\theta=\frac ba$, So
$$\operatorname{Arctan}\frac ba=\operatorname{Arctan}(\tan\theta)=\begin{cases}
\theta,~~~\text{first quadrant}\\
\theta-\pi,~~~\text{second and third quadrants}\\
\theta-2\pi,~~~\text{fourth quadrant}
\end{cases}$$
and
$$\theta=\begin{cases}
\operatorname{Arctan}\frac ba,~~~(a,b>0)\\
\pi+\operatorname{Arctan}\frac ba,~~~(a<0)\\
2\pi+\operatorname{Arctan}\frac ba,~~~(a>0,b<0)
\end{cases}$$
Then
$$\begin{align}
\sqrt z&=\sqrt r\left(\cos\left(\frac{\theta+2k\pi}2\right)+i\sin\left(\frac{\theta+2k\pi}2\right)\right), k=0,1\\
&=\pm\sqrt{r}\left(\cos\left(\frac{\theta}2\right)+i\sin\left(\frac{\theta}2\right)\right)
\end{align}$$
