Before you watch a quantum code catch errors, it helps to know what a qubit actually is and why protecting one is so hard. Every qubit state is a point on the ball below, the Bloch sphere, and every gate just rotates that arrow. Drag any sphere to spin it. No equations here, just buttons to press.
An ordinary bit is either 0 or 1. A qubit can be 0, or 1, or a blend of both at once. On the sphere, the top is "definitely 0," the bottom is "definitely 1," and anywhere around the middle is a blend. Click the three states and watch the arrow move. Drag the ball to see it in the round.
Here's the strange part. While a qubit is in a blend (arrow on the equator), it really is "both." But the instant you measure it, the arrow snaps to a pole, 0 or 1, chosen at random, weighted by the blend. You can't peek without disturbing it. Hit Measure over and over and watch the arrow jump to a pole and the tally fill in.
Noise nudges a qubit in one of two basic ways. An X flip is a half-turn that swaps top and bottom (a "bit-flip"). A Z flip is a half-turn about the vertical axis (a "phase-flip"): it does nothing to a pure 0 or 1, but it swings a blend from one side to the other. Start from a blend (press H first), then try Z, and watch the arrow swing where a flat 0/1 reading would see nothing.
Everything a quantum computer does to one qubit is a rotation of this arrow. Nothing more exotic than that. Press the gates and watch. X, Y, Z are half-turns about the three axes; H swaps "up/down" with "left/right" (it's how you make a blend); S and T are smaller phase turns; the R gates rotate by a set angle. Chain a few together, then drag the sphere to look from another side.
With ordinary bits, you'd guard against errors by copying: store three copies, and if one flips, the other two outvote it. The obvious fix. But quantum physics flatly forbids it: there is no operation that copies an unknown qubit. It's called the no-cloning theorem. Try it.
You've met the qubit, seen why you can't just read or copy it, and learned the two kinds of error: X and Z. That's everything you need to watch a real quantum code catch one in the act.
Go to the playground →