|q⟩ Bad Qubits

beginner · Programming · The Qubit State Vector & Dirac Notation

Amplitude as a Complex Number

The amplitudes in a quantum state vector are complex numbers, not just real ones. Understanding their structure — magnitude and phase — is the key to reading and predicting quantum behaviour.

Complex numbers in one minute

A complex number can be written in rectangular form as

α=a+bi,\alpha = a + b\,i,

where aa is the real part, bb is the imaginary part, and i=1i = \sqrt{-1}. Equivalently, the same number has a polar form

α=reiθ,\alpha = r\,e^{i\theta},

where the magnitude (or modulus) is

r=α=a2+b2r = |\alpha| = \sqrt{a^2 + b^2}

and the phase (or argument) is the angle θ=arctan(b/a)\theta = \arctan(b/a) measured from the positive real axis in the complex plane.

The relationship between the two forms follows from Euler's identity eiθ=cosθ+isinθe^{i\theta} = \cos\theta + i\sin\theta, which gives a=rcosθa = r\cos\theta and b=rsinθb = r\sin\theta.

Why quantum amplitudes must be complex

A general single-qubit state is

ψ=α0+β1,|\psi\rangle = \alpha|0\rangle + \beta|1\rangle,

where α\alpha and β\beta are complex amplitudes. The Born rule says the probability of measuring outcome 00 is

P(0)=α2=αα,P(0) = |\alpha|^2 = \alpha^* \alpha,

so only the magnitude of an amplitude determines measurement probabilities. The phase of an amplitude — or more precisely the relative phase between two amplitudes — controls interference. When you apply a gate that changes relative phases (for example the ZZ gate, which sends 11|1\rangle \to -|1\rangle), measurement statistics can change dramatically after further gates exploit that phase difference. This is the engine behind most quantum speedups.

Decomposing an example amplitude

Consider α=12+32i\alpha = \tfrac{1}{2} + \tfrac{\sqrt{3}}{2}\,i. Its magnitude is

= \sqrt{\tfrac{1}{4} + \tfrac{3}{4}} = \sqrt{1} = 1.$$ Its phase is $\theta = \arctan\!\left(\tfrac{\sqrt{3}/2}{1/2}\right) = \arctan(\sqrt{3}) = \tfrac{\pi}{3}$, so in polar form $\alpha = e^{i\pi/3}$. An amplitude with unit magnitude like this is called a **phase factor**. Note that a single amplitude having unit magnitude does not mean the state is normalized: normalization requires $|\alpha|^2 + |\beta|^2 = 1$ for the full state vector. What is harmless is multiplying the *entire* state by one global phase $e^{i\varphi}$, since every probability $|\alpha_k|^2$ is unchanged — consistent with the callout above. ## Try it Compute the magnitude of $\alpha = \tfrac{1}{2} + \tfrac{\sqrt{3}}{2}\,i$ and return it as a number. <RunnableExample />

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