Complex Numbers in Polar Form
A complex number is a point in the plane, so like any point it can be described by a distance and an angle. In that polar form, multiplication becomes beautifully simple: multiply the lengths and add the angles. This lesson converts between the forms, explains why multiplying by a complex number is a rotation plus a scaling, and uses De Moivre's theorem to find powers and roots, with Python's built-in complex type and cmath module.
The complex plane
A complex number has a real part and an imaginary part , where (see Complex Numbers for a first introduction). Plot it as the point : the horizontal axis is real, the vertical axis imaginary. Then, exactly as in polar coordinates:
The short form comes from Euler's formula , which you can check by putting into the series for : the even powers give and the odd powers give .
Python writes as j:
import cmath
import math
z = 1 + 1j * math.sqrt(3) # 1 + √3 i
r, theta = cmath.polar(z)
print("z =", z)
print("r =", round(r, 6), " θ =", round(theta, 6), "=", round(math.degrees(theta), 4), "degrees")
print("back:", cmath.rect(r, theta))
print("Euler: e^(iπ) + 1 =", cmath.exp(1j * math.pi) + 1)z = (1+1.7320508075688772j)
r = 2.0 θ = 1.047198 = 60.0 degrees
back: (1+1.732050807568877j)
Euler: e^(iπ) + 1 = 1.2246467991473532e-16j
holds exactly in mathematics; the tiny leftover is floating-point rounding of .
Multiplication is rotation
Multiply two numbers in polar form:
Multiply the moduli, add the arguments. So multiplying by a number with rotates by and keeps lengths; multiplying by (, ) rotates a quarter turn: . Division divides the moduli and subtracts the arguments.
This is the 2D rotation formula in disguise. Rotating by gives , which is exactly the real and imaginary parts of .
import cmath
import math
point = 3 + 2j
w = cmath.exp(1j * math.radians(30)) # rotate 30° (|w| = 1)
print("rotated 30°:", point * w)
x, y, th = 3, 2, math.radians(30)
print("matrix form:", (x * math.cos(th) - y * math.sin(th), x * math.sin(th) + y * math.cos(th)))
print("times i :", point * 1j) # quarter turn
print("times 2i :", point * 2j, " |z| grows from", round(abs(point), 4), "to", round(abs(point * 2j), 4))rotated 30°: (1.598076211353316+3.232050807568877j)
matrix form: (1.598076211353316, 3.232050807568877)
times i : (-2+3j)
times 2i : (-4+6j) |z| grows from 3.6056 to 7.2111
Powers and roots: De Moivre
Multiplying by itself times multiplies times and adds times:
For example : , , so . No expansion needed.
Roots go the other way. The equation has exactly solutions: take the -th root of the modulus and divide the angle by , and add the different turns :
The -th roots of 1 (the roots of unity) are points evenly spaced on the unit circle: a regular polygon.
import cmath
import math
print("(1+i)^8 =", (1 + 1j)**8)
n = 6
roots = [cmath.exp(2j * math.pi * k / n) for k in range(n)]
for k, z in enumerate(roots):
print(f"k = {k}: {z.real:+.4f} {z.imag:+.4f}i angle {360 * k / n:5.1f}° z^6 ≈ 1: {abs(z**6 - 1) < 1e-12}")(1+i)^8 = (16+0j)
k = 0: +1.0000 +0.0000i angle 0.0° z^6 ≈ 1: True
k = 1: +0.5000 +0.8660i angle 60.0° z^6 ≈ 1: True
k = 2: -0.5000 +0.8660i angle 120.0° z^6 ≈ 1: True
k = 3: -1.0000 +0.0000i angle 180.0° z^6 ≈ 1: True
k = 4: -0.5000 -0.8660i angle 240.0° z^6 ≈ 1: True
k = 5: +0.5000 -0.8660i angle 300.0° z^6 ≈ 1: True
In software
- 2D rotation. Some engines and many quick scripts store a 2D orientation as a unit complex number: composing rotations is one complex multiply, and normalising it keeps rounding errors from creeping in. Quaternions extend the same idea to 3D (Quaternions).
- Signal processing. The Fourier transform writes a signal as a sum of terms; the roots of unity are the frequencies sampled by the FFT. Sound, images and radio all rely on it (Signals and Fourier).
- AC circuits and fractals. Electrical engineers use complex numbers for voltages with a phase; the Mandelbrot set iterates .
- Rotary position embeddings. Some LLMs encode a token's position by rotating pairs of numbers, which is multiplication by applied to pairs of coordinates.
Exercises
Exercise 1: To polar form
Write in polar form.
Answer
(, ).
Solution
Exercise 2: Multiply in polar form
and . Find and in polar form, and as .
Answer
; .
Solution
Exercise 3: A big power
Compute with De Moivre, then check in Python.
Answer
−64
Solution
import math
z = (math.sqrt(3) + 1j)**6
print(round(z.real, 9), round(z.imag, 9) + 0.0) # + 0.0 turns -0.0 into 0.0-64.0 0.0
Exercise 4: Spin a shape
Rotate the square with corners 1+1j, -1+1j, -1-1j, 1-1j by 45° using one complex multiplication per corner. Where do the corners end up?
Answer
On the axes at distance : , , , .
Solution
Each corner has modulus and argument 45°, 135°, 225°, 315°. Adding 45° gives 90°, 180°, 270°, 360°.
import cmath
import math
w = cmath.exp(1j * math.pi / 4)
for c in [1 + 1j, -1 + 1j, -1 - 1j, 1 - 1j]:
z = c * w
print(round(z.real, 4) + 0.0, round(z.imag, 4) + 0.0)0.0 1.4142
-1.4142 0.0
0.0 -1.4142
1.4142 0.0
Test yourself
What does multiplying a complex number by do to its point in the plane?
- Reflects it in the real axis
- Rotates it 90° counter-clockwise
- Doubles its length
- Rotates it 180°
If and , what is ?
- 7
- 5
- 12
- 1
How many solutions does have among the complex numbers?
- 5
- 1
- 2
- Infinitely many