← Back

Superposition Does Not Mean Trying All Solutions at Once

Superposition lets us represent amplitudes associated with different states, but a measurement does not hand us all of those states. The key to quantum algorithms is manipulating amplitudes through interference to favor useful results.

Superposition
Superposition

There is a mistaken assumption about quantum computing that shows up far too often: “since a qubit can be 0 and 1 at the same time, a quantum computer can try all solutions simultaneously.”

This misconception is more common among software developers because we have deeply internalized the concept of parallelization, or parallel computing.

Superposition is one of the properties that make quantum computing possible, but by itself it does not solve a problem, nor does it let us read out all the alternatives represented by a quantum register in one go. If it did, designing quantum algorithms would be very easy, and it is not: we would prepare a superposition of all possible inputs, run an operation, and ask the computer for the correct answer.

The problem lies precisely in that last part: measurement.

What it really means for a qubit to be in superposition

To properly understand superposition, we have no choice but to use the mathematical notation of quantum computing, which I assure you is easier than it looks.

Let’s start with the basics: a classical bit stores a 0 or a 1. The state of a qubit, on the other hand, can be written as

∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha |0\rangle + \beta |1\rangle

, where α\alpha and β\beta are complex numbers called amplitudes, as we have already seen in some of my previous articles. They must also satisfy

∣α∣2+∣β∣2=1|\alpha|^2 + |\beta|^2 = 1

The important thing here is not to confuse amplitudes with two classical values stored simultaneously. When we measure the qubit in the computational basis, we get 0 with probability ∣α∣2|\alpha|^2 and 1 with probability ∣β∣2|\beta|^2. A single measurement produces a single classical result.

We can see this with one of the most common gates in quantum computing, the Hadamard gate. If we start in ∣0⟩|0\rangle and apply HH (this is how we represent applying the Hadamard gate transformation):

|0⟩ ──H──M──

, we obtain

H∣0⟩=∣0⟩+∣1⟩2H|0\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}

If we measure many independent runs of the circuit, we will observe roughly half 0s and half 1s. But in each run we get only one of them. IBM Quantum describes a general state precisely in terms of normalized complex amplitudes, and the measurement of a superposition as a probabilistic outcome.

This should already make us suspicious of the expression “try all solutions at once.” Even if we prepare many possibilities, at the end we do not have a return capable of giving them all back, and I know this clashes quite a bit when you first approach this discipline.

Many qubits don’t solve the problem either

The confusion becomes even more tempting when we go from one qubit to several. With nn qubits we can describe a general state as a combination of 2n2^n computational basis states:

∣ψ⟩=∑x=02n−1αx∣x⟩|\psi\rangle = \sum_{x=0}^{2^n-1} \alpha_x |x\rangle

with

∑x∣αx∣2=1\sum_x |\alpha_x|^2 = 1

For example, two qubits initially in ∣00⟩|00\rangle, after applying a Hadamard to each one, end up in

12(∣00⟩+∣01⟩+∣10⟩+∣11⟩).\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle+|11\rangle).
|0⟩ ──H──M──
|0⟩ ──H──M──

We have amplitudes associated with four states. However, when we measure, we don’t receive a list with 00, 01, 10 and 11. We receive one of those four results.

This detail completely changes the perspective. A circuit can jointly transform the amplitudes of a huge number of basis states, but representing those possibilities is not the same as extracting the result of a classical computation performed independently on each of them.

At this point, the natural question is: what is the point of preparing a superposition?

The interesting part isn’t just superposition: it’s interference

Okay, let’s add another concept to complicate things a bit more, although I assure you that once you internalize all this, it will seem like the most natural thing in the world.

Amplitudes have magnitude and phase (they are represented by complex numbers). This allows contributions from different computational paths to add up or cancel out as the circuit evolves. That is where interference appears.

There is a minimal circuit that shows it better than many analogies:

|0⟩ ──H──H──M──

The first Hadamard prepares

∣+⟩=∣0⟩+∣1⟩2|+\rangle = \frac{|0\rangle+|1\rangle}{\sqrt{2}}

