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})$?


How did they get that $r^2(\cos(2\theta)+i\sin(2\theta))=\cos(\frac{\pi}{2})+i\sin(\frac{\pi}{2})$?  

This whole problem is easiest to do via Euler's identity: $$e^{i\theta} = \cos(\theta) + i\sin(\theta).$$  Now, any complex number $z$ can be
expressed as $z=re^{i\theta}$ where $r$ is some real
number and $0 \leq \theta < 2\pi$.  It follow that 
$z^2 = r^2e^{i2\theta} = r^2(\cos(2\theta)+i\sin(2\theta))$, and so if we want to solve the equation $z^2 = i$, then we have
$$z^2 = r^2e^{i2\theta} = r^2(\cos(2\theta)+i\sin(2\theta)) = i.$$
Now, $r^2\cos(2\theta)+ir^2\sin(2\theta) = 0 + i$ means that
$r^2\cos(2\theta) = 0$ and $r^2\sin(2\theta) = 1$. The latter equation
shows us that $r \neq 0$ and hence it must be that 
$\cos(2\theta) = 0$, giving $2\theta = \pi/2$ and so $\sin(2\theta) = 1$. Substituting $\sin(2\theta) = 1$ into 
the latter equation
reduces it to $r^2 = 1$, and so $r = \pm 1$.
Also,  since $2\theta = \pi/2$, we get $\theta = \pi/4$.
Hence, the two square roots of $i$ are 
$$i^{1/2} = \pm\left(\cos(\pi/4) + i\sin(\pi(4)\right) = \pm \frac{1+i}{\sqrt{2}}$$  
