Theorem: Square Root of Complex Number in Cartesian Form

Let $z \in \C$ be a complex number.
Let $z = x + i y$ where $x, y \in \R$ are real numbers.
Let $z$ not be wholly real, that is, such that $y \ne 0$.
Then the square root of $z$ is given by:
:$z^{1/2} = \pm \paren {a + i b}$
where:
{{begin-eqn}}
{{eqn | l = a
      | r = \sqrt {\frac {x + \sqrt {x^2 + y^2} } 2}
      | c = 
}}
{{eqn | l = b
      | r = \frac y {\cmod y} \sqrt {\frac {-x + \sqrt {x^2 + y^2} } 2}
      | c = 
}}
{{end-eqn}}

Proof:
Let $a + i b \in z^{1/2}$.
Then:
{{begin-eqn}}
{{eqn | l = \paren {a + i b}^2
      | r = x + i y
      | c = {{Defof|Square Root|subdef = Complex Number|index = 4|Square Root of Complex Number}}
}}
{{eqn | n = 1
      | ll= \leadsto
      | l = a^2 + 2 i a b - b^2
      | r = x + i y
      | c = Square of Sum and $i^2 = -1$
}}
{{end-eqn}}
Equating imaginary parts in $(1)$:
{{begin-eqn}}
{{eqn | l = 2 a b
      | r = y
      | c = 
}}
{{eqn | n = 2
      | ll= \leadsto
      | l = b
      | r = \frac y {2 a}
      | c = rearranging
}}
{{end-eqn}}
Equating real parts in $(1)$:
{{begin-eqn}}
{{eqn | l = a^2 - b^2
      | r = x
      | c = 
}}
{{eqn | ll= \leadsto
      | l = a^2 - \paren {\frac y {2 a} }^2
      | r = x
      | c = substituting for $b$ from $(2)$
}}
{{eqn | ll= \leadsto
      | l = 4 a^4 - 4 a^2 x - y^2
      | r = 0
      | c = multiplying by $4 a^2$ and rearranging
}}
{{eqn | ll= \leadsto
      | l = a^2
      | r = \frac {4 x \pm \sqrt {16 x^2 + 16 y^2} } 8
      | c = Quadratic Formula
}}
{{eqn | ll= \leadsto
      | l = a^2
      | r = \frac {x \pm \sqrt {x^2 + y^2} } 2
      | c = dividing top and bottom by $4$
}}
{{eqn | n = 3
      | ll= \leadsto
      | l = a
      | r = \pm \sqrt {\frac {x + \sqrt {x^2 + y^2} } 2}
      | c = taking the square root
}}
{{end-eqn}}
Note that in $(3)$, only the positive square root of the discriminant $x^2 + y^2$ is used.
This is because the negative square root of $x^2 + y^2$ would yield $\dfrac {x - \sqrt {x^2 + y^2} } 2 < 0$.
As $a \in \R$, it is necessary that $\dfrac {x + \sqrt {x^2 + y^2} } 2 > 0$.
Hence $\sqrt {x^2 + y^2} > 0$.
Then:
{{begin-eqn}}
{{eqn | l = b
      | r = \frac y {2 a}
      | c = from $(2)$
}}
{{eqn | r = \frac y {2 \paren {\pm \sqrt {\dfrac {x + \sqrt {x^2 + y^2} } 2} } }
      | c = 
}}
{{eqn | ll= \leadsto
      | l = b^2
      | r = \frac {y^2} {2 \paren {x + \sqrt {x^2 + y^2} } }
      | c = 
}}
{{eqn | ll= \leadsto
      | l = b^2
      | r = \frac {y^2 \paren {x - \sqrt {x^2 + y^2} } } {2 \paren {x + \sqrt {x^2 + y^2} } \paren {x - \sqrt {x^2 + y^2} } }
      | c = multiplying top and bottom by $x - \sqrt {x^2 + y^2}$
}}
{{eqn | ll= \leadsto
      | l = b^2
      | r = \frac {y^2 \paren {x - \sqrt {x^2 + y^2} } } {2 \paren {x^2 - \paren {x^2 + y^2} } }
      | c = Difference of Two Squares
}}
{{eqn | ll= \leadsto
      | l = b^2
      | r = \frac {y^2 \paren {x - \sqrt {x^2 + y^2} } } {- 2 y^2}
      | c = 
}}
{{eqn | ll= \leadsto
      | l = b^2
      | r = \frac {-x + \sqrt {x^2 + y^2} } 2
      | c = 
}}
{{end-eqn}}
But from $(2)$ we have:
:$b = \dfrac y {2 a}$
and so having picked either the positive square root or negative square root of either $a^2$ or $b^2$, the root of the other is forced.
So:
:if $y > 0$, then $a$ and $b$ are both of the same sign.
Thus:
:$b = 1 \times \sqrt {\dfrac {-x + \sqrt {x^2 + y^2} } 2}$
:if $y < 0$, then $a$ and $b$ are of opposite sign.
Thus:
:$b = \paren {-1} \times \sqrt {\dfrac {-x + \sqrt {x^2 + y^2} } 2}$
Hence:
:$b = \dfrac y {\cmod y} \sqrt {\dfrac {-x + \sqrt {x^2 + y^2} } 2}$
{{qed}}