← Quantum Store · Guides · Lessons · Glossary · About · Türkçe

Preparation course: maths for quantum computing · Lesson 2 / 7 · 9 min

Vectors: writing a state as a list of numbers

A vector is an ordered list of numbers. Learn to write the state of one qubit with two numbers and of n qubits with 2ⁿ numbers, and why those numbers are chosen so their squares add up to 1.

A vector: an ordered list of numbers

You can describe a place on a map with two numbers: 3 steps east, 4 steps north. This pair (3, 4) is called a vector. The order matters: (4, 3) is somewhere else.

A vector also has a length, found with Pythagoras’ theorem: √(3² + 4²) = √25 = 5. So the vector (3, 4) ends 5 steps from where it starts.

A qubit’s state is two numbers

A qubit’s state is a vector of two numbers: the first is the share of |0⟩, the second the share of |1⟩. A qubit that is certainly 0 is the vector (1, 0); one that is certainly 1 is (0, 1). These numbers are called amplitudes.

Quantum mechanics has a rule: the squares of the amplitudes add up to 1, so the state vector always has length 1. As the next lesson shows, that is because the squares of the amplitudes are probabilities. An equal superposition, for example, is the vector (0.707, 0.707): 0.707² + 0.707² ≈ 0.5 + 0.5 = 1.

Each qubit doubles the vector

Two qubits have four possible results (00, 01, 10, 11), so their state is a vector of four numbers. Three qubits need 8 numbers, five qubits 32. The general rule: 2ⁿ numbers for n qubits.

This is both the source of a quantum computer’s power and the reason it is hard to imitate on a classical computer. The state of 50 qubits is about a quadrillion (10¹⁵) numbers; storing them all takes about 18 petabytes of memory.

Try it yourself

In each example open “Durum vektörünü göster” (show the state vector). In the NOT example the vector is (0, 1): certainly 1. In the coin toss example both amplitudes are 0.707: their squares are 0.5, so 50%. Then add a qubit and watch the vector grow.

Open the circuit in your browser

The circuit playground is in Turkish. Button guide: “1000 kez ölç” = measure 1000 times, “Durum vektörünü göster” = show the state vector, “Bu devrenin Qiskit kodu” = this circuit’s Qiskit code, “Geri al” = undo, “Temizle” = clear. Click a gate in the circuit to remove it.

Key points

Test yourself

How many amplitudes does it take to write down the full state of 3 qubits?

Show the answer

8. n qubits have 2ⁿ possible results and each result has one amplitude: 2³ = 8.

← Probability: putting chance into numbers · Amplitudes and probability: squaring →

Share: X · LinkedIn