Calculate square root of $i \Leftrightarrow z^2=i$ Let $z = r(\cos\theta+i\sin\theta)$. In my notes there was this example to calculate the square roots of $i$. What was done was:
$z = r(\cos\theta+i\sin\theta)\\z^2 = r^2(\cos(2\theta)+i\sin(2\theta))\\=\cos(\frac{\pi}{2})+i\sin(\frac{\pi}{2})\\\Leftrightarrow r=1 \ \ \ \ ∧ \ \ \ \ \ 2\theta=\frac{\pi}{2}+2\pi k,\ k\in \mathbb{Z},\ \theta\in[0,2\pi)\\\Leftrightarrow r=1 \ \ \ \ ∧ \ \ \ \ \  \theta=\frac{\pi}{4}+k\pi , \ k=0,1$
Im not entirely understand what they did above, what does the 2 lines below actually tell us? $\Leftrightarrow r=1 \ \ \ \ ∧ \ \ \ \ \ 2\theta=\frac{\pi}{2}+2\pi k,\ k\in \mathbb{Z},\ \theta\in[0,2\pi)\\\Leftrightarrow r=1 \ \ \ \ ∧ \ \ \ \ \  \theta=\frac{\pi}{4}+k\pi , \ k=0,1$
I thought to calculate the square roots of iyou let $z=x+iy$ and work out $x,y$ from $(x+iy)^2=i$? 
Also, how did they get that $r^2(\cos(2\theta)+i\sin(2\theta))=\cos(\frac{\pi}{2})+i\sin(\frac{\pi}{2})$?

$i=1(\cos(\frac{\pi}{2})+i\sin(\frac{\pi}{2}))$ and we want $z^2=i$, so $r^2(\cos(2\theta)+i\sin(2\theta))=1(\cos(\frac{\pi}{2})+i\sin(\frac{\pi}{2}))$.  Then use that $r_1(\cos\theta_1+i\sin\theta_1)=r_2(\cos\theta_2+i\sin\theta_2)\implies r_1=r_2\wedge\theta_1=\theta_2+2\pi k,k\in\mathbb{Z}$.
This gives $r^2=1\wedge2\theta=\frac{\pi}{2}+2\pi k,k\in\mathbb{Z}$.  Since $r$ is a nonnegative real number, $r=1$; dividing both sides of $2\theta=\frac{\pi}{2}+2\pi k$ by 2 gives $\theta=\frac{\pi}{4}+\pi k$; picking values of $k$ starting from $k=0$ and stopping when we've gone full around gives $k=0,1$ (also, we should expect exactly 2 numbers whose square is $i$).
