MODULE 2 ยท LESSON 1
Free โ no login requiredSign in to track progress, save quiz attempts and enrol in the full course.
Sign in to track progress / enrolSuperposition Without the Mysticism
Superposition gets treated as the headline. It is really the setup, and it is cheap to obtain.
Gates
A quantum computer is programmed with gates, operations applied to one or two qubits at a time, exactly as classical circuits are built from logic gates. A sequence of gates is a circuit, and a circuit is what a quantum program actually is.
A gate transforms amplitudes. That is its entire job. It takes the numbers describing the qubits and produces new numbers.
The most important starter gate is the Hadamard. Applied to a qubit sitting definitely at 0, it produces equal amplitudes for 0 and 1. Measure afterwards and you get each half the time.
Apply Hadamard gates to 300 qubits and you have a superposition spanning every one of the 2 to the 300 possible bit strings, with equal amplitude on each. This takes 300 operations, one per qubit. It is fast, easy, and the first step of a great many algorithms.
It is also, by itself, worth nothing. Measure now and you get one random 300 bit string, which you could have generated far more cheaply by flipping coins.
Getting into a superposition over every possibility costs one gate per qubit. Getting something useful back out is the entire discipline.
Reversibility
An unfamiliar property that matters practically.
Classical logic destroys information. A classical AND gate takes two bits and produces one, and given only the output 0 you cannot say which of three input combinations produced it. The inputs are gone.
Quantum gates are reversible. Every operation can be undone, and no information is destroyed. Formally, this is required because the operations must preserve total probability.
Two practical consequences follow.
Classical algorithms need rewriting to run on quantum hardware. You cannot simply drop in an irreversible operation, and translating a classical routine into a reversible circuit usually costs extra qubits to hold the information that would otherwise have been discarded.
Uncomputation becomes a real technique. Intermediate working left in scratch qubits can spoil interference later, so algorithms often run a sub-calculation, use the result, then deliberately run the sub-calculation backwards to clear the scratch space. It is a step with no classical counterpart and a routine part of quantum programming.
Measurement is the one exception. It is not reversible, which is precisely why it happens at the end.
Why this reframes the whole subject
Once you see that superposition is cheap, the popular framing collapses in a useful way.
If a quantum computer's power came from being in many states at once, the field would have been finished in the 1980s, because putting a machine into many states at once is trivial. The reason quantum computing is difficult, and the reason useful algorithms are rare, is that the many states have to be manipulated so that the interesting one survives.
So when you encounter a claim that a quantum computer will solve some problem because it can consider all the options simultaneously, you now have the specific question to ask: what makes the wrong options cancel? If there is no answer, there is no algorithm, only a superposition and a random result.
That question is the practical outcome of this module, and the next lesson explains the mechanism it points at.
Practitioners write circuits, and seeing the shape of one removes a lot of mystique.
A circuit is drawn as horizontal lines, one per qubit, read left to right as time. Boxes on a line are gates applied to that qubit. Symbols connecting two lines are two qubit gates. At the right hand end are measurement symbols.
Nearly every algorithm has the same four part shape.
Preparation. Set the qubits to a known starting state, conventionally all zeros. Hardware effort, not algorithmic.
Superposition. Apply Hadamard gates to spread amplitude across the possibilities you want to consider. Cheap and usually one layer.
The interesting part. A sequence of gates encoding the problem, arranged so that amplitudes for wrong answers cancel and amplitudes for right answers reinforce. This is where the algorithm lives, where all the difficulty is, and it is frequently repeated many times.
Measurement. Read the qubits and obtain classical bits.
Two features surprise newcomers.
First, the circuit is normally run many times, often thousands. One run gives one sample from a probability distribution, and you need the distribution. This is called taking shots, and it is why quantum hardware time is quoted in shots rather than seconds.
Second, the classical computer is doing a great deal of work throughout: preparing the circuit, choosing parameters, aggregating results across shots, and often adjusting the circuit and running again. In most current work the classical part dominates, which is why realistic descriptions call these hybrid algorithms rather than quantum ones.
An algorithm applies a Hadamard gate to each of 50 qubits, creating a superposition over all 2 to the 50 possible bit strings, then immediately measures. What is the result?
Quantum gate
Click to flipAn operation on one or two qubits that transforms amplitudes. Always reversible, unlike most classical logic gates.
Click to flip backGates transform amplitudes, and the Hadamard gate creates a full superposition at a cost of one operation per qubit, so getting into every state at once is the cheap part. Measure straight afterwards and you get a random string that coin flipping would have supplied. All the difficulty, and all the value, lies in the middle section where wrong answers must be made to cancel. Quantum gates are also reversible, which forces classical routines to be rewritten and makes uncomputation a routine technique with no classical counterpart.