Here |z| = √(a²+b²) and sgn(b) = +1 if b ≥ 0, −1 if b < 0. The two square roots are always negatives of each other. Derived by setting (x+iy)² = a+ib and solving the system x²−y²=a, 2xy=b using x²+y²=|z|.
Derivation
Every non-zero complex number has exactly two square roots, and they are negatives of each other. Finding them requires only algebra and the definition of modulus.
Setup
Let z=a+ib. We want to find w=x+iy such that w2=z.
Squaring w:
(x+iy)2=x2−y2+2ixy
Equating real and imaginary parts with a+ib:
x2−y2=a(1)2xy=b(2)
This is a system of two equations in two unknowns. But it is not linear — equation (1) involves a difference of squares. The key is to introduce a third equation using the modulus.
Introducing the Modulus
Compute ∣w∣2=x2+y2. Since w2=z, we have ∣w2∣=∣z∣, so ∣w∣2=∣z∣:
x2+y2=a2+b2=∣z∣(3)
Now equations (1) and (3) form a clean linear system in x2 and y2: