## Imaginary numbers

• Invented to solve problems where an equation has no real roots e.g. $$x^2 + 16 = 0$$, the idea of declaring the existence of a quantity $$i$$ such that $$i^2 = -1$$ allows us to express the solution as

$x = \sqrt{-16} = \sqrt{16i^2} = \pm4i$

The set represented by $$\mathbb{I}$$ defines an imaginary number as

$i^2 = -1$

### Powers of i

If $$i^2 = -1$$ then $$i^4 = i^2i^2 = -1 * -1 = 1$$

Therefore we have the sequence

$\begin{array}{ccccc} \hline i & i^2 & i^3 & i^4 & i^5 & \ldots \\ \hline i & -1 & -i & 1 & i & \ldots \\ \hline \end{array}$

## Complex numbers

A complex number is just the sum of a real and an imaginary number

$z = a + bi \quad a,b \in \mathbb{R}, \quad i^2 = -1$

### Operations on complex numbers

Given two complex numbers

$z_1 = a_1 + b_1i \\ z_2 = a_2 + b_2i$

$z_1 \pm z_2 = a_1 \pm a_2 + (b_1 \pm b_2)i$

#### Product

\begin{align*} z_1z_2 &= a_1a_2 + a_1b_2i + a_2b_1i + b_1b_2i^2 \quad \text{given that i^2 = -1} \\ &= (a_1a_2 - b_1b_2) + (a_1b_2 + b_1a_2)i \end{align*}

Given the complex number

$z = a + bi$

#### Norm (modulus or absolute value)

$|z| = \sqrt{a^2 + b^2}$

#### Complex conjugate

The product of two complex numbers where the only difference between them is the sign of the imaginary part is

$(a + bi)(a - bi) = a^2 - abi + abi - b^2i^2 = a^2 + b^2$

This quantity $$a - bi$$ is called the complex conjugate of $$z$$ (denoted as $$z^*$$), it implies that

$zz^* = |z|^2$

#### Inverse

$z^{-1} = \frac{1}{z}$

Multiplying the numerator and denominator with the conjugate of $$z$$ (so that we have a real part on the denominator)

$z^{-1} = \frac{1}{z} \frac{z^*}{z^*} = \frac{z^*}{zz^*} = \frac{z^*}{|z|^2}$

#### Square root of $i$

We're trying to find a complex number $$z$$ such that

$\sqrt{i} = z \\ i = z^2$

Assuming that $$z$$ is the complex number $$z = a + bi$$

\begin{align} i &= (a + bi)^2 \nonumber \\ &= (a + bi)(a + bi) \nonumber \\ &= a^2 - b^2 + 2abi \label{square-imaginary} \end{align}

Therefore

$(a^2 - b^2) + (2ab)i = 0 + 1i$

Equaling real and imaginary parts

\begin{align*} a^2 - b^2 &= 0 \\ 2ab = 1 \end{align*}

Therefore $$a = \pm b$$, replacing $$a = -b$$ in the second equation we obtain $$-2b^2 = 1$$ which is not satisfied by any real number $$b$$ therefore the case $$a = -b$$ is impossible, replacing $$a = b$$ in the second equation we obtain $$2a^2 = 1$$ so

$2a^2 = 1 \\ a^2 = \frac{1}{2} \\ a = b = \pm \sqrt{\frac{1}{2}} = \pm \frac{1}{\sqrt{2}}$

Finally the value of $$\sqrt{i}$$ is

$\sqrt{i} = (a + bi) = \pm{\frac{1}{\sqrt{2}}} (1 + i)$

The value of $$\sqrt{-i}$$ is found in the same way (by replacing $$b = -a$$ in the equation $$-2ab = 1$$ found from multiplying \eqref{square-imaginary} by $$-1$$)

$\sqrt{-i} = (a + bi) = \pm{\frac{1}{\sqrt{2}}} (1 - i)$

### Matrix representation of a complex number

The matrix $$C$$ for a complex number is the sum of two other matrices representing the real $$R$$ and imaginary $$I$$ parts:

$C = R + I$

which can be written as

$C = a \hat{R} + b \hat{I} \quad\quad a, b \in \mathbb{R}$

Where $$R = 1$$ and $$I = i$$

The matrix representation of $$R = 1$$ in 2d is the identity matrix

$\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$

To find the matrix representation of $$i$$ we have to analyze the definition of $$i$$ which is a quantity which squares to $$-1$$, given that we already know the value of $$1$$ in matrix form

\begin{align*} i^2 &= -1 * \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \\ &= \begin{bmatrix} -1 & 0 \\ 0 & -1 \end{bmatrix} \end{align*}

Squaring the following matrix gives the matrix above, then the value of $$i$$ expressed in matrix form is

$I = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}$

Finally the value of $$C$$ is

$C = a \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} + b \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} = \begin{bmatrix} a & -b \\ b & a \end{bmatrix}$

### The complex plane

