Creating superpositions and quantum interference¶
Up to this point, our qubit has behaved like a classical bit. To go beyond classical behavior, we must explore what it means to make a superposition. A superposition is a weighted sum or difference of two or more states; in other words, it is a linear combination.
One common operation that generates a superposition is the Hadamard gate, . In Circuit Composer, this is the gate labeled . A simple circuit that makes a superposition is given below. It starts with placing the gate on the qubit (which starts in the state), then adding a standard measurement. Run the example below.
Did you find that the results give a close to half the time, and a the rest of the time? Indeed, much like flipping a fair coin, the results are close to 50/50 (running on the real device will give less-than-ideal results, due to noise and errors).
But what happens if you placed the gate on a qubit that starts in the state, followed by a standard measurement? You have already seen that we can flip the qubit from the state to the state by using an gate. Run the example below.
Superposition with X Circuit
We find from this experiment that it also makes a uniform superposition. Similar to the case when the qubit was prepared in the state before we applied the gate, the results show nearly a 50/50 distribution of zeros and ones.
At first glance, these two demonstrations seem no different to flipping a fair coin. However, quantum randomness is very different. Let’s see how. Run the experiment again, but this time with two gates in succession. If we consider the gate to be analogous to a coin flip, two gates should be flipping it twice…after all, when you flip a coin twice in a row, you would still expect close to a 50/50 distribution. Run the example below in Circuit Composer.
This time, the results are surprising. Unlike the classical case, with probability one (high probability on the real systems) the outcome is not random; the qubit is always found to be in the state. Since the third experiment is an extension of the first experiment, somehow interference has erased the randomness to give a deterministic outcome. Quantum randomness is not simply like a classical random coin flip. In all the above experiments, the system (without noise) is in a definite state, but only in the first case does it behave randomly.
Let’s dig into this a bit more. In the first experiment, the gate makes a new state that is a uniform superposition (equal parts) of the and state. The measurement forces the system to be in either the state or the state with an equal probability.
In the second experiment, we made a new state that is still a uniform superposition (equal parts) of the and state, but with a different sign.
In the third case, we can think of this experiment as a sum of the two experiments and . If we add these two experiments together, the state cancels out because of a minus sign.
Here we see the difference between classical probability and quantum amplitudes , which can be positive, negative, or even complex. Measurements cannot detect the phase (negative sign); they can only detect classical probabilities. It turns out that the relationship between quantum amplitudes and classical probabilities is , and is known as the Born rule. Even in Born’s original paper, he proposed , and only corrected it in the proof.
Putting this all together gives
and using and , uniquely defines the Hadamard gate in the computational basis by the matrix
From this you see that qubits can be in quantum superpositions, and that these superpositions can have a sign that leads to interference, making quantum randomness disappear. The main message that you should take away from this this section is:
A physical system in a definite state can still behave randomly.
This is the first of the two principles mentioned in the introduction to the Field Guide. This needs to become your new intuition, as it is what makes quantum systems different to classical systems.