|q⟩ Bad Qubits

beginner · Physics · Math Foundations: Complex Numbers

Checkpoint: Complex Number Workout

This checkpoint pulls together every complex-number skill from Module 1. Each sub-problem below targets one concept that quantum mechanics uses daily — read the derivations, then put them into code.

(A) Modulus and the Born rule

The modulus of z=a+biz = a + bi is the distance from the origin in the complex plane:

z=a2+b2.|z| = \sqrt{a^2 + b^2}.

For z=3+4iz = 3 + 4i: z=9+16=25=5|z| = \sqrt{9 + 16} = \sqrt{25} = 5.

The Born rule ties modulus to physics: if a quantum amplitude is zz, the probability of that outcome is z2|z|^2. Fluency with moduli is therefore fluency with quantum measurement.

(B) Complex multiplication and conjugates

Multiplying two complex numbers (a+bi)(c+di)=(acbd)+(ad+bc)i(a + bi)(c + di) = (ac - bd) + (ad + bc)i follows from treating i2=1i^2 = -1. Squaring 2+i2 + i:

(2+i)2=22+22i+i2=4+4i1=3+4i.(2 + i)^2 = 2^2 + 2\cdot 2\cdot i + i^2 = 4 + 4i - 1 = 3 + 4i.

The real part is 33.

The complex conjugate z=abiz^* = a - bi flips the imaginary sign. A key identity is zz=z2z \cdot z^* = |z|^2, which is why inner products in quantum mechanics always pair a bra with a ket: ψϕ\langle\psi|\phi\rangle implicitly conjugates one factor.

(C) Euler's formula and phases

Euler's formula is the bridge between exponentials and trigonometry:

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

So eiθe^{i\theta} has real part cosθ\cos\theta and imaginary part sinθ\sin\theta. For θ=π/3\theta = \pi/3:

Re ⁣(eiπ/3)=cos ⁣(π3)=12.\operatorname{Re}\!\left(e^{i\pi/3}\right) = \cos\!\left(\frac{\pi}{3}\right) = \frac{1}{2}.

Quantum states carry phase factors of the form eiθe^{i\theta}. Because eiθ2=cos2θ+sin2θ=1|e^{i\theta}|^2 = \cos^2\theta + \sin^2\theta = 1, a global phase never changes measurement probabilities — only relative phases between terms matter.

(D) Roots of unity and the unit circle

The nn-th roots of unity solve zn=1z^n = 1. There are exactly nn of them:

ωk=e2πik/n,k=0,1,,n1.\omega_k = e^{2\pi i k/n}, \quad k = 0, 1, \ldots, n-1.

They are equally spaced on the unit circle, so every root of unity has modulus 1. For n=5n = 5 the primitive root is ω=e2πi/5\omega = e^{2\pi i/5}, and

ω=e2πi/5=cos2 ⁣(2π5)+sin2 ⁣(2π5)=1.|\omega| = \left|e^{2\pi i/5}\right| = \sqrt{\cos^2\!\left(\tfrac{2\pi}{5}\right) + \sin^2\!\left(\tfrac{2\pi}{5}\right)} = 1.

Roots of unity appear in the quantum Fourier transform, the backbone of Shor's factoring algorithm.

Try it

Compute the four answers and return their sum. The four values are: (A) 3+4i|3+4i|, (B) Re((2+i)2)\operatorname{Re}((2+i)^2), (C) Re(eiπ/3)\operatorname{Re}(e^{i\pi/3}), and (D) e2πi/5|e^{2\pi i/5}|.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.