QBIT_
Quantum basics / For beginnersNo prior knowledge needed

Learn the math,
one signal at a time.

A qubit is not a vague idea — it is two numbers and one rule. Work through ten short lessons, each with its formula and a real calculation you can run in the console.

10 lessonsEvery answer computed locally01 — 10

00 / Before you start

How to read the notation.

Symbols first, so the lessons stay plain.

|0⟩
Read "ket zero": the outcome a qubit gives when it is definitely 0.
|ψ⟩
The state itself — a shorthand name for the pair of amplitudes.
α, β
The two amplitudes. Ordinary numbers, allowed to be negative.
|α|²
The chance of measuring 0. Squaring turns an amplitude into a probability.
H X Z Ry
Gates: instructions that rewrite the amplitudes. A circuit is read left to right.
θ
An angle in degrees. Ry(θ) tilts the state by that much.
shots
How many times the same measurement is repeated so the odds become visible.
≈
Expected, not guaranteed — randomness means one run is rarely exact.

01 / The lessons

Start at the top and go down.

Each lesson builds on the one before it.

  1. 01 / LESSON

    What is a qubit?

    A classical bit is 0 or 1. A qubit holds two numbers called amplitudes, written α|0⟩ + β|1⟩. Both of them can be non-zero at the same time.

    |ψ⟩ = α|0⟩ + β|1⟩

    Watch forSquaring both amplitudes gives exactly 1. Every valid qubit obeys this.

    sqrt(0.5)^2 + sqrt(0.5)^2 = 1Run it
  2. 02 / LESSON

    The probability rule

    Square an amplitude to get the chance of measuring that outcome. Do it to both amplitudes and the two chances always add up to 100%.

    P(0) = |α|², P(1) = |β|²

    Watch forAn amplitude of 0.707 means a 50% chance. The square is what you can actually predict.

    (1/sqrt(2))^2 = 0.5Run it
  3. 03 / LESSON

    Hadamard (H)

    The gate that creates a superposition: it turns a definite 0 into an even mix of 0 and 1. Apply it a second time and the two halves cancel back to 0.

    H|0⟩ = (|0⟩ + |1⟩) / √2

    Watch forEach amplitude is about 0.707. Square it and you get a fair coin.

    1 / sqrt(2) = 0.707106781187Run it
  4. 04 / LESSON

    Pauli X

    The quantum NOT. It swaps the two amplitudes, so a state that was certainly 0 becomes certainly 1.

    X|0⟩ = |1⟩

    Watch forThe flip moves the 1 from one amplitude to the other. The total never changes.

    0^2 + 1^2 = 1Run it
  5. 05 / LESSON

    Pauli Z

    Z flips the sign of the |1⟩ amplitude. Nothing you measure directly changes, but that sign decides how the state interferes later.

    Z(α|0⟩ + β|1⟩) = α|0⟩ − β|1⟩

    Watch forA negative amplitude still squares to a positive chance. The sign only shows up when amplitudes meet.

    (-1 * 1/sqrt(2))^2 = 0.5Run it
  6. 06 / LESSON

    Rotation Ry(θ)

    Instead of jumping between states, Ry tilts the state by an angle θ. The chance of measuring 0 follows a cosine squared.

    P(0) = cos²(θ / 2)

    Watch forA 60° tilt leans the state toward 0: three chances in four.

    cos(60 deg / 2)^2 = 0.75Run it
  7. 07 / LESSON

    Measurement

    Looking collapses the qubit to a single answer, 0 or 1. Run the same state many times — the "shots" — and the counts settle around the probabilities.

    1024 shots × 0.5 ≈ 512

    Watch forProbability predicts the average, not the exact count of one run.

    1024 * 0.5 = 512Run it
  8. 08 / LESSON

    The Bloch sphere

    Any qubit state is a point on a sphere: north pole is |0⟩, south pole is |1⟩, and the equator is a perfect superposition.

    θ = 2·acos(|α|)

    Watch for90° puts the point on the equator — the most uncertain state there is.

    2 * acos(1/sqrt(2)) * 180 / pi = 90Run it
  9. 09 / LESSON

    Keeping it normalised

    Amplitudes have to form a unit length. If their squares do not add to 1, the numbers are not a qubit yet, so you rescale them.

    |α|² + |β|² = 1

    Watch for0.6 and 0.8 look random, but their squares add to exactly 1.

    sqrt(0.6^2 + 0.8^2) = 1Run it
  10. 10 / LESSON

    Interference

    Amplitudes are added first and squared afterwards, so two paths can cancel each other out or build each other up. That is what separates a quantum calculation from simply adding odds.

    (α₁ + α₂)²

    Watch forTwo equal amplitudes with opposite signs cancel to nothing — the reason H twice returns |0⟩.

    (1/sqrt(2) - 1/sqrt(2))^2 = 0Run it

02 / The two rules

Nothing here breaks these.

Check both in the console.

Chances always add to one

Whatever state you build, the two probabilities must total 100%. If they do not, the amplitudes are not a qubit yet.

0.5 + 0.5 = 1Run it

Add amplitudes, then square

Quantum maths squares after adding, never before. Change the order and you get a different answer — that difference is interference.

(1/sqrt(2) + 1/sqrt(2))^2 = 2but 1/sqrt(2)^2 + 1/sqrt(2)^2 = 1Run it

03 / Word list

Words, in plain language.

Keep this open while you play.

Qubit
A two-outcome system described by two amplitudes. Measured, it gives 0 or 1.
Amplitude
A number attached to an outcome. Squared, it becomes the chance of that outcome.
Phase
The sign of an amplitude. Invisible in a single chance, decisive in interference.
Superposition
Both amplitudes non-zero at once, so neither outcome is settled before you look.
Gate
A rule that rewrites the amplitudes. H, X, Z and Ry are the ones used here.
Collapse
What measurement does: the state reduces to the single outcome you saw.
Shot
One repetition of the same measurement. Many shots reveal the probabilities.
Normalise
Rescale the amplitudes so their squares add to 1.
Interference
Amplitudes combining — reinforcing or cancelling — before you square them.
Bloch sphere
A picture of every possible single-qubit state as a point on a sphere.

04 / Now try it

Read one lesson.
Run one number.