Lesson 1 · 45 min · introductory
Complex Numbers & Euler's Formula
The arithmetic of , the modulus and conjugate, polar form, Euler's formula derived from the exponential power series, De Moivre's theorem and the roots of unity whose vanishing sums power the quantum Fourier transform.
Objectives and key results
Perform addition, multiplication and division in in Cartesian form .
Convert between Cartesian form and polar form .
Use and the multiplicativity .
Apply Euler's formula to multiply phases, compute powers with De Moivre's theorem, and evaluate sums of roots of unity.
- formula · Complex multiplication
- identity · Modulus squared
- theorem · Euler's formula
- identity · Polar multiplication
- identity · Sum of roots of unity
Why quantum mechanics needs complex numbers#
Every quantum state you will meet on this platform is a list of complex numbers called amplitudes. A single qubit is described by two of them, and , in ; a register of qubits needs of them. Real numbers are not enough: the phenomenon of interference, in which two computational paths cancel each other, depends on amplitudes that carry a direction (a phase) as well as a size. A phase can rotate a contribution by any angle, not just flip its sign, and the natural language for rotations in a plane is the complex numbers.
This lesson builds the arithmetic of from scratch and proves every identity used later in the curriculum. The single most important result is Euler's formula , which turns multiplication of complex numbers into addition of angles. It is the reason phase gates such as and are so easy to compose, and the reason the quantum Fourier transform works.
Definition
Complex number
A complex number is an expression with and the imaginary unit satisfying . The number is the real part and is the imaginary part. Two complex numbers are equal exactly when their real parts are equal and their imaginary parts are equal. Geometrically, is the point of the complex plane, with the real axis horizontal and the imaginary axis vertical. The set of all complex numbers is denoted .
Addition is component-wise, , exactly like adding arrows in the plane. Multiplication is defined by expanding the product with the ordinary distributive law and then replacing by . The derivation below is the only rule you ever need to memorise; everything else follows from it.
The multiplication rule
- Step 1:Distribute each term of the first factor over each term of the second.
- Step 2:Real numbers commute with , so collect the factors of in each term.
- Step 3:Use the defining relation .
- Step 4:Group the real terms and the terms multiplying .
Worked example. Take and . With :
Addition gives and subtraction . With the addition and multiplication rules, is a field: both operations are associative and commutative, multiplication distributes over addition, and are the neutral elements, and (as we prove next) every nonzero number has a multiplicative inverse.
Conjugate, modulus and division#
Definition
Complex conjugate and modulus
The complex conjugate of is , the mirror image of in the real axis. The modulus (absolute value) is , the Euclidean distance from to the point . Conjugation reverses the sign of the imaginary part only, so , and is real exactly when .
The modulus squared is
For every we have . In particular is a non-negative real number, and it is zero only for .
Proof (4 steps)
- Step 1:Definition of the conjugate: .
- Step 2:Multiplication rule with , .
- Step 3:The imaginary part cancels exactly.
- Step 4:Definition of the modulus; a sum of two real squares vanishes only when both squares vanish.
∎
Conjugation respects products
For all : (and also ).
Proof (4 steps)
- Step 1:Write , , multiply, then flip the sign of the imaginary part.
- Step 2:Multiplication rule applied to and .
- Step 3:Simplify the signs and compare with the first line.
- Step 4:Addition is component-wise, so conjugating the sum conjugates each summand.
∎
The modulus is multiplicative
For all : .
Proof (4 steps)
- Step 1:Apply to .
- Step 2:Conjugation respects products (previous lemma).
- Step 3:Multiplication in is commutative and associative, so the four factors can be regrouped.
- Step 4:Both sides are non-negative reals, so take the non-negative square root.
∎
The multiplicative inverse
- Step 1:A nonzero complex number has at least one nonzero component.
- Step 2:Dividing by the positive real number is multiplication by the real number .
- Step 3:Use .
- Step 4:The number that multiplies to is by definition its inverse; it is unique because is a field.
Worked example. For we have and , so
Check: . To divide by multiply numerator and denominator by :
Multiplicativity of the modulus is a useful sanity check: , , and indeed .
Polar form and Euler's formula#
A point of the plane can be located either by Cartesian coordinates or by its distance from the origin together with the angle measured counter-clockwise from the positive real axis. Elementary trigonometry gives and , so
The angle is the argument (or phase) of . It is defined only up to adding integer multiples of ; the principal value lies in and is computed as , which respects the quadrant of . For example has and , whereas has and even though both have .
The combination appears so often that it deserves a shorter name. Euler discovered that it is precisely the exponential function evaluated at the imaginary number . We define the complex exponential by the same power series as the real one, , which converges for every , and derive the formula.
Euler's formula
For every real , . Consequently and every complex number can be written with and .
Proof (8 steps)
- Step 1:Definition of the exponential by its power series.
- Step 2:Since the series converges absolutely, so its terms may be regrouped in any order without changing the sum.
- Step 3:Split the terms into even indices and odd indices (allowed by absolute convergence).
- Step 4:Powers of cycle with period four: .
- Step 5:Substitute the powers of and pull the common factor out of the odd series.
- Step 6:These are exactly the Taylor series of and , which converge for all real .
- Step 7:Modulus of a number with real part and imaginary part , plus the Pythagorean identity.
- Step 8:Insert Euler's formula into the trigonometric polar form.
∎
Special values follow immediately: , (so ), and . The conjugate of a phase is the opposite phase, , so for we have . The number is the nontrivial entry of the gate.
Worked conversions. has and lies in the second quadrant with , , hence and . Conversely .
Polar multiplication and De Moivre#
Multiplication multiplies moduli and adds arguments
For and real : .
Proof (5 steps)
- Step 1:Euler's formula for each factor.
- Step 2:Multiplication rule with , , , .
- Step 3:Angle-addition formulas for cosine and sine.
- Step 4:Euler's formula read backwards.
- Step 5:Real numbers commute with complex numbers, so the moduli can be collected in front.
∎
De Moivre's theorem
For every integer and real : , i.e. .
Proof (5 steps)
- Step 1:Base case: every number to the power zero is , and .
- Step 2:Inductive step: definition of the -st power.
- Step 3:Induction hypothesis for .
- Step 4:Polar multiplication theorem: moduli multiply, arguments add.
- Step 5:Specialise to unit modulus and apply Euler's formula on both sides.
∎
Worked example. Compute . In polar form , so by De Moivre
Doing this in Cartesian form requires three squarings: , , . The polar route scales to any power in one line.
Worked example (phase gates). The gate applied twice multiplies the amplitude by , which is why ; four applications give , so . Multiplying by adds to its argument and multiplies the modulus by , giving .
Roots of unity and their sums#
Definition
N-th roots of unity
For an integer let . The numbers , , are the -th roots of unity: by De Moivre . They are the vertices of a regular -gon inscribed in the unit circle, starting at . Because , the powers are periodic: , so exponents can always be reduced modulo .
Orthogonality of the roots of unity
For every integer :
Proof (7 steps)
- Step 1:If divides , every term is because is an integer and .
- Step 2:A sum of ones.
- Step 3:only for , and is not an integer.
- Step 4:Name the sum (note ) and multiply it by , shifting every exponent by one.
- Step 5:All terms appear in both sums and cancel (telescoping).
- Step 6:is an integer, so .
- Step 7:Divide by .
∎
Worked example. For we have and the roots are . With : . With : . With : every term is and the sum is . Geometrically, for the points are spread symmetrically around the circle and their centre of mass is the origin.
This identity is the engine of the quantum Fourier transform: the QFT matrix has entries , and the theorem above is exactly the statement that its columns are orthonormal, i.e. that the QFT is unitary. When amplitudes are summed with phases that go all the way around the circle they cancel, and only the frequencies that match survive.
import { cadd, cexpi, cmul, cabs, cformat, c } from '@/lib/quantum-simulator/complex';
// (3 + 4i)(1 - 2i) = 11 - 2i and |zw| = |z||w| = 5 * sqrt(5)
const z = c(3, 4);
const w = c(1, -2);
const zw = cmul(z, w);
console.log('zw =', cformat(zw), ' |zw| =', cabs(zw).toFixed(6), ' |z||w| =', (cabs(z) * cabs(w)).toFixed(6));
// (1 + i) * e^{i pi/4} = sqrt(2) i : moduli multiply, arguments add
console.log('(1+i)e^{i pi/4} =', cformat(cmul(c(1, 1), cexpi(Math.PI / 4))));
// sum over k of omega_N^{jk} equals N if N divides j, else 0
const N = 8;
for (const j of [0, 1, 3, 8]) {
let s = c(0, 0);
for (let k = 0; k < N; k++) s = cadd(s, cexpi((2 * Math.PI * j * k) / N));
console.log('j =', j, ' sum =', cformat(s, 6));
}Expected output
zw = 11-2i |zw| = 11.180340 |z||w| = 11.180340
(1+i)e^{i pi/4} = 1.4142i
j = 0 sum = 8
j = 1 sum = 0
j = 3 sum = 0
j = 8 sum = 8Check your understanding#
Quick check
Compute (give a decimal).
Quick check
Which number is ?
Quick check
What is the imaginary part of ?
Quick check
Evaluate with (enter the real number it equals).
Quick check
Using De Moivre, what is ?
References
- M. A. Nielsen, I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press (2010), §2.1 (notation) and §5.1 (roots of unity in the quantum Fourier transform).
- T. Needham, Visual Complex Analysis, Oxford University Press (1997), Ch. 1 (geometry of complex multiplication) and Ch. 2 (the complex exponential).
- E. M. Stein, R. Shakarchi, Complex Analysis, Princeton University Press (2003), Ch. 1 §1–2 (power series and the exponential).
- S. Axler, Linear Algebra Done Right, 4th ed., Springer (2024), §1A (complex numbers).linear.axler.net
Hands-on labs
Multiply by a phase
1 step · auto-gradedOpen labCompute in Cartesian form, using Euler's formula and polar multiplication.