A qubit is a unit vector in a two-dimensional complex space. That's the whole mathematical story — but the geometry of where that vector points is what makes qubits feel different from classical bits, and that geometry has a name: the Bloch sphere.
From a bit to a qubit
A classical bit is 0 or 1 — a single binary choice. A qubit's state is a superposition:
Click and drag directly on the sphere to rotate the vector, or use the sliders for precise angles.
Every point on the sphere's surface is a valid single-qubit state. The north pole is |0⟩, the south pole is |1⟩, and everywhere else is a superposition with a specific phase and amplitude balance — not "0 and 1 at once" in any vague sense, but one specific point on a specific sphere.
What superposition actually means
Written out fully, a qubit's state is
|ψ⟩ = α|0⟩ + β|1⟩
where α and β are complex numbers called probability amplitudes — not probabilities themselves. The actual probability of measuring 0 is |α|², and of measuring 1 is |β|². Because some outcome must happen, these have to sum to exactly 1:
|α|² + |β|² = 1
That single constraint is why a qubit's state space is a sphere at all — it's the same reason the set of points (x, y, z) with x² + y² + z² = 1 traces out a sphere. The θ/φ parametrization in Fig. 3.1 is just a convenient way to walk along that constraint surface without ever leaving it: change θ or φ all you like, and |α|² + |β|² = 1 stays true automatically. The readout under the sphere confirms this directly — try dragging to an extreme angle and check that the line still sums to 1.
A few named states
Most of what you'll read elsewhere refers back to these six points by name:
| State | θ | φ | Meaning |
|---|---|---|---|
| |0⟩ | 0° | — | North pole, the "classical 0" |
| |1⟩ | 180° | — | South pole, the "classical 1" |
| |+⟩ | 90° | 0° | Equal superposition, no relative phase |
| |−⟩ | 90° | 180° | Equal superposition, opposite relative phase |
| |+i⟩ | 90° | 90° | Equal superposition, phase rotated a quarter-turn |
| |−i⟩ | 90° | 270° | Equal superposition, phase rotated three-quarter-turn |
Try dragging Fig. 3.1's vector to each of these six points and reading the live equation above the sphere — it's the fastest way to make the table above stop feeling like a list of symbols.
Global phase doesn't move the point
Multiply the whole state by e^{iα} for any real α, and the Bloch vector doesn't move at all — global phase is invisible to the sphere, and (as you'll confirm in Ch. 7) invisible to any measurement too. Only the relative phase between the |0⟩ and |1⟩ components — the φ slider above — actually changes where the point sits.
Gate reference
A single-qubit gate is a 2×2 matrix that takes one valid state to another valid state — geometrically, that means every gate has to be a rotation of the Bloch sphere, since that's the only kind of map that keeps every point on the surface. Click any button in Fig. 3.1 and compare what happens to the sphere against the matrix and rotation below — same fact, three ways of seeing it.
X — bit flip
180° rotation about the x-axis. Swaps |0⟩ and |1⟩ outright — the quantum analog of a classical NOT.
Y — bit + phase flip
180° rotation about the y-axis. Also swaps the poles, but picks up a different phase relationship than X — watch where |+⟩ ends up vs. where X sends it.
Z — phase flip
180° rotation about the z-axis (the |0⟩/|1⟩ axis itself). Leaves the poles fixed entirely — it only does something visible to states already off the poles.
H — Hadamard
180° rotation about the diagonal axis halfway between x and z. The gate that actually creates superposition from a classical-looking start — the one you'll use constantly.
S — phase gate
A quarter-turn rotation about the z-axis — half of a Z gate. Notice it does nothing at all to |0⟩ or |1⟩, only to states on the equator and in between.
T — π/8 gate
Half of an S gate. Small, precise phase nudges like this are exactly what later algorithms (Ch. 29–31) chain together to build up large effects.
- Video3Blue1Brown — visualizing qubitsBest visual intuition for why the sphere has the shape it does.
- TextbookNielsen & Chuang, §1.2The canonical derivation of the θ/φ parametrization.
- ToolQuirkDrag gates onto a circuit and watch the Bloch sphere update live — good for building intuition beyond a single qubit.
The Hadamard gate, as matrix arithmetic
You just clicked H above and watched the vector move. Here's the exact same operation as the raw linear algebra underneath it — edit the matrix and re-run to try a different gate as code instead of a button.
Build a sequence
One gate at a time only goes so far. Drag gates from the palette into the slots below (or just click a gate to drop it in the next open slot) to build a real sequence — every step recomputes the actual state, the actual probabilities, and the actual Python that produced them. Everything here starts fresh from |0⟩.
Two qubits, and the gate that connects them
Everything so far has been a one-qubit gate — a 2×2 matrix touching a single wire. The moment you have two qubits, a new kind of gate becomes possible: one that acts on both wires at once, and can create exactly the kind of correlation that makes two qubits behave as something more than two separate qubits. That gate is CNOT — controlled-X.
CNOT — controlled-X
A 4×4 matrix on the joint 2-qubit space — not a tensor product of two 2×2 gates, because what happens to the target depends on the control's value. That dependency is exactly what produces entanglement: after H on q0 then CNOT, the two qubits can no longer be described independently of each other (Ch. 17's GHZ/W states are this same idea pushed to more qubits).
Build it yourself: drag H onto q0's first column, then drag the CNOT tile onto q0 in the next column (this makes q0 the control, q1 the target automatically). Run it — you should land on 50% 00, 50% 11, and exactly 0% on 01 or 10. That's the Bell state, the smallest possible example of entanglement.
Drag a gate onto a wire, or click a wire's slot to select it (it highlights), then click a gate tile to drop it in. Click a placed gate to remove it. For CNOT: drop it on whichever wire should be the control.