TExcelTAD
Home › Fourier Analysis & Signals › Complex Numbers Refresher

Complex Numbers Refresher

Fourier analysis is written in complex numbers because one complex exponential eiωte^{i\omega t} carries both the cosine and the sine of an oscillation, and multiplying complex numbers adds their angles. This refresher covers exactly what the course needs: Cartesian and polar forms, Euler's formula, conjugates and roots of unity. A longer treatment is in Calculus: Complex Numbers.

Two forms

A complex number z=a+ibz = a + ib (with i2=−1i^2 = -1) is a point (a,b)(a, b) in the plane. In polar form z=reiθz = r e^{i\theta}, where r=∣z∣=a2+b2r = \lvert z \rvert = \sqrt{a^2 + b^2} is the magnitude and θ=arg⁡z\theta = \arg z the angle. Euler's formula connects them:

eiθ=cos⁡θ+isin⁡θe^{i\theta} = \cos\theta + i \sin\theta

Multiplying multiplies magnitudes and adds angles: r1eiθ1⋅r2eiθ2=r1r2ei(θ1+θ2)r_1 e^{i\theta_1} \cdot r_2 e^{i\theta_2} = r_1 r_2 e^{i(\theta_1 + \theta_2)}.

python · try it yourself
import cmath, math

z = 3 + 4j
r, theta = abs(z), cmath.phase(z)
print("z =", z, " |z| =", r, " angle =", round(theta, 4), "rad =", round(math.degrees(theta), 2), "deg")
print("back from polar:", cmath.rect(r, theta))

w = cmath.exp(1j * math.pi / 2)            # e^{i pi/2} = i
print("e^(i pi/2) =", complex(round(w.real, 12), round(w.imag, 12)))
print("z * i =", z * 1j, " angle grew by 90 deg:", round(math.degrees(cmath.phase(z * 1j)), 2))
print("Euler's identity e^(i pi) + 1 =", cmath.exp(1j * math.pi) + 1)
z = (3+4j)  |z| = 5.0  angle = 0.9273 rad = 53.13 deg
back from polar: (3.0000000000000004+3.9999999999999996j)
e^(i pi/2) = 1j
z * i = (-4+3j)  angle grew by 90 deg: 143.13
Euler's identity e^(i pi) + 1 = 1.2246467991473532e-16j

The last line is 00 up to rounding, a tiny imaginary part of about 10−1610^{-16}.

Conjugates

The conjugate zˉ=a−ib\bar{z} = a - ib reflects zz across the real axis. Useful facts: zzˉ=∣z∣2z \bar{z} = \lvert z \rvert^2, Re⁡z=(z+zˉ)/2\operatorname{Re} z = (z + \bar{z})/2, and so

cos⁡θ=eiθ+e−iθ2,sin⁡θ=eiθ−e−iθ2i\cos\theta = \frac{e^{i\theta} + e^{-i\theta}}{2}, \qquad \sin\theta = \frac{e^{i\theta} - e^{-i\theta}}{2i}

A real cosine is the sum of two complex exponentials with opposite frequencies. That is why real signals have spectra at both +f+f and −f-f.

Roots of unity

The NN solutions of zN=1z^N = 1 are ωNk=e2πik/N\omega_N^k = e^{2\pi i k / N} for k=0,…,N−1k = 0, \ldots, N-1, equally spaced on the unit circle. They are the frequencies of the DFT, and their key property is that they sum to zero:

∑k=0N−1e2πikm/N={Nm≡0(modN)0otherwise\sum_{k=0}^{N-1} e^{2\pi i k m / N} = \begin{cases} N & m \equiv 0 \pmod N \\ 0 & \text{otherwise} \end{cases}
python · try it yourself
import numpy as np

N = 8
w = np.exp(2j * np.pi * np.arange(N) / N)
print("8th roots of unity:", [complex(round(z.real, 3) + 0.0, round(z.imag, 3) + 0.0) for z in w])
for m in (0, 1, 3, 8):
    s = np.sum(w ** m)
    print(f"sum of w^({m}k): {complex(round(s.real, 10) + 0.0, round(s.imag, 10) + 0.0)}")
8th roots of unity: [(1+0j), (0.707+0.707j), 1j, (-0.707+0.707j), (-1+0j), (-0.707-0.707j), -1j, (0.707-0.707j)]
sum of w^(0k): (8+0j)
sum of w^(1k): 0j
sum of w^(3k): 0j
sum of w^(8k): (8+0j)

This orthogonality of roots of unity is the whole reason the DFT can be inverted.

In software

  • Python has complex and the cmath module built in; NumPy arrays use complex128 (1j is the imaginary unit). Electrical engineers often write jj instead of ii, and so does Python.
  • np.abs, np.angle, np.conj, np.real, np.imag work element-wise on arrays.

Exercises

Exercise 1: Polar form

Write z=−1+iz = -1 + i in polar form.

Answer

z=2 e3πi/4z = \sqrt{2}\, e^{3\pi i / 4}.

Solution

∣z∣=1+1=2\lvert z \rvert = \sqrt{1 + 1} = \sqrt{2}, and the point (−1,1)(-1, 1) lies in the second quadrant at angle 135∘=3π/4135^\circ = 3\pi/4.

Exercise 2: Powers by angles

Compute (1+i)8(1 + i)^8 using polar form.

Answer
Solution

1+i=2 eiπ/41 + i = \sqrt{2}\, e^{i\pi/4}, so (1+i)8=(2)8e2πi=16⋅1=16(1 + i)^8 = (\sqrt{2})^8 e^{2\pi i} = 16 \cdot 1 = 16.

Exercise 3: Cosine from exponentials (code)

Check numerically that 12(eiθ+e−iθ)=cos⁡θ\frac{1}{2}(e^{i\theta} + e^{-i\theta}) = \cos\theta for θ=0.7\theta = 0.7.

Answer

Both give 0.764842 (with zero imaginary part).

Solution
python · try it yourself
import cmath, math
th = 0.7
z = (cmath.exp(1j * th) + cmath.exp(-1j * th)) / 2
print(round(z.real, 6), round(z.imag, 12) + 0.0, round(math.cos(th), 6))
0.764842 0.0 0.764842

Test yourself

Multiplying a complex number by ii…

  1. doubles its magnitude
  2. rotates it by 90 degrees
  3. conjugates it
  4. makes it real

Euler's formula states eiθ=e^{i\theta} =

  1. cos⁡θ−isin⁡θ\cos\theta - i\sin\theta
  2. cos⁡θ+isin⁡θ\cos\theta + i\sin\theta
  3. sin⁡θ+icos⁡θ\sin\theta + i\cos\theta
  4. eθ(cos⁡θ)e^\theta (\cos\theta)

The sum of all NN-th roots of unity (N≥2N \ge 2) is…

  1. NN
  2. 1
  3. 0
  4. −1-1