Quantum

What is a Qubit?

Forget the magical coin. A qubit is a unit vector in a two-dimensional complex space — and on this page, you can poke it.

You've probably been told a qubit is “a bit that can be 0 and 1 at the same time.” That is, technically, true. It is also useless as a mental model. It doesn't tell you what's actually on the wire, it doesn't predict what gates do, and it absolutely won't survive contact with a circuit diagram.

Here is the model that actually works: a qubit's state is a two-component complex vector (α, β) with |α|² + |β|² = 1. The squared magnitudes are the probabilities of measuring |0⟩ or |1⟩. Everything else — superposition, phase, the Bloch sphere, why quantum gates are “rotations” — falls out of those two facts.

We're not going to dwell on the math up front. You're going to play with the state for a few minutes first, and we'll fill in the symbols underneath. Every widget on this page is driven by a real (and very tiny) quantum simulator running in your browser. You can open DevTools and poke it.

Press a gate, watch the state

Start with |0⟩. The probability bars show two outcomes; only the left one is on. Now press H (the Hadamard gate). The probabilities split evenly: a 50/50 superposition.

P(outcome) — updates live as you press gates.

P(|0⟩) = …, P(|1⟩) = …

The complex amplitudes themselves.

Try this: press H twice in a row. You end up back at |0⟩. The Hadamard gate is its own inverse — applying it again “undoes” the superposition. That's not magic, that's H · H = I.

Try this: press H then Z. The bars don't move — Z doesn't change the probabilities of |0⟩ vs. |1⟩. But look at the state-vector readout. The amplitude in front of |1⟩ flipped sign. That sign is called a phase, and it'll come back to haunt us in a moment.

The state, geometrically

Two complex numbers with a normalization constraint and a free overall phase have exactly two real degrees of freedom — which means every single-qubit state can be drawn as a point on the surface of a sphere. North pole is |0⟩, south pole is |1⟩, equator is the equal-superposition states. This is the Bloch sphere.

The Bloch sphere. Drag the arrow tip to set the qubit state directly.

Try dragging the arrow tip. Apply a gate above and watch the arrow rotate.

Try this: drag the arrow to the equator (anywhere on the equator). The probability bars go to 50/50. Now press Z. The bars don't move — but the arrow rotates around the vertical axis. That's what a Z phase rotation looks like geometrically. Phase isn't “invisible”; it lives around the equator.

Try this: reset, then press H, then drag the arrow to the south pole. Press H again. Where does the arrow land? Why? (Hint: the math nerds box at the bottom of the page has the full matrix.)

Continuous rotation

Discrete gates jump between named states. Rotation gates sweep continuously: drag a slider and watch the state smear smoothly from |0⟩ toward |1⟩ and back. Each slider snapshots the state when you grab it, so sweeping back to 0 always returns you to where you started — they don't compound.

Try this: press H, then sweep Rz(θ) from 0 to . The probabilities never budge. But the Bloch arrow spins around the vertical axis a full turn. Phase, again — alive and visible.

Try this: reset, then sweep Ry(θ) to exactly π. You land on |1⟩. That's the continuous, half-way-rotation version of the discrete X gate: X ≈ Ry(π) up to a global phase. Every discrete gate has a smooth, parameterized cousin.

Make this page yours

Found a moment that clicked? Double-click any widget to drop a sticky note. Your notes live in your browser's local storage — they'll be here when you come back. (The “Reset annotations on this page” link at the bottom wipes them.)

Self-test

  1. You apply HZH to |0⟩. What state do you end up in, and why is that equivalent to applying X? (Try it with the buttons.)
  2. Rz(θ) never changes measurement probabilities in the computational basis. So why is it useful at all? (Hint: think about what happens if you apply H after the Rz.)
What the gates are, formally

A single qubit's state is a unit vector in C2\mathbb{C}^2:

ψ=α0+β1,α2+β2=1|\psi\rangle = \alpha|0\rangle + \beta|1\rangle, \quad |\alpha|^2 + |\beta|^2 = 1

The Hadamard gate as a 2×2 matrix:

H=12[1111]H = \tfrac{1}{\sqrt{2}}\begin{bmatrix}1 & 1\\1 & -1\end{bmatrix}

The Pauli-Z gate (only affects phase of 1|1\rangle):

Z=[1001]Z = \begin{bmatrix}1 & 0\\0 & -1\end{bmatrix}

Rotation about the X axis by θ — note the angle is θ/2, a quirk of mapping double-cover SU(2) to the Bloch sphere:

Rx(θ)=cos(θ/2)Iisin(θ/2)XR_x(\theta) = \cos(\theta/2)\, I - i \sin(\theta/2)\, X
For the math nerds

The Bloch sphere is the visualization of pure single-qubit states modulo global phase. Two states that differ only by a unit complex scalar are physically indistinguishable, so we represent a qubit as a point on the unit 2-sphere parameterized by (θ, φ):

ψ=cos(θ/2)0+eiφsin(θ/2)1|\psi\rangle = \cos(\theta/2)\,|0\rangle + e^{i\varphi}\sin(\theta/2)\,|1\rangle

All single-qubit gates are 2×2 unitaries — i.e. elements of U(2)U(2). Modulo a global phase they're rotations of the Bloch sphere, which is why “rotation gates” is the right mental model, not “logic gates.”

A keyboard-only note: the sliders are fully operable with the arrow keys (Page Up/Down jumps in bigger increments). Drag on the Bloch sphere is also reachable as “drag the arrow tip with the pointer” — pointer events cover mouse, touch, and pen.