The powers of $$i$$ give rise to the sequence $$(1, i, -1, -i, 1, \ldots)$$ which is quite similar to the pattern $$(x, y, -x, -y, x, \ldots)$$, the resemblance is no coincidence as complex number belong to a 2-dimensional plane, this complex plane allows us to visualize complex numbers using the horizontal axis for the real part and the vertical axis for the imaginary part

$$1, i, -1, -i$$

We can see that the positions of $$i^0 = 1, i^1 = i, i^2 = -1, i^3 = -i, \ldots$$ suggest that the multiplication of a complex number by $$i$$ is equivalent to rotating through 90 degrees

e.g.

\begin{align*} z_1 &= 2 + i \\ z_2 &= (2 + i)(i) = -1 + 2i \\ z_3 &= (-1 + 2i)(i) = -2 - i \\ z_4 &= (-2 - i)(i) = 1 - 2i \\ z_5 &= (1 - 2i)(i) = 2 + i = z_1 \end{align*}

A complex number is rotated $$\pm 90^{\circ}$$ by multiplying it by $$\pm i$$

Let's graph the roots of $$\sqrt{i} = \pm \frac{1}{\sqrt{2}} (1 + i)$$

We can see that $$\tfrac{1}{\sqrt{2}} (1 + i)$$ is exactly at $$45^{\circ}$$ and $$- \tfrac{1}{\sqrt{2}} (1 + i)$$ is exactly at $$225^{\circ}$$

Let's multiply the complex number $$2 + i$$ by $$\sqrt{i}$$ (it should rotate it by $$45^{\circ}$$)

\begin{align*} z_1 &= 2 + i \\ z_2 &= (2 + i)(\sqrti + \sqrti i) = \sqrti + 3 \sqrti i \end{align*}

Multiplying $$z_2$$ by $$\sqrt{i}$$ again should be equal to multiplying $$z_1$$ by $$i$$ (because $$z_2$$ is already rotated by $$45^{\circ}$$)

\begin{align*} z_2 &= \sqrti + 3 \sqrti i \\ z_3 &= (\sqrti + 3 \sqrti i)(\sqrti + \sqrti i) \\ &= (\frac{1}{2} - \frac{3}{2}) + (\frac{1}{2} + \frac{3}{2})i \\ &= -1 + 2i \end{align*}

Which is exactly what we find if we multiply $$z_i$$ by $$i$$, these observations suggest that we can build a complex number which can rotate another complex number by any angle

A complex number is rotated $$45^{\circ}$$ by multiplying it by $$\sqrti + \sqrti i$$

A complex number is rotated $$225^{\circ}$$ by multiplying it by $$-\sqrti + \sqrti i$$

### Polar representation

Instead of using coordinates in the complex plane we can represent a polar number with the length of the vector from the origin to the complex coordinate and the angle between the complex vector and the positive real axis

$r = |z| = \sqrt{a^2 + b^2} \\ \theta = arctan(\frac{b}{a})$

The horizontal component of $$z$$ is then $$r * cos(\theta)$$ and the vectical component is $$r * sin(\theta)$$, expressing the complex number using these quantities

\begin{align*} z &= a + bi \\ &= r * \cos \theta + ri\; \sin \theta \\ &= r \; (\cos \theta + i \sin \theta) \end{align*}

Euler provided the identity

$\begin{equation}\label{rotor} e^{i\theta} = \cos \theta + i \sin \theta \end{equation}$

Which allows us to represent any complex number as

$z = r\,e^{i\theta}$

Given two polar numbers

$z = r\,e^{i\theta} \\ w = s\,e^{i\phi} \\$

Their product is

$zw = rs\, e^{i(\theta + \phi)} = rs [ \cos (\theta + \phi) + i \sin (\theta + \phi)]$

Which effectively rotated the complex number $$z$$ by $$\phi$$ angles! However the quantity $$zw$$ was scaled $$s$$ units, to avoid scalling we can normalize $$w$$ (i.e. making $$r = 1$$ which is equal to \eqref{rotor})

A rotor is a complex number that rotates another complex number by an angle $$\theta$$ (through multiplication) and has the form

$e^{i\theta} = \cos \theta + i \sin \theta$

Rotating a complex number $$x + yi$$ by an angle $$\theta$$

\begin{align*} x' + y'i &= (x + yi)(\cos \theta + i \sin \theta) \\ &= (x \cos \theta - y \sin \theta) + (x \sin \theta + y \cos \theta)i \end{align*}

Which in matrix form is

$\begin{bmatrix} x' & -y' \\ y' & x' \end{bmatrix} = \begin{bmatrix} x & -y \\ y & x \end{bmatrix} \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix}$

Note that because of the way the complex product is defined, the multiplication between two complex numbers commutes

\begin{align*} x' + y'i &= (\cos \theta + i \sin \theta)(x + yi)\\ &= (x \cos \theta - y \sin \theta) + (x \sin \theta + y \cos \theta)i \end{align*}