In this guide, you'll learn the mathematical model we use to represent qubits. The model was invented by a brilliant mathematician named John von Neumann, and has proven to be extremely successful. It has been tested time and time again, and it keeps predicting the world accurately. That's what makes a good model!
P.S. Many folks confuse the model for the qubits. They think a qubit is the math you'll see below. This is a simple misunderstanding. Physics is the field dedicated to building mathematical models that accurately represent what we see in nature. Qubits are natural, physical objects which we cannot even begin to comprehend. The mathematics below is just a model — a tool — we've built to predict their behavior.
The single qubit
There are two common ways to write down the state of a qubit: one is intuitive, the other is extremely useful. The intuitive one is to write down its Bloch vector, a vector in 3D space — you can learn all about it in the what is a qubit? guide. This is easy to picture, but it hits some serious limitations when you try to represent qubits while they're entangled. So for any serious work, we use what's known as statevector notation.
Statevector notation is nice because it's grounded in what our measurement results might be if we measure our qubit.
Step 1: pick the measurement outcomes
The first step is to choose what the results of our quantum measurement could be. For example, in the famous Stern-Gerlach experiment, Stern and Gerlach were measuring whether the spin of an electron was up or down. Their measurement results were up or down.
We give those two outcomes names. By convention, we write them in ket notation:
|0⟩
Read it "ket zero." Our convention for the first outcome — e.g.
upin Stern-Gerlach.|1⟩
Read it "ket one." The other outcome — e.g.
downin Stern-Gerlach.
Step 2: write the state as a vector
A statevector is just a vector whose entries correspond to how much weight (or amplitude) is on each measurement outcome. The 1st entry corresponds to the amplitude for |0⟩, the 2nd entry to the amplitude for |1⟩.
We picture the two outcomes as two perpendicular axes (|0⟩ and |1⟩) and the state |ψ⟩ as a vector in that plane.
In ket form we'd write the same thing as |ψ⟩ = α|0⟩ + β|1⟩. As a column vector it's just [α, β].
|ψ⟩ = α|0⟩ + β|1⟩ ⇔ [α, β]
Amplitudes aren't probabilities
Amplitude is a concept you'll become familiar with. The amplitude is not a probability — it's the "square root" of a probability. For example, if a state has an amplitude of 1/√2 for |0⟩, the probability of measuring |0⟩ is (1/√2)² = 1/2 = 50%. This is called the Born rule.
P(measure |0⟩) = |α|2
P(measure |1⟩) = |β|2
Example statevectors
All weight on |0⟩
[1, 0]
Probability of measuring
|0⟩=1² = 100%.All weight on |1⟩
[0, 1]
Probability of measuring
|1⟩=1² = 100%.Equal superposition
[1/√2, 1/√2]
(1/√2)² = 1/2probability of each outcome. 50/50.A complex superposition
[1/√2, i/√2]
Still 50/50 — the magnitude squared
|i/√2|² = 1/2— but the second entry's phase is different.An imbalanced superposition
[√0.3, √0.7]
(√0.3)² = 30%for|0⟩,(√0.7)² = 70%for|1⟩.
Notice something important: in every example above, the squared amplitudes add to 1. That's not a coincidence — it's a hard rule. The probabilities of all possible outcomes must add to 100%, so:
|α|2 + |β|2 = 1
And amplitudes can be complex numbers. The Born rule with complex amplitudes uses the squared magnitude |α|² = α·α* instead of just α².
The global phase doesn't matter
Writing statevectors like this comes with a small redundancy. If you multiply every amplitude by the same complex number of magnitude 1 (a "phase factor" like -1, i, or e^(iπ/3)), you describe the same physical state. The Born rule depends on |amplitude|², so multiplying every amplitude by a unit-magnitude factor doesn't change any measurement probability.
This shared factor is called the global phase. Two statevectors that differ only by a global phase are physically indistinguishable — they predict the exact same outcomes for every possible measurement.
Multiple qubits
Now we're going to learn how to represent the state of multiple qubits. All we do is create a new dimension for each possible combination of measurement outcomes.
So the vector representing any particular state has 2ⁿ entries for n qubits. This vector is also called the statevector. Just like the single-qubit case, its entries can be complex, and their squared magnitudes must sum to 1.
statevector dimension = 2n
For two qubits, the four outcomes are |00⟩, |01⟩, |10⟩, |11⟩, so the statevector has 4 entries. For three qubits: 8 entries. For ten qubits: 1024 entries. The dimension grows exponentially with the number of qubits — which is exactly why simulating large quantum systems on a classical computer is so hard.
Operations
Every operation done on a quantum system has to take in a statevector and output a statevector. And the new statevector must satisfy all the rules of a statevector — including living on the unit sphere.
If the operation is linear, it can be represented as a matrix. The constraint is that input and output must both have norm 1. Matrices that preserve the unit sphere are called unitary.
Applying an operation to a statevector is matrix multiplication: take the unitary matrix U, multiply it by the statevector |ψ⟩, and the result U|ψ⟩ is the new statevector.
|ψ’⟩ = U|ψ⟩
Measurements
The last kind of operation we do to a quantum computer is a measurement — how we extract information from a quantum system.
To perform a measurement, three steps:
- Calculate the probability of each possible outcome using the Born rule (
|amplitude|²). - Sample one outcome randomly using those probabilities.
- Replace the statevector with the unit vector corresponding to whatever outcome was sampled.
For example, measuring the state |ψ⟩ = (1/√2)|0⟩ + (1/√2)|1⟩: we get |0⟩ with 50% probability and |1⟩ with 50%. If we sampled |0⟩, the statevector after the measurement is just |0⟩ = [1, 0]. The superposition is gone — that's what people mean when they say a measurement "collapses" the state.
Where to go from here
Three good next steps:
- What is the Bloch sphere? takes the 3D geometric picture seriously for single qubits.
- The Hadamard gate is one of the most important unitary operations — it turns
|0⟩into(1/√2)|0⟩ + (1/√2)|1⟩, the equal superposition. - What is quantum entanglement? shows what happens to the multi-qubit statevector when two qubits become correlated.