# Square root of a complex number

## Square root of a complex number

Let z be a complex number written in its algebraic form,

`z = a + i * b`, a and b are two real numbers.

Then, the square root of z is the complex number R such as,

`R = x + i * y`, x and y are real numbers and,

`R^2 = z`

`(x + i * y)^2 = a + i * b`

We are searching for real numbers x and y satisfying,

`(x + i * y)^2 = a + i * b`

`x^2 - y^2 + 2*x*i*y = a + i * b`

We then get a system of two equations and two unknown x and y.

`{(x^2 - y^2 = a),(2*x*y = b):}`

We notice that it will be easier to calculate `x^2` and `y^2` first. To do this, we use the modulus as follows,

`|R^2| = |z|`

`x^2+y^2 = sqrt(a^2+b^2)`

We rewrite our system of equations,

`{(x^2 - y^2 = a),(2*x*y = b),(x^2+y^2 = sqrt(a^2+b^2)):}`

Using Equations (1) and (3), we deduce,

`x^2 = (sqrt(a^2+b^2)+a)/2`

`y^2 = (sqrt(a^2+b^2)-a)/2`

so,

`x = +-sqrt((sqrt(a^2+b^2)+a)/2)`

`y = +-sqrt((sqrt(a^2+b^2)-a)/2)`

To determine the signs of x and y, just use equation (2).

- if b > 0 then x and y have the same sign, the 2 solutions of the equation system are

First solution: `x = sqrt((sqrt(a^2+b^2)+a)/2)` and `y = sqrt((sqrt(a^2+b^2)-a)/2)`

x + i* y is a first root of z

Second solution: `x = -sqrt((sqrt(a^2+b^2)+a)/2)` and `y = -sqrt((sqrt(a^2+b^2)-a)/2)`

x + i * y is the second root of z.

- if b < 0 then x and y have opposite signs, the solutions of the system of equations are

First solution: `x = sqrt((sqrt(a^2+b^2)+a)/2)` and `y = -sqrt((sqrt(a^2+b^2)-a)/2)`

x + i* y is a first root of z

Second solution: `x = -sqrt((sqrt(a^2+b^2)+a)/2)` and `y = sqrt((sqrt(a^2+b^2)-a)/2)`

x + i * y is the second root of z.

- if b = 0 then y=0 and z is a real number (z = a), we find the trivial roots of a real number,

`x = sqrt(a)` or

`x = -sqrt(a)`

## Example

Calculate the root of z = 1-i

The root of z is denoted by R, so we have `R^2 = z = 1 - i`

`R = x+i*y`

`(x+i*y)^2 = 1-i`

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

(2) `2*x*y = -1`

By the way, `|R^2| = |z|` therefore,

(3) `x^2+y^2 = sqrt(2)`

By combining (1) and (3) we obtain,

`x^2 = (sqrt(2)+1)/2`

`y^2 = (sqrt(2)-1)/2`

`x = +-sqrt((sqrt(2)+1)/2)`

`y = +-sqrt((sqrt(2)-1)/2)`

Now according to (2) `x*y = -1/2` therefore x and y have opposite signs,

The solutions of the system are,

First solution: `x = sqrt((sqrt(2)+1)/2)` and `y = -sqrt((sqrt(2)-1)/2)`

x + i* y is a first root of z

Second solution: `x = -sqrt((sqrt(2)+1)/2)` and `y = sqrt((sqrt(2)-1)/2)`

x + i * y is the second root of z.

## See also

Algebraic form of a complex number

Modulus of a complex number