10 Complex Numbers
10.1 Basics
A complex number
is defined as
where
or
.
Re()
= a,
Im()
= b.
By Fundamental Theorem of Algebra, every polynomial of degree
is now guaranteed to have exactly
roots. For example, a quadratic equation will always yield two roots—if
they aren’t real, they will be complex.
10.1.1 Algebra w/
,
,
,
.
Inverse of
:
.
The rule
only works if at least one of the numbers is positive.
If both are negative, we have to pull the
out first.
For example, find
.
Wrong way is:
.
Instead, do
.
10.1.2 Representing complex numbers
3 ways to represent complex numbers:
Rectangular/Cartesian form: .
Best for addition/subtraction, and geometrically represents vector addition.Multiplication:
Division:
Polar form .
The modulus is .
The argument is , measured anti-clockwise from the positive real axis.Because angles loop every radians (), an argument isn’t uniquely defined. To fix this, Principal Argument is limited to the range .
Exponential .
Best for multiplication/division.Multiplication:
Division:
10.1.3 Complex conjugate
The complex conjugate of is Geometrically, this complex vector is reflected in the Real axis.
.
, and
10.2 De Moivre’s Theorem
Euler’s formula:
De Moivre’s Theorem: For a complex number
and any integer
,
De Moivre’s Theorem applied to roots:
So taking the
-th
root of a complex number will give
distinct angles.
Example Find
.
First convert to exponential form. Magnitude
.
Angle
.
Hence
.
Then we have
Then for
,
,
for
,
,
and for
,
.
Geoemetrically, the three roots are spaced
radians apart on a circle of radius 0.89.
10.3 Discrete Fourier Transform (DFT)
10.3.1 Complex exponentials & vectors
Think of complex numbers as moving geometric objects.
A complex exponential like
can be thought of as a rotating clock hand in the argand plane, around
the centre.
Replacing the static angle
with
,
where
can be thought of as the angular frequency (how many radians per sample)
and
is the sample we are measuring.
A complex vector then represents snapshots of the rotating clock hand.
For example, a vector like
tell us that at each
time-step
(
increasing by 1), we rotate anti-clockwise by
radians.
Further, stack these 2D snapshots on top of each other, and pull them
forward along a time axis. We get a 3D spiral.
10.3.2 Inner product and inverse of complex matrices
If we have a complex vector like
, and taking the dot
product with itself, we get
,
which is impossible as the length of that vector is non-zero.
Instead, if we multiply a complex number with its conjugate, like
,
we get the positive result desired.
Therefore, the inner product of complex vectors
and
is
where
(Hermitian/conjugate transpose) transposes
and takes the conjugate of every imaginary number in it.
In the context of DFT, the inner product reveals the relationship
between some signal wave and a basis wave. Two complex vectors are
considered to be pointing in the same direction if they are rotating at
the exact same frequency.
If the inner product outputs 0, the signal vector has zero component in
the direction of the basis vector (orthogonal). In DFT, this means the
specific frequency does not exist in the signal.
Otherwise, the complex scalar output reveals the magnitude and
phase-shift to shift the signal wave so as to align it to the basis
vector.
10.3.3 The real meat
The idea of DFT is that any discrete time-signal
of length
can be decomposed into/rebuilt using
basic waves.
The original signal is
of length
.
This means we sampled
discrete times from the original signal, and the values form the vector
of
complex numbers.
How to represent the basic waves?
Each basis vector contains
complex numbers (same as the original signal).
We generate a basis vector for every harmonic frequency. There are
of these basis vectors (indexed by
).
So to build the
-th
basis vector, we take
time-steps through that basis vector, using the formula:
Each basis vector thus looks like this:
We use that specific complex exponential because:
By Euler’s formula (), it packages a cosine and sine wave, so we can encapsulate the amplitude and phase.
Notice that the "angular frequency" . So when step , we get , when is 1 (the starting point). It is thus periodic around .
is the frequency index. It determines how many full cycles we complete over steps. E.g. basis wave spins twice as fast as basis wave. The magic is that two waves with different will have their peaks and valleys perfectly misaligned in a balanced way. When you take the inner product of both waves, we get exactly 0.
The magnitude is 1 for every term, so multiplying the signal by these basis vectors only act as a rotational tool.
As noted above, every basis vector is orthogonal to each other.
Forward DFT (Analysis)
Forward DFT is breaking down the messy signal to find the frequencies
that make up that signal.
From
,
we want
,
a column vector of
frequency bins. Each term in
,
denoted as
is a complex number.
The magnitude
tells us the amplitude of that specific frequency, and the phase
tells us how much it is shifted left or right.
The forward DFT has the following matrix equation:
is an
matrix. Representing
,
the formula for any term in
is just
,
at row
and column
.
Note that every row is one basis vector/wave.
The exponents are negative so as to take the complex conjugate of the
actual basis vector, for valid inner products. However, intuitively, if
a signal contains some harmonic
,
it is spinning anti-clockwise at speed of
.
Our basis vector should then spin in the opposite direction (negative
exponent) at the same speed, effectively unwinding that specific
frequency. Mathematically,
Then adding up all the constant values, we get a massive spike for that
frequency bin.
On the other hand, if the test wave spins at different speeds, it
doesn’t perfectly unwind the signal, and the positive and negative peaks
cancel out to 0.
By basic matrix multiplication, the
-th
entry of
,
is the inner product of the
-th
row of
and the column vector
.
Hence we get the summation form of the forward DFT:
Hence, we get
from
using
,
the matrix of basis vectors. Note that
is fixed, and we can construct
(from the complex exponential) so long as we know
(from length of
).
Backward DFT (Synthesis)
Now we have
,
the mix of different frequencies, and we want to get back
,
the original signal.
The matrix equation here is:
Recall that
is the conjugate transpose of
.
The exponents are positive, i.e.
.
Also, the columns of
are now the basis vectors.
So
is the linear combination of the columns of
,
and
provides the weights to scale each corresponding frequency by.
Note that we need to multiply by
.
Since
,
and
,
hence
balances the equation.
Each term of
is now
and the full matrix
is
By matrix multiplication,
the
-th
entry of
is obtained by taking inner product of
-th
row of
and the column vector
.
I.e. the sum of all same time snapshot
across all the different frequencies.
A note on the matrix
,
as we progress down the rows,
increases. The waves spin faster.
For a purely real-valued
,
I.e. frequencies that are symmetrical around the
point look like negative frequencies (spinning backwards).
Hence, a real-valued signal
has unique information in rows 0 to
,
while rows
to
are redundant.
If
is complex, every single one of the
rows is unique and necessary