Complex Numbers in One Page
Complex numbers appear in this module for exactly one reason, and it is worth stating up front so you know how much of this page you need.
A matrix full of real numbers can have eigenvalues that are not real. A rotation is the standard example: it turns every vector, so there is no direction it merely stretches, so there is no real eigenvector — and yet the characteristic polynomial still has roots, because polynomials always do once you allow complex numbers. §4.2 hits this on its second example, and a reader who has never seen stalls there.
That is the whole motivation. This page covers what you need for it and stops.
What you’ll learn
Section titled “What you’ll learn”- What is, and why it was invented.
- The complex plane, and why multiplication by a complex number is a rotation-and-scale.
- Modulus and argument, and Euler’s formula tying them to and .
- Conjugates, and why complex eigenvalues of a real matrix always come in pairs.
- The precise reason a rotation matrix has no real eigenvalues.
Intuition: a number that turns things
Section titled “Intuition: a number that turns things”Real numbers live on a line. Multiplying by a positive real stretches along that line; multiplying by flips it — a rotation by .
So ask: what would rotate by ? Doing it twice must give the flip, so it must be a number whose square is . No real number qualifies, so we name one:
Read as “the quarter turn” rather than “the square root of minus one”. That reading makes everything below obvious instead of mysterious, and it is exactly the reading that connects complex numbers to rotation matrices.
flowchart LR R["multiply by a positive real
stretch along the line"] --> P["the real line is not enough"] N["multiply by -1
rotate by 180 degrees"] --> P P --> Q["what rotates by 90 degrees?
its square must be -1"] Q --> I["call it i
now numbers live on a plane"] I --> M["multiplying by a+bi
= scale by modulus, rotate by argument"]
The math
Section titled “The math”The plane
Section titled “The plane”A complex number is a pair of reals wearing one symbol:
Plot horizontally and vertically and you have the complex plane. A complex number is a point in — with one extra piece of structure real pairs do not have: a way to multiply two of them together and get a third.
Arithmetic
Section titled “Arithmetic”Addition is componentwise, exactly like vectors:
Multiplication is where the structure is. Expand and use :
The minus sign in is the entire content of , and it is the reason multiplication rotates.
Modulus and argument
Section titled “Modulus and argument”The modulus is the distance from the origin — the Euclidean norm of the pair, which is why §3.1’s norms carry over unchanged. The argument is the angle from the positive real axis.
In these terms, multiplication is simple:
Moduli multiply, arguments add. Multiplying by scales by and rotates by . Check it on : modulus , argument . So multiplying by rotates by a quarter turn and changes no length — which is what we asked for at the start.
Euler’s formula
Section titled “Euler’s formula”So any complex number factors into “how big” times “which way”:
Two consequences used later:
- always has modulus — it is a point on the unit circle, and is the angle.
- Multiplying two of them adds the exponents, which is the “arguments add” rule again, now as ordinary index arithmetic.
Setting gives : a half turn is multiplication by , as promised.
Conjugates
Section titled “Conjugates”Reflection across the real axis. Two properties do real work:
The first says a complex number times its conjugate is real and non-negative — which is how you divide by a complex number, and the reason appears wherever a magnitude is needed.
The second gives the fact §4.2 depends on:
The one place you need this
Section titled “The one place you need this”The rotation matrix by angle :
Its characteristic polynomial is
with discriminant
Negative whenever . So for any rotation that is not by or the eigenvalues are complex:
Look at what that says. The eigenvalues of a rotation by are : modulus , argument . The matrix rotates by ; its eigenvalues are the rotation by , written as complex numbers. Modulus says lengths are preserved, which is exactly §3.9’s claim that rotations are orthogonal transformations — recovered from the eigenvalues.
And “no real eigenvalue” now has a geometric meaning rather than an algebraic one: a rotation turns every direction, so there is no direction it merely scales.
Worked example by hand
Section titled “Worked example by hand”Take , so .
Characteristic polynomial: . Roots .
Check the eigenvector for . We need :
The second row gives . Take , so . Verify:
using in the top entry. And the conjugate pair: with .
Now arithmetic on and , every quantity by hand:
| quantity | working | result |
|---|---|---|
| rad, | ||
| rad, | ||
| rad, | ||
Check the last modulus directly: . Matches. Moduli multiplied and arguments added, exactly as claimed.
See it move
Section titled “See it move”Drag the two complex numbers and watch the product. The dashed circle has radius : the product always lands on it, because moduli multiply. The angles add head to tail.
Set both moduli to . The product stays on the unit circle no matter how you turn the arguments — pure rotation, no scaling. Those unit-modulus complex numbers are precisely the eigenvalues of , and “modulus one” is “lengths preserved”.
From scratch
Section titled “From scratch”import numpy as np
z, w = 3 + 4j, 1 - 2j # Python writes the imaginary unit as j, not i
print("z + w :", z + w) # (4+2j)
print("z * w :", z * w) # (11-2j)
print("|z| :", abs(z), " |w|:", round(abs(w), 7))
print("|zw| == |z||w| :", np.isclose(abs(z * w), abs(z) * abs(w)))
print("arg z :", round(np.angle(z), 7), " arg w:", round(np.angle(w), 7))
print("arg zw == arg z + arg w :",
np.isclose(np.angle(z * w), np.angle(z) + np.angle(w)))
print("z * conj(z) :", z * z.conjugate(), " == |z|^2 =", abs(z) ** 2)
# Euler's formula, checked numerically.
theta = np.pi / 3
print("e^{i.theta} == cos + i sin :",
np.isclose(np.exp(1j * theta), np.cos(theta) + 1j * np.sin(theta)))
print("e^{i.pi} :", np.round(np.exp(1j * np.pi), 12))
# The rotation matrix: real entries, complex eigenvalues.
theta = np.pi / 2
R = np.array([[np.cos(theta), -np.sin(theta)],
[np.sin(theta), np.cos(theta)]])
vals, vecs = np.linalg.eig(R)
print("R is real:", np.isrealobj(R), " eigenvalues:", np.round(vals, 10))
print("moduli all 1:", np.allclose(np.abs(vals), 1.0))
print("conjugate pair:", np.isclose(vals[0], vals[1].conjugate()))
print("eigenvalues equal exp(+-i.theta):",
np.allclose(np.sort_complex(vals),
np.sort_complex(np.array([np.exp(1j*theta), np.exp(-1j*theta)]))))
# Odd size forces a real eigenvalue: rotation about the z axis in 3-D.
R3 = np.array([[np.cos(theta), -np.sin(theta), 0.0],
[np.sin(theta), np.cos(theta), 0.0],
[0.0, 0.0, 1.0]])
v3 = np.linalg.eigvals(R3)
print("3x3 rotation eigenvalues:", np.round(v3, 10))
print("has a real one (the axis):", np.any(np.isclose(v3.imag, 0.0)))z + w : (4+2j)
z * w : (11-2j)
|z| : 5.0 |w|: 2.236068
|zw| == |z||w| : True
arg z : 0.9272952 arg w: -1.1071487
arg zw == arg z + arg w : True
z * conj(z) : (25+0j) == |z|^2 = 25.0
e^{i.theta} == cos + i sin : True
e^{i.pi} : (-1+0j)
R is real: True eigenvalues: [0.+1.j 0.-1.j]
moduli all 1: True
conjugate pair: True
eigenvalues equal exp(+-i.theta): True
3x3 rotation eigenvalues: [0.+1.j 0.-1.j 1.+0.j]
has a real one (the axis): TrueThe last two lines are the counting argument, executed. The rotation has no real eigenvalue; the one has exactly one, and it is — the axis, which the rotation leaves completely alone.
Pitfalls
Section titled “Pitfalls”Compare
Section titled “Compare”| matrix property | eigenvalues | practical consequence |
|---|---|---|
| real symmetric | all real, orthogonal eigenvectors | use eigh; the spectral theorem applies (§4.2) |
| real, not symmetric | may be complex, in conjugate pairs | use eig; expect a complex dtype |
| rotation | , modulus | length preserving; no real invariant direction (§3.9) |
| real, odd size | at least one real eigenvalue | a 3-D rotation always has an axis |
| covariance matrix | real, all | it is symmetric positive semidefinite (§6.4) |
The first and last rows are the reason most of machine learning never meets a complex number: covariance matrices, Gram matrices and Hessians are all symmetric, and symmetric real matrices have real eigenvalues. Complex arithmetic shows up when a matrix is not symmetric — a rotation, a transition matrix, the Jacobian of a dynamical system.
-
What happens to modulus and argument when two complex numbers are multiplied?
Which is why multiplying by a complex number is a scale-and-rotate, and why a unit-modulus factor is a pure rotation.
pch.quizShowAnswer
C — Moduli multiply and arguments add — Which is why multiplying by a complex number is a scale-and-rotate, and why a unit-modulus factor is a pure rotation.
-
Why can a real matrix have complex eigenvalues?
A rotation's characteristic polynomial has discriminant minus four sine squared, which is negative for any genuine rotation. Real coefficients, complex roots, and the eigenvalues turn out to be e to the plus or minus i theta.
pch.quizShowAnswer
B — Because the characteristic polynomial can have no real roots, even though its coefficients are real — A rotation's characteristic polynomial has discriminant minus four sine squared, which is negative for any genuine rotation. Real coefficients, complex roots, and the eigenvalues turn out to be e to the plus or minus i theta.
-
A real five-by-five matrix must have at least one real eigenvalue. Why?
Conjugating the eigenvalue equation shows the conjugate is also an eigenvalue, so complex ones arrive two at a time. An odd count leaves at least one unpaired, which therefore must be real — this is why a 3-D rotation always has an axis.
pch.quizShowAnswer
B — Complex eigenvalues of a real matrix come in conjugate pairs, and five cannot be made entirely of pairs — Conjugating the eigenvalue equation shows the conjugate is also an eigenvalue, so complex ones arrive two at a time. An odd count leaves at least one unpaired, which therefore must be real — this is why a 3-D rotation always has an axis.
-
You call np.linalg.eig on a real covariance matrix and get a complex dtype with negligible imaginary parts. What is the right response?
A covariance matrix is symmetric, so the spectral theorem guarantees real eigenvalues; the imaginary parts are pure numerical noise from the general-purpose routine. eigh assumes symmetry, is faster, and returns real values by construction.
pch.quizShowAnswer
B — Use eigh instead, which exploits symmetry and returns real values — A covariance matrix is symmetric, so the spectral theorem guarantees real eigenvalues; the imaginary parts are pure numerical noise from the general-purpose routine. eigh assumes symmetry, is faster, and returns real values by construction.
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – Multiplying by i is a quarter turn
Section titled “Exercise 1 – Multiplying by i is a quarter turn”Exercise 2 – Moduli multiply
Section titled “Exercise 2 – Moduli multiply”Exercise 3 – Euler’s formula
Section titled “Exercise 3 – Euler’s formula”Exercise 4 – A rotation’s eigenvalues
Section titled “Exercise 4 – A rotation’s eigenvalues”Exercise 5 – Symmetric matrices stay real
Section titled “Exercise 5 – Symmetric matrices stay real”Recall card
Section titled “Recall card”- Read as the quarter turn, not as the square root of minus one — the geometry then explains the algebra.
- A complex number is a point in the plane with one extra structure real pairs lack: a multiplication.
- Multiplying multiplies moduli and adds arguments, so multiplication is a scale-and-rotate and a unit-modulus factor is a pure rotation.
- Euler’s formula — e to the i theta is the unit-circle point at angle theta, so any complex number factors into size times direction.
- A number times its conjugate is its modulus squared, real and non-negative.
- Complex eigenvalues of a real matrix come in conjugate pairs, because conjugating the eigenvalue equation leaves a real matrix alone.
- An odd-sized real matrix therefore has at least one real eigenvalue — which is why a 3-D rotation always has an axis.
- A rotation by theta has eigenvalues e to the plus or minus i theta — modulus one, meaning lengths are preserved, with no real invariant direction.
- Symmetric real matrices always have real eigenvalues, which is why covariance matrices, Gram matrices and Hessians never need complex arithmetic. Use
eigh, noteig. - There is no ordering on the complex numbers, so “largest eigenvalue” always means largest modulus.
Next: the tool you will check every derivation against — NumPy for Mathematics.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading