
# Refresher on complex numbers¶

$$i$$ is the imaginary unit:

$i \triangleq \sqrt{-1}$

Therefore:

$i^2 = -1$

Engineers often write the imaginary unit as $$j$$, and that is the convention that Python uses:

>>> 1j * 1j
(-1+0j)


An imaginary number is a real number multiplied by the imaginary unit. For example $$3i$$ is an imaginary number.

A complex number is a number that has a real part and an imaginary part. The real part is a real number. The imaginary part is an imaginary number.

For example, consider the complex number $$a = (4 + 3i)$$. $$a$$ has two parts. The first is a real number, often written as $$\R{a}$$, and the second is an imaginary number $$\I{a}$$:

$\begin{split}\R{a} = 4 \\ \I{a} = 3i\end{split}$

Now consider the complex number $$c = (p + qi)$$. $$\R{c} = p, \I{c} = qi$$.

To multiply a complex number $$c$$ by a real number $$r$$, we multiply both real and imaginary parts by the real number:

$r (p + qi) = (rp + rqi)$
>>> a = (4 + 3j)
>>> 2 * a
(8+6j)


Multiplying a complex number by an imaginary number follows the same logic, but remembering that $$i^2 = -1$$. Let us say $$s i$$ is our imaginary number:

$\begin{split}si (p + qi) = (s i p + s i q i) \\ = (s p i + s q i^2) \\ = (s p i - s q) \\ = (-s q + s p i)\end{split}$
>>> 3j * a
(-9+12j)