# Complex Square-root

Let x + i y = sqrt(a + i b). Square both sides to yield a pair
of simultaneous quadratic equations in x and y. Their solution
substituted back into the original equation yields

sqrt(a + i b) = (sqrt(2) / 2) ( sqrt(sqrt(a^2 + b^2) + a) + i
(sqrt(sqrt(a^2 + b^2) - a) sign(b))

where the sign function is defined as

sign(x) = 1 if x > 0, -1 if x < 0, and 0 otherwise (that
is, if x = 0)

This is the **Algebraic reduction** of the
complex square-root to real operations.. However, the
logarithmic-exponential expression is more direct.

## Useful Algebraic identities

1 - x^2 = (1 - x) (1 + x)

The right-hand side provides less round-off errors for x near
1.

Substitution of 1 - x for x in the foregoing yields

1 - (1 - x)^2 = (1 - (1 - x)) (1 + (1 - x))

which simplifies to

1 - (1 - x)^2 = x ( 2 - x)

Again, the right-hand side provides less round-off errors for
x near 0.

Copywrite (c) 1997 R. I. 'Sciibor-Marchocki last modified on
Tuesday 15-th April 1997.