# Complex number

A **complex number** is defined as a pair of real numbers z = (x, y) where the following operations are defined:

- Addition: z
_{1}+ z_{2}= (x_{1}+ x_{2}, y_{1}+ y_{2}) - Multiplication: z
_{1}z_{2}= (x_{1}y_{1}- x_{2}y_{2}, x_{2}y_{1}+ x_{2}y_{1})

When the second element equals zero the complex numbers behaves as real numbers. That's why the first element of the complex number is known as the *real part* and the second element as the *imaginary part*.

Multiplying (0, 1) (0, 1) we get (-1, 0). Since no real number is the square root of -1, we can now understand why the second element is the imaginary part.

An alternate (and more used) notation is z = x + iy. From the previous paragraph we get: i^{2} = -1.

Using this notation and the definitions above we can deduce all basic operations on complex numbers:

- Addition:

- [math]z_1 + z_2 = (x_1 + x_2) + (y_1 + y_2) i[/math]

- Subtraction:

- [math]z_1 - z_2 = (x_1 + x_2) + (-y_1 - y_2) i[/math]

- Multiplication:

- [math]z_1 z_2 = (x_1 y_1 - x_2 y_2) + (x_1 y_2 + x_2 y_1) i[/math]

- Division:

- [math]\frac {z_1}{z_2} = \frac {x_1 y_1 + x_2 y_2}{x_2^2 + y_2^2}\,+\,\frac {x_2 y_1 - x_1 y_2}{x_2^2 + y_2^2} \,i[/math]

- Square root:

- [math]\sqrt{x+iy} = \sqrt{\frac{\left|x+iy\right| + x}{2}} \pm i \sqrt{\frac{\left|x+iy\right| - x}{2}}[/math]
- where the sign of the imaginary part of the root is the same as the sign of the imaginary part of the original number and
- [math]\left|x+iy\right| = \sqrt{x^2+y^2}[/math]