# Complex number arithmetic

Martin McBride
2022-01-30

In this article we will look at complex numbers, and how to perform basic arithmetic operations.

## Real, imaginary and complex numbers

A real number is any value on the of the number line:

This line extends infinitely in both directions, towards negative infinity on the left and positive infinity on the right. It includes every integer, rational number and irrational number that there is.

The set of all real numbers is represented by $\mathbb{R}$.

We have looked at imaginary numbers in a previous article. An imaginary number consists of any real number multiplied by the imaginary unit number i, where i is the square root of -1.

Imaginary numbers exist on a similar number line to the real numbers:

For every real number x, there is a corresponding imaginary number of x multiplied by i. So the set of imaginary numbers is the set of all numbers in $\mathbb{R}$, multiplied by i.

A complex number is a number that has both a real and an imaginary part. It can be written as a + bi where a and b are real numbers. a is the real part of the complex number, and b is the imaginary part.

Every combination of a and b represents a unique complex number. This means that the set of all complex numbers forms a plane:

In this example, the complex number a + bi is at (x, y) position (a, b).

The set of all complex numbers is represented by $\mathbb{C}$.

Although a complex number has real and imaginary parts, we can represent it by a single variable, often called z:

$$z = a + bi$$

The function $\Re(z)$ gives a (the real part of z). The function $\Im(z)$ gives b (the imaginary part of z).

## Adding and subtracting complex numbers

We can add two complex number by adding their real and imaginary parts. For example:

\begin{align} z_1 = a + bi\newline z_2 = c + di\newline z_1 + z_2 = (a + c) + (b + d)i \end{align}

We can subtract one complex number from another by subtracting their real and imaginary parts. For example:

\begin{align} z_1 = a + bi\newline z_2 = c + di\newline z_1 - z_2 = (a - c) + (b -d )i \end{align}

We can also negate a complex number by negating its real and imaginary parts:

\begin{align} z_1 = a + bi\newline -z_1 = -(a + bi) = -a - bi \end{align}

## Multiplying complex numbers

We can also multiply two complex numbers, like this:

$$z_1 . z_2 = (a + bi)(c + di)$$

Expanding the brackets gives 4 terms:

$$ac + adi +bci + bdi^2$$

Since $i^2 = -1$ this simplifies to:

$$(ac - bd) + (ad + bc)i$$

When we look at Euler's relation we will see a simpler way of expressing this.

## Complex conjugates

The complex conjugate, written $z^*$, is formed by negating the imaginary part. For example:

\begin{align} z = x + yi\newline z^* = x - yi \end{align}

If we multiply a complex number by its conjugate, the result is always a real number:

\begin{align} z . z^* = (x + yi)(x - yi)\newline = x^2 + xyi - xyi - y^2i^2 \end{align}

The two terms in i cancel out, and $-y^2i^2$ can be simplified to $y^2$, leaving

$$x^2 + y^2$$

## Dividing complex numbers

Dividing a complex number by a real number is quite straightforward, we simply divide the real and imaginary parts:

\begin{align} z_1 = a + bi\newline \frac{z_1}{e} = \frac{a + bi}{e} = \frac{a}{e} + \frac{b}{e}i \end{align}

We can also divide one complex number by another:

\begin{align} z_1 = a + bi\newline z_2 = c + di\newline \frac{z_1}{z_2} = \frac{a + bi}{c + di} \end{align}

It isn't immediately obvious how to simplify this, but in fact complex conjugates are very useful in this case. We can multiply the top and bottom of the fraction by the complex conjugate of the denominator:

$$\frac{(a + bi)(c - di)}{(c + di)(c - di)}$$

Multiplying the brackets, the denominator is now a real number:

$$\frac{ac + bci - adi + bd}{c^2 + d^2}$$

We can separate the real and imaginary terms as:

$$\frac{ac + bd)}{c^2 + d^2} + \frac{bc - ad}{c^2 + d^2}$$