Level 2, Tinkerer
Gate
A gate is an operation that rewrites the amplitudes of one or more qubits according to a fixed rule. On this shelf the first three gates act on a single qubit, and between them they can split a state, swap the two amplitudes, and flip a sign.
Keith collects nicknames for gates the way other people collect beermats from pubs they half remember. The entries here use the letters, and the nicknames are confined to the second paragraph where a wrong one can be corrected in the same breath.
An example
Take a qubit with an amplitude of 0.6 for 0 and 0.8 for 1. The chances of reading 0 and 1 are the squares, 0.36 and 0.64. Press each gate on a fresh copy.
X swaps the two amplitudes, so the qubit holds 0.8 for 0 and 0.6 for 1. The chances swap too, to 0.64 and 0.36.
Z flips the sign of the amplitude for 1, so the qubit holds 0.6 and −0.8. The chances stay at 0.36 and 0.64. Only a later gate can show the change.
H adds and subtracts. The new amplitude for 0 is 0.6 + 0.8 = 1.4, and the new amplitude for 1 is 0.6 − 0.8 = −0.2. Divide both by the square root of 2, about 1.41, and you get about 0.99 and −0.14. The chances are now about 0.98 and 0.02.
The squares always add to 1, because a gate moves the chances around but never loses any. Each of these gates also undoes itself. Press X twice, Z twice or H twice and you are back at 0.6 and 0.8.
What it is not
A quantum gate is not quite the logic gate inside a laptop. An AND gate takes two bits and gives one. If it prints 0, you cannot tell whether the inputs were 00, 01 or 10. A quantum gate never throws anything away, so it can always be run backwards.
A gate is also not a measurement. Nothing random happens when you press one, and no bit comes out. The randomness waits for the click at the end of the circuit.
On a real chip a gate is a timed pulse of microwaves or laser light, not a part you can point at.
Related words
The three gates in the example are the X gate, the Z gate and the Hadamard gate. The controlled NOT is a gate on two qubits, and a row of gates on wires is a circuit. The note The left-hand gate runs first shows why the order matters. Name gates in Which Gate, or write them as tables of numbers in Which Matrix.
Used in
Longer explanation: Quantum gates cheat sheet