Quantum Computing

Theory · chapter 5 of 10

The switches

A quantum program is a short list of turns applied to qubits, drawn as wires and boxes. Everything the machine does is a few kinds of turn, over and over.

An ordinary chip has logic gates: AND, OR, NOT. A quantum computer has gates too, and a program is drawn as a circuit: one horizontal line per qubit, time running left to right, a box wherever a gate acts.

The one-qubit gates are turns of the arrow from the sphere chapter. H puts a qubit in the air. X flips it. Z and its smaller cousins turn the phase. The two-qubit gate that matters most is CNOT: flip the second qubit if the first is 1. Put an H on the first qubit and then a CNOT, and the two are entangled. That two-gate circuit is the hello-world of the field.

Every gate is reversible. Run the circuit backwards and you get the input back. Nothing is erased, because erasing is the one thing quantum mechanics does not allow in the middle of a computation. Measurement, at the end, is the exception; it is the only step that throws information away.

A small set of gates, H, one phase gate called T, and CNOT, is enough to build any quantum program at all, the way NAND alone builds any ordinary one. Real chips offer a handful of native gates and compile everything else into them.

Counts to have in your head: a useful program might need millions of gates on a few thousand error-corrected qubits. Today's machines run a few thousand gates on a few hundred noisy ones before the answer turns to mush. That gap is the field.

Try it. Step through the two-gate circuit. Watch the first arrow tip onto the equator, then watch the CNOT tie the pair. The last panel shows the four possible readouts and their odds.

This demo runs in the browser with JavaScript on. The words above stand on their own.

Sources

← Two coins that always match Finding a needle in fewer tries →