Relation between signs of imaginary parts of $(x+iy)$ and $\sqrt{x+iy}$ I am looking at the Harvard notes for the complex analysis, and I do not follow how they arrive at the circled:

EDIT: Can also someone show me how to get to the last line? I am a bit confused about how the $\text{sgn}(b)$ emerges there.
 A: You have
$$\begin{align}
x^2+y^2 &= \sqrt{a^2+b^2} \tag{1}\\
x^2-y^2 &= a\tag{2}
\end{align}$$
where (2) is one of the two original equations of the system, and (1) is the new one they arrived to.
Summing (1) and (2) and dividing by two, you get
$$
x^2 = \frac{1}{2}\left(a+\sqrt{a^2+b^2}\right)
$$
Substracting (2) from (1) and dividing by two, you get
$$
y^2 = \frac{1}{2}\left(-a+\sqrt{a^2+b^2}\right).
$$
A: Earlier it is written that
$$x^2-y^2=a$$
So since
$$x^2+y^2=\sqrt{a^2+b^2}$$
It follows that
$$2x^2=a+\sqrt{a^2+b^2}$$
Hope that clears things up.
A: I didn't see where your question concerning the appearance of $\text{sgn}(b)$ was addressed.
The sign of the two solutions $x = +/-$ ... and $y = +/-$ ... can be chosen independently.  BUT $2xy = b$, so you must choose either $(x>0, y<0)$ or
$(x<0, y>0)$.  The factor of $\text{sgn}(b)$ takes care of that.  With it the two
solutions are now properly given by the overall $+/-$ factor in front
of the expression for $x+iy$.
A: The square roots are positive - let me denote them as |x| and |y|.
x and y can be positive or negative independently.  So there are 4
possible solutions which we can group as +/-(|x|+i|y|) when (x>0,y>0)
or (x<0,y<0), and +/-(|x|-i|y|) when (x>0,y<0) or (x<0,y>0).
In your original problem statement you have that 2xy = b.  So when
x and y have the same sign, then b>0, and when they have opposite signs
then b<0.  So the 4 solutions listed above can be written more compactly
as  +/-( |x| + isgn(b)|y| ).
