Start here
How does a quantum computer work?
A quantum computer sets its qubits to a known start, runs gates that rewrite each qubit's two amplitudes, links the qubits so their numbers depend on each other, steers those numbers so that wrong answers cancel and the right one grows, and then reads every qubit as an ordinary bit. Each reading is random, with odds set by the squared amplitudes, so the machine runs the same circuit many times and counts the results.
Below, each of those five steps gets its own section and one small sum. If a word is new, the link goes to its entry in the Nerdictionary. For the shorter what and why, start with What is quantum computing?
The five steps at a glance
- Prepare. Every qubit starts certain to read 0.
- Superpose. Gates such as H give each qubit two nonzero amplitudes.
- Entangle. Two-qubit gates such as CNOT tie the qubits together.
- Interfere. More gates make the routes to wrong answers cancel and the routes to the right answer add.
- Measure and repeat. Each qubit is read as 0 or 1, and the circuit runs again and again to build up counts.
A drawing of these steps, with one line per qubit and gates as boxes in order, is a circuit. You read it from the left, so the left-hand gate runs first.
Step 1, what does a qubit hold?
A qubit holds two amplitudes, one for 0 and one for 1. The chance of each reading is the square of the size of its amplitude. A qubit certain to read 0 has amplitudes 1 and 0, written |0⟩. One certain to read 1 has 0 and 1, written |1⟩. The bar and the angle bracket make a ket, which is a label for the list of amplitudes.
A qubit is not 0 and 1 at once, and it is not a hidden 0 or 1 waiting to be found. It is one definite state with two numbers, and only the reading is random.
Step 2, what does a quantum gate do?
A gate is a fixed rule that rewrites the amplitudes. Nothing random happens when you apply one, and no bit comes out. Three gates do most of the work on one qubit.
- X swaps the two amplitudes. On |0⟩ that is a plain bit flip to |1⟩.
- Z flips the sign of the amplitude for 1 and leaves the chances alone.
- H adds and subtracts. From amplitudes a and b it makes (a + b) ÷ √2 for 0 and (a − b) ÷ √2 for 1.
H on |0⟩ gives about 0.71 and 0.71, the |+⟩ state. That is a superposition, and a reading would now be a fair toss. Quantum gates explained covers the full set, with S, Y and CNOT as well.
Step 3, how do qubits get linked?
Two qubits share four amplitudes, one each for 00, 01, 10 and 11, with the first qubit as the left digit. The controlled NOT, or CNOT, flips the second qubit wherever the first would read 1. In amplitudes, it swaps the numbers on 10 and 11.
Start at 00, so the four amplitudes are 1, 0, 0 and 0. H on the first qubit gives 0.71, 0, 0.71 and 0. CNOT swaps the last two, giving 0.71, 0, 0 and 0.71. Now the pair reads 00 half the time and 11 half the time, and never 01 or 10. The two qubits no longer have amplitudes of their own. That is entanglement, and this pair is a Bell state.
Entanglement does not send messages. Each qubit read alone is still a fair toss, and the match shows only when the two results are compared. Each qubit you add doubles the number of amplitudes, so ten qubits have 1,024. That growth is why ordinary computers struggle to track many large quantum circuits, but it is not a store of 1,024 answers you can read off.
Step 4, why does interference matter?
This is the step that makes a quantum computer worth building. A gate like H sends each amplitude down two routes, one toward 0 and one toward 1. Where routes meet, their numbers add. Matching signs make a reading likelier, and opposite signs can cancel it to nothing. That is interference.
Worked example, H then Z then H
Start with |0⟩, amplitudes 1 and 0, and apply three gates. Each 0.71 below is short for 1 ÷ √2, so the sums come out exact.
| Step | Amplitude for 0 | Amplitude for 1 | Chance of 1 |
|---|---|---|---|
| Start | 1 | 0 | 0 |
| After H | 0.71 | 0.71 | 0.5 |
| After Z | 0.71 | −0.71 | 0.5 |
| After H | (0.71 − 0.71) ÷ 1.41 = 0 | (0.71 + 0.71) ÷ 1.41 = 1 | 1 |
The Z in the middle changed nothing you could measure, since the chance of reading 1 was a half before it and a half after. Yet it decided the result. Without the Z, the last H would give 1 and 0, a certain 0. With it, the routes to 0 cancel and the routes to 1 add, so the qubit reads 1 every time. A hidden sign became a certain answer.
Real algorithms do the same on many qubits. Grover's search, for one, flips the sign of a marked answer and then uses interference to grow it, round after round. The note The sign is what cancels goes through the sum above route by route.
Step 5, what happens when you measure?
A measurement returns one bit per qubit, with odds set by the squares. It also replaces the amplitudes with the state just read, so reading the same qubit again tells you nothing new. The note Measurement replaces the amplitudes follows one reading in detail.
So a quantum computer runs the same circuit many times, and each run is a shot. If a circuit leaves a qubit with 0.6 for 0 and 0.8 for 1, then 1,000 shots give about 360 zeros and 640 ones, give or take about 15. A well designed circuit piles most of the chance onto the answer, so the answer stands out in the counts.
What is a quantum computer made of?
A qubit can be any small system with two levels that you can control and read. Two common kinds are described in the glossary.
- Superconducting qubits are tiny electrical circuits, cooled close to absolute zero so the metal carries current with no resistance and stray heat cannot kick them between levels. Most of their gates are timed pulses of microwaves.
- Trapped ions are single charged atoms held in a vacuum by electric fields. Lasers usually drive the gates, and a laser makes each ion glow or stay dark to read it.
In both, an ordinary computer runs the controls, sends the pulses and collects the bits.
Why are quantum computers so hard to build?
Qubits leak. Heat and stray fields couple a qubit to its surroundings, and the sign between its amplitudes often fades first. That is decoherence. Interference needs the sign, so a circuit must finish well inside the device's coherence time. Long calculations need error correction, which spreads one protected logical qubit across many physical ones. The note Noise scrambles the sign shows what is lost when the sign goes.
Is a quantum computer faster than a normal computer?
Only for some problems. Shor's algorithm, on a large error-corrected machine, would factor large numbers far faster than any known method for an ordinary computer, and Grover's search gives a square-root gain when searching a list with no pattern. For everyday work an ordinary computer is faster and cheaper. To see these steps in your own hands, turn a qubit on the qubit page, or follow the reading order in Quantum computing for beginners.
Questions people ask
How does a quantum computer work in simple terms?
It starts its qubits at 0, runs gates that change each qubit’s two numbers so wrong answers cancel and the right one grows, then reads each qubit as a 0 or a 1. It repeats the run many times and counts the results.
Why does a quantum computer run the same circuit many times?
Each reading gives one random bit per qubit, and it replaces the amplitudes. To learn the odds, or to be sure of the answer, you run fresh copies of the circuit and count the bits.
Why do quantum computers need to be so cold?
Superconducting qubits are cooled close to absolute zero so their metal superconducts and stray heat cannot knock them between levels. Not every design works this way. Trapped ions are cooled with lasers instead of a fridge, and held in a vacuum.
What is the difference between a bit and a qubit?
A bit is always 0 or 1. A qubit holds two numbers, one for 0 and one for 1, whose squared sizes are the chances of each reading. Reading a qubit gives one bit and replaces those numbers.
Can entanglement send a signal faster than light?
No. Whatever is done to one qubit of an entangled pair, the other, read alone, gives the same odds as before. The link shows only when the two sets of results are compared, and that needs an ordinary message.