# Complex Numbers

"Two-Dimensional" number.

$$z=a+ib$$

## Basic operations

Addition and subtraction work by adding and subtracting the real and imaginary part separately.

Multiplication works as expected.

### Division

Division is defined as *multiplication with the __multiplicative inverse__*:

$$\frac{z^*}{|z|^2}$$

$$\therefore$$

$$\frac{z_1}{z_2} = \frac{z_1 z_2^*}{|z_2|^2}$$

## New operands

### Complex conjugate

The complex conjugate of a general $z=a+ib$ is simply:

$$z^*=a-ib$$

### Modulus

Modulus of a complex number, $|z|$, or $mod(z)$, is simply:

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

## Complex plane



Complex numbers are two dimensional in nature and can thus be depicted on a _real-imaginary_ axis.

This type of graph is known as an __Argand Diagram__:

$$z=x+iy$$

Interestingly the complex conjugate just becomes the _reflection in the real axis_.

### Polar form

With this new geomemtrical understanding of complex numbers we can also represent them in 2D polar form, leaving us with:

$$r=\sqrt{x^2+y^2}=|z|$$

$$cos\theta = x/r \Leftrightarrow x=r \cdot cos\theta$$

$$sin\theta = y/r \Leftrightarrow y=r \cdot sin\theta$$

The phase angle $\theta$ is also known as __the argument of $z$__

$\therefore$ the polar form of $z$ becomes:

$$z=x+iy=r \cdot (cos\theta + i sin\theta)$$

Combining Euler's formula and what we already know we can derive that a complex number $z$ can also be expressed:

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

#### Basic operations in polar form

In polar form mathematical operations can be understood as geometrical operations:

* __Addition__ and __Subtraction__: Same as vectors

{: width=50%}


* __Multiplication__: _Multiply moduli_ and _add arguments_ (alliteration)

{: width=50%}

$$z_1 z_2 = |z_1| |z_2| [cos(\theta_1 + \theta_2) + i sin(\theta_1 + \theta_2)]$$

* __Division__: Similar to multiplication - _divide moduli_ and _subtract arguments_

$$\frac{z_1}{z_2} = \frac{|z_1|}{|z_2|} [cos(\theta_1 - \theta_2) + i sin(theta_1 - theta_2)]$$

## De Moivre's Theorem

Let $z$ be the unit modulus complex number

$$z := cos\theta + i sin\theta$$

This implies that:

$$z^n = [cos\theta + i sin \theta]^n = cos(n\theta) + i sin(n\theta) \tag*{ $n \in \mathbb{Z} $} $$

Alternatively we can state De Moivre as:

$$ (e^{i\theta})^n = e^{in\theta} $$

### Finding trig identities

De Moivre's Theorem can be used to find free trig identities.

A simple example would be the $2\theta$ identities:

$$
\begin{align}
[cos\theta + i sin\theta]^2 & = cos(2\theta) + i sin(2\theta)\\
                            & = cos^2(\theta) - sin^2(\theta) + 2i cos(\theta) sin(\theta)\\
                            \\
                            & \Rightarrow cos(2\theta) = cos^2(\theta) - sin^2(\theta)\\
                            & \Rightarrow sin^2(\theta) = 2 cos(\theta) sin(\theta)\\
\end{align}
$$

## Euler's formula

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

Looking at this we can see the surprising result:

$$ e^{i\pi} + 1 = 0 $$

## Roots of unity

Solutions to the equation:

$$ z^n = 1 $$

$$
\begin{align}
&\Rightarrow |z| = 1\\
&\Rightarrow z = e^{i\theta}\\
\end{align}
$$

We always have $n$ distinct $n$th roots of unity.

$$
\omega \equiv e^{2 \pi i \theta \ / \ n}
$$

## Powers and logarithms of complex numbers

### Natural logarithm

$w = ln(z)$ is defined as the function that solves $e^w = z$

Using $z = r e^{i\theta}$ we find:

$$ w = ln(r) + i(2 \pi n) $$

### General powers

$$ z_1^{z_2} \equiv e^{z_2\ ln(z_1)} $$

## Fundamental Theorem of Algebra

$$ a_n z^n + a_{n-1} z^{n-1} + \ldots + a_1 z + a_0 = 0 \tag*{$a_n \neq 0$} $$

Has $n$ (possibly complex and or repeated) roots for all possible (complex) coefficients $a_0, \ldots, a_n$.

## Hyperbolic functions

> _Trig with a lisp._

$$ cosh(y) \equiv cos(iy) = \frac{1}{2}(e^{-y} + e^y) $$

$$ i\ sinh(y) \equiv sin(iy) = \frac{1}{2 i}(e^{-y} - e^y) $$

$$ tanh(y) \equiv \frac{sinh(y)}{cosh(y)} $$

Even function: $cosh(x) > 1$

Odd function: $sinh(x)$

Odd function: $-1 < tanh(x) < 1$


64a0291244366ee273aad23458c90b87f754c9bf
ipynb
Jupyter Notebook
docs/mathematics/complex_numbers.ipynb
JeppeKlitgaard/jepedia
c9af119a78b916bd01eb347a585ff6a6a0ca1782
MIT
docs/mathematics/complex_numbers.ipynb
JeppeKlitgaard/jepedia
c9af119a78b916bd01eb347a585ff6a6a0ca1782
MIT
docs/mathematics/complex_numbers.ipynb
JeppeKlitgaard/jepedia
c9af119a78b916bd01eb347a585ff6a6a0ca1782
MIT
Qwen/Qwen-72B
1. YES
2. YES