Quantum Essentials · Module 2 · Chapter 7 of 17
What is a qubit, and what does a quantum computer actually do?
You've probably read that a quantum computer "tries every possible answer at the same time". Let's test that.
The short answer (tap to open)
A qubit is a quantum bit: a state like a direction, which gives 0 or 1 with set odds when measured. A quantum computer turns many qubits with precise operations so that, through interference, wrong answers cancel and right ones add up. It doesn't try every answer at once. It only speeds up certain kinds of problem.
Predict
A quantum computer with 300 qubits can hold more numbers than there are atoms in the universe. Can it read them all out?
After this page you can
- explain a qubit, and how it differs from an ordinary bit;
- describe what a quantum gate does;
- explain why a quantum computer's power comes from interference, not "trying every answer";
- name the problems quantum computers should help with, and the ones they won't.
Part A · From bits to qubits
What is a qubit?
An ordinary bit is a switch: 0 or 1. Everything your phone does comes down to billions of these.
A qubit is a quantum bit. Chapter 2 showed that a quantum state works like a direction. For a qubit, picture an arrow inside a ball. Arrow straight up means 0. Straight down means 1. But the arrow can point anywhere: up, down, sideways, or any angle in between.
Measuring a qubit asks one question, "0 or 1?", and always gets one of those two answers. If the arrow points straight up, you get 0 for certain. If it points sideways, you get 0 or 1 with even odds. At any other angle, the angle sets the odds, exactly as in chapter 2.
The odds for some arrows, in words
- Straight up: 100% for 0, 0% for 1.
- Straight down: 0% for 0, 100% for 1.
- Sideways: 50% for 0, 50% for 1.
- Tilted 60° from the top: 75% for 0, 25% for 1.
- Tilted 120° from the top: 25% for 0, 75% for 1.
Same odds, different state. That hidden direction matters for interference.
Physicists call this the Bloch sphere, after Felix Bloch. Every possible state of one qubit is a point on its surface.
Why isn't a qubit just a dimmer switch?
Two reasons. First, you can't read the arrow's direction. Measuring only ever gives 0 or 1. Second, the arrow has a direction around the ball as well as up and down. You can't see that part in a single measurement, but it controls how qubits interfere. That's where the power lives.
Part B · Gates turn the arrow
What does a quantum gate do?
An ordinary computer runs on logic gates, such as NOT, which flips 0 to 1. A quantum computer runs on quantum gates, and each one turns the arrow in a precise way.
- The X gate flips the arrow upside down: 0 becomes 1. It's the quantum NOT.
- The H gate (Hadamard) tips the arrow from the pole to the equator: from certain to 50/50.
- The Z gate spins the arrow halfway round the vertical axis. The odds don't change, but the hidden direction does.
A quantum program is a list of gates applied in order, then a measurement. Physicists draw it as a circuit: one line per qubit, with a box for each gate.
- Make the result always 1.
- Make it 50/50.
- Apply H twice. What do you get?
- H, then Z, then H.
Each challenge, in a table
| Gates, starting from 0 | Result |
|---|---|
| X | 1 every time |
| H | 0 or 1, half each |
| H, H | 0 every time |
| H, Z, H | 1 every time |
- Two 50/50 steps in a row gave a certain result. That's chapter 4's two mirrors again: the paths to 1 cancel.
- Z changed nothing you could measure, yet it flipped the final answer. The hidden direction steers the interference.
Part C · Two qubits and entanglement
What changes with two qubits?
Two bits can be 00, 01, 10 or 11, one at a time. Two qubits have an amplitude for each of the four, all at once, and the amplitudes can add and cancel like the paths in chapter 4.
A two-qubit gate called CNOT (controlled NOT) flips the second qubit only if the first is 1. Put the first qubit through H, then apply CNOT, and you get an entangled pair from chapter 5: measure them and you get 00 or 11, each half the time, never 01 or 10.
Make two qubits that always agree, but are random.
The answer, in words
Make two qubits that always agree, but are random. H on qubit 1, then CNOT. The chart shows 00 and 11 at 50% each, and 01 and 10 at 0%.
How many numbers does it take to describe n qubits?
Each extra qubit doubles the list of amplitudes. There's one amplitude for every possible readout, and each extra qubit splits every readout in two: one ending in 0, one ending in 1. You can't cut corners by describing each qubit on its own, because once qubits are entangled, like the pair above, only the whole list describes them.
2 qubits: 4 numbers. 10 qubits: 1,024. 50 qubits: about a thousand million million. 300 qubits: more numbers than there are atoms in the observable universe.
That's why ordinary computers struggle to imitate quantum ones. Simulating 30 qubits exactly takes about 17 gigabytes of memory, which a laptop can just about manage. 50 qubits takes about 18 petabytes, a warehouse of disks.
4 numbers needed to describe them
a sticky note
What you can read out: 2 bits.
The sizes, in words
- 1 to 3 qubits: a sticky note.
- 4 to 30 qubits: a laptop.
- 31 to 50 qubits: a supercomputer.
- 51 to 265 qubits: beyond any computer ever built.
- 266 to 300 qubits: more than atoms in the universe.
Here's the catch from the hook. All those amplitudes exist, but measurement gives you just one result, n bits long, picked with the odds. Read naively, a quantum computer gives you a random answer. The trick is to make that random answer almost certainly the right one.
Part D · What a quantum algorithm really does
Where does the speed-up come from?
From interference. A quantum algorithm is a sequence of gates designed so that, by the end, the amplitudes for wrong answers point in opposite directions and cancel, while the amplitudes for the right answer line up and add (chapter 4's puzzle). Then one measurement gives the right answer with high odds.
Designing those cancellations is hard, and it only works for problems with the right hidden structure. That's why there are only a handful of famous quantum algorithms, not a quantum version of everything.
What's the simplest example?
In 1985 David Deutsch at Oxford described how a universal quantum computer would work, and found the first problem where it beats an ordinary computer. Here's the idea as a game.
A sealed box holds a coin-flipping rule: either it always gives the same face whatever you put in ("constant"), or it gives different faces for the two inputs ("balanced"). Find out which.
Classical round
Test both inputs first: one test can't tell constant from balanced.
Quantum round
H on the input, the box, H again.
Both rounds, step by step
- Classical round: test input 0, then input 1. Only after both do you know whether the box is constant or balanced. Two tests.
- Quantum round: put the input through H, then the box, then H again, and measure once. A 0 means constant, a 1 means balanced, every time. One test.
One question instead of two. A tiny saving, but it was the first proof that interference can beat any ordinary method. Deutsch and Richard Jozsa extended it in 1992 to boxes with many inputs, where the gap becomes huge.
What are the big algorithms?
- Shor's algorithm (1994). Peter Shor found a way to factor large numbers exponentially faster than any known ordinary method. Most internet encryption relies on factoring being hard, so a big enough quantum computer would break it. Chapter 13 covers the threat and the fix. Optional page 7a shows it factoring 15.
- Grover's algorithm (1996). Lov Grover found a way to search an unsorted list of a million items in about a thousand steps instead of a million. It's a square-root speed-up: useful, but modest. Optional page 7b.
- Quantum simulation. In 1981 Richard Feynman proposed using quantum machines to simulate nature, which is quantum to begin with. Molecules and materials are the strongest long-term case: new drugs, batteries, catalysts and fertilisers. Optional pages 7b and 7c.
- Near-term methods. Hybrid methods share the work between a small quantum computer and an ordinary one, for chemistry and optimisation. They're widely tried. None has yet shown a clear advantage on a useful problem (chapter 14).
Part E · What quantum computers won't do
Will a quantum computer replace my laptop?
No. Quantum computers are specialists. For email, video, spreadsheets, games and nearly all of today's computing, an ordinary computer is faster, cheaper and far more reliable. Quantum computers also struggle with big data: loading a large dataset into qubits can take so long that it cancels out any speed-up.
Think of a quantum computer as an accelerator, like a graphics card, that an ordinary computer calls on for particular jobs, usually over the cloud. IBM put a 5-qubit machine on the cloud for anyone to try in 2016, and several companies now offer access.
Good fit or not?
Strong quantum case
Maybe, still unproven
Ordinary computers win
Simulating a new catalyst molecule
The answers, in words
- Simulating a new catalyst molecule: Strong case. Long term.
- Breaking today's RSA encryption: Strong case. Needs a very large error-corrected machine; chapter 13.
- Searching a huge unsorted list: Maybe. Modest speed-up, often eaten up by overheads.
- Optimising delivery routes: Maybe, still unproven. Quantum methods might help some optimisation problems, but nobody has shown a clear advantage yet.
- Training a large AI model: Maybe, still unproven. Data loading is a big obstacle.
- Streaming a film: Ordinary computers win. It's moving data, which ordinary computers and networks already do well.
- Running a spreadsheet: Ordinary computers win. Simple arithmetic: no interference trick makes it faster.
- Sending email faster: Ordinary computers win. Email speed is set by networks, not by computing.
Can it solve any hard problem?
No. Computer scientists believe quantum computers can't efficiently solve the hardest class of puzzles in general (problems like the travelling salesman, which computer scientists call NP-complete). They help where a problem hides a pattern that interference can find, such as the repeating pattern Shor's algorithm uses.
Myths and media
Media check
Right, half right or wrong? Call it first.
Card 1 of 3
A thriller: a quantum computer cracks every password in the world in seconds.
Check
Three quick ones
Collect
Your aha card
A quantum computer is an interference machine.
Gates turn qubit arrows so wrong answers cancel and right ones add up. It speeds up certain problems, not everything.
Next page · Chapter 8
Why are qubits fragile, and how do we fix that?
Every gate you just played with was perfect. Real ones aren't.
Next pageGo further
- 7a · Real-world caseShor's algorithm in pictures (factoring 15)
- 7b · A step deeperGrover's search and quantum simulation
- 7c · People storyFeynman's 1981 talk that launched quantum computing