Complex numbers as rotations

Why signal processing runs on complex numbers — multiplying by e^{iθ} is turning, and a turning arrow casts a sine wave.

What you'll learn
  • Do complex arithmetic and convert between Cartesian and polar form
  • See multiplication by e^{iθ} as a rotation that keeps the length
  • Connect a rotating complex number to a cosine wave

A complex number \(a = x + iy\) is a point in the plane: \(x\) along the real axis, \(y\) along the imaginary one. complex_number.m works through the basic operations with \(a = 4 + 3i\) and \(b = 7 + 8i\):

a = complex(4,3)
b = complex(7,8)
z3 = a*b          % multiplication
amag1 = a*conj(a) % magnitude squared
amag3 = abs(a)    % magnitude
aphase = angle(a) % phase
Operation Result
\(a + b\) \(11 + 11i\)
\(a \cdot \bar{a}\) \(25\) — always real: the squared length
\(a \cdot b\) \(4 + 53i\)
\(a / b\) \(0.4602 - 0.0973i\)
\(\vert a \vert\), \(\angle a\) \(5\), \(0.6435\) rad (36.9°)

Polar form: length and angle

The script ends by drawing \(a\) twice, once on Cartesian axes and once with polar. The polar view is the one signal processing lives in. Euler’s formula

\[e^{i\theta} = \cos\theta + i \sin\theta\]

says that \(e^{i\theta}\) is the point at angle \(\theta\) on the unit circle, so any complex number is a length times a direction: \(a = \vert a\vert\, e^{i\angle a} = 5\,e^{0.6435 i}\).

In that form multiplication becomes simple: lengths multiply and angles add. Multiplying by \(e^{i\theta}\), whose length is 1, changes nothing but the angle — it is a pure rotation.

A turning arrow casts a wave

Let the angle grow steadily with time, \(\theta = \omega t\). The point \(a\,e^{i\omega t}\) goes round a circle of radius 5, and its real part traces

\[\operatorname{Re}\big(a\,e^{i\omega t}\big) = 5\cos(\omega t + 0.6435).\]
The point a·e^{iωt} (orange) for a = 4 + 3i circling the origin. Its shadow on the real axis (blue dot) moves as a cosine, traced on the right. The length of a sets the amplitude, its angle the phase.

That is the whole trick behind the rest of the course. A sinusoid with amplitude \(A\) and phase \(\varphi\) is one complex number \(A e^{i\varphi}\) — a phasor — set spinning. Adding sinusoids of the same frequency means adding their phasors as vectors; delaying a signal means rotating its phasor; and the Fourier transform, in lesson 3, measures how much of each spinning phasor a signal contains.

Try it yourself. In NumPy, compute a = 4+3j and a * np.exp(1j*np.pi/2). Check that the result is \(-3 + 4i\) — a quarter turn — and that its abs is still 5. Then show that np.exp(1j*w*t).real and np.cos(w*t) agree for an array t.

View source on GitHub →