It may seem that we have simply introduced a 50% probability for each result. But we apply a second Hadamard and something revealing happens:

H∣+⟩=∣0⟩H|+\rangle = |0\rangle

The result is no longer 50/50. In the ideal circuit, the measurement returns 0 with probability 1. The amplitudes have interfered. The Hadamard gate is also its own inverse, so H2=IH^2=I.

We can make the role of phase even more visible by inserting a ZZ gate between the two Hadamards:

|0⟩ ──H──Z──H──M──

After the first Hadamard we have ∣+⟩|+\rangle. The ZZ gate changes the relative phase and produces

∣−⟩=∣0⟩−∣1⟩2|-\rangle = \frac{|0\rangle-|1\rangle}{\sqrt{2}}

The second Hadamard transforms this state into ∣1⟩|1\rangle. A phase that we could not distinguish by measuring right after the first Hadamard ends up, thanks to interference, as an observable difference.

That looks much more like what we want to achieve in a quantum algorithm.

A quantum algorithm needs to prepare, transform and interfere

Suppose we have a huge space of candidate solutions. Putting those candidates in superposition is only the beginning; in fact, most quantum algorithms start that way. If we end the circuit and measure immediately, we will get a sample according to the existing probability distribution. There is no reason for it to be precisely the solution we are looking for.

The algorithm’s job is to design transformations that exploit the structure of the problem. In simplified terms, we want certain paths to interfere destructively and reduce the amplitude of unwanted results, while others interfere constructively and increase the amplitude of useful results. And finally, of course, we measure.

This is a fundamental difference from imagining a gigantic for loop magically running in parallel.

Moreover, not all quantum algorithms use exactly the same strategy or offer the same kind of improvement. Some exploit interference and periodicity, others perform amplitude amplification, and others are designed to estimate properties of quantum states. Simply talking about “quantum parallelism” can hide precisely the most important thing: how the algorithm manages to make useful information end up being observable.

But since we are human, and with all due caveats, following the popular expression of Maslow’s hammer (if the only tool you have is a hammer, every problem looks like a nail, or something like that), software developers who have so deeply internalized classical computing naturally try to adapt all the concepts we know so well to this other model of computation, and in that step, many confusions arise.

Measurement sets the rules of the game

For a software developer, this may be the most important mental shift. We are used to thinking that if a computation has generated information internally, we will be able to inspect it afterwards. Quantum computing does not work that way.

The state vector contains amplitudes, not a classical array that we can iterate over to print its 2n2^n components from a quantum processor. The measurement we perform on the register produces classical results according to the probabilities determined by those amplitudes.

That is why a useful quantum algorithm is not limited to creating many possible states. It must organize the evolution of its amplitudes so that measurement reveals information we care about with sufficient probability, normally also relying on multiple runs and classical post-processing of the results.

That nuance matters because it removes part of the apparent magic without making quantum computing any less interesting. On the contrary: the truly interesting problem is not having 2n2^n terms in the mathematical description of nn qubits. The challenge is getting quantum operations to do something computationally useful with them.

A more useful way to think about superposition

I would avoid the idea that a quantum computer “tries all solutions at once.” Saying so may be a first step toward digesting what is really happening. As a popular-science shortcut it seems to explain a lot, but later it forces you to unlearn too much.

It is more accurate to think that a quantum register can hold amplitudes associated with multiple basis states, and that a circuit transforms those amplitudes, including their phases, before measuring. Superposition creates the space in which that evolution can take place; interference allows amplitudes to be redistributed; measurement determines which classical information we can recover.

And that is a large part of the art of quantum algorithms: not generating all the possibilities, but designing an evolution in which the possibilities we care about have a useful way of becoming visible at the end.

After reading the above, you will have a clearer sense of the imprecision when you hear someone say that a quantum computer is fast because it “tries all solutions at the same time.” A superposition is not the answer to a problem. It is only part of the mechanism by which certain quantum algorithms try to construct it.