PricingOpen Lab
Chapter 05 of 6 · ~25 min · FREE

Lists, Vectors, and Normalization

A vector is nothing more than a list of numbers in a fixed order, and a qubit's state is a two-number list of amplitudes. The one rule the list must obey — the squares of its entries must add up to exactly 1 — is just "the probabilities must total 100%" in disguise.

What is a vector?

You already use vectors every week. A shopping list — 2 apples, 3 eggs, 1 loaf — is a list of numbers in a fixed order. The order matters: swap the 2 and the 3 and you come home with the wrong bag.

A GPS location is one too: (28.61, 77.21) is two numbers in a fixed order, latitude first, longitude second. Swap them and you are in the ocean.

That is the entire definition. A vector is a list of numbers in a fixed order. Nothing else. When math books draw arrows, they are drawing a picture of a vector; the vector itself is just the list. We will write lists in square brackets, like [0.6, 0.8].

How is a qubit's state a list of numbers?

Measure a qubit and you get 0 or 1. Before measurement, the qubit carries one amplitude for each possible reading — the "amounts that can cancel" from chapter 3. So a qubit's state is a two-entry vector: [amplitude for reading 0, amplitude for reading 1].

A fresh qubit is [1, 0]: all of the amount sits on 0, none on 1, and every shot reads 0. After the fair-coin H gate from chapter 2, the state is [0.7071, 0.7071]. After the RY(π/3) rotation from chapter 4, it is [0.8660, 0.5].

More qubits just means a longer list — one entry per possible reading. Two qubits have four readings (00, 01, 10, 11), so four entries. Three qubits: eight entries. In general, n qubits need a list with 2^n entries — the doubling explosion from chapter 1. That is why 30 qubits already need a list about a billion entries long: it is both the source of quantum computing's power and the reason simulators hit a wall.

What is the normalization rule?

Chapter 2 opened with one bedrock fact: the probabilities of all possible outcomes add up to 100%, that is, to 1. And squaring an amplitude gives that outcome's probability. Put those together and every legal state vector must pass one test:

Square every entry. The squares must add up to exactly 1.

This rule is called normalization. It is not a new law of nature — it is "probabilities total 100%" wearing vector clothes.

Worked example 1, digit by digit. Is [0.6, 0.8] a legal qubit state?

  • 0.6 × 0.6 = 0.36
  • 0.8 × 0.8 = 0.64
  • 0.36 + 0.64 = 1.00 — legal. This qubit reads 0 on about 36% of shots and 1 on about 64%.

Check the fair coin [0.7071, 0.7071] too: 0.7071 × 0.7071 = 0.4999904…, which is exactly 0.5 once you use the full unrounded value 0.70710678… So the squares give 0.5 + 0.5 = 1. Legal.

One more thing squares are good at: ignoring signs. (−0.7071) × (−0.7071) is also +0.5, because a negative times a negative is positive — chapter 3's rule. The negative amplitudes that made cancellation possible are fully legal citizens of these lists.

How do you fix a list that fails the test?

The list [0.5, 0.5] looks innocent. Test it: 0.5 × 0.5 = 0.25, and 0.25 + 0.25 = 0.50. The squares total only 50%. Half the probability is missing, so this is not a legal state.

The repair is always the same: divide every entry by the list's length. The length is the square root — the un-squaring operation from chapter 1 — of the sum of the squares.

Worked example 2, digit by digit:

  1. Sum of squares: 0.25 + 0.25 = 0.50.
  2. Length: the square root of 0.50 is 0.7071, because 0.7071 × 0.7071 = 0.4999904… ≈ 0.50.
  3. Divide each entry by the length: 0.5 ÷ 0.7071 = 0.7071. (A charming habit of this particular number: dividing 0.5 by it hands it right back, precisely because its square is 0.5.)
  4. The repaired list is [0.7071, 0.7071]. Check: 0.5 + 0.5 = 1.00. Fixed.

This repair is called normalizing the vector. It is the same move as converting raw vote counts into percentages: you divide by the total so that everything accounts for exactly 100%.

How do independent qubits combine into one list?

Remember the two coins in chapter 2: independent events multiply, so heads-heads had probability 0.5 × 0.5 = 0.25, one cell of a 2-by-2 table. Amplitudes follow the same multiplication when qubits are independent.

Give each of two qubits the fair-coin treatment, so each is [0.7071, 0.7071]. The combined state lists all four readings — 00, 01, 10, 11 — and each entry is the product of the matching single-qubit amplitudes: 0.7071 × 0.7071 = 0.5, every time. The combined vector is [0.5, 0.5, 0.5, 0.5]. It is chapter 2's table again, flattened into a list.

Normalization check: each square is 0.5 × 0.5 = 0.25, and four of them make 0.25 + 0.25 + 0.25 + 0.25 = 1.00. Legal.

So the prediction writes itself: each of the four readings has probability exactly 0.25, which means about 250 of each in 1000 shots. Let's measure the list.

Run it: is [0.5, 0.5, 0.5, 0.5] real?

Prediction: each of the four strings 00, 01, 10, 11 has probability exactly 0.25 — about 250 of each in 1000 shots, every count wobbling by around ±14. (In each string the left bit is qubit 1 and the right bit is qubit 0.) The four-entry list [0.5, 0.5, 0.5, 0.5], squared entry by entry, is the histogram.standby
12q0|0⟩q1|0⟩HH
press run to acquire
|00|01|10|11
counts: sampledamplitudes: statevector, exactengine: in-browser
Open in the Lab →

Where will you use this?

From now on, "the state" always means "the list", and normalization is the first sanity check on any state you write down. You will use this in:

  • Probability amplitudes — the full story of the entries in these lists.
  • Multiple qubits — where the 2^n-entry list becomes the main character, including states that cannot be built by entry-by-entry multiplication.
  • The next chapter — where repeated multiplication turns from a combining trick into the reason quantum hardware is hard.
  • Amplitudes and phase — a quick reference you can return to any time.
  • The Lab — inspect the state vector of any circuit you build and watch the squares sum to 1.
Lists, Vectors, and Normalization · QPU137