Creating superpositions and
quantum interference

New operations in this topic

Click the name of the operation to see more details in the Operations Glossary.

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, H . In IBM Quantum Composer, this is the gate labeled H . A simple circuit that makes a superposition is given below. It starts with placing the H gate on the qubit (which starts in the |0\rangle state), then adding a standard measurement. Run the example below.

Superposition Circuit


Open in IBM Quantum Composer

Did you find that the results give a 0 close to half the time, and a 1 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 H gate on a qubit that starts in the |1\rangle state, followed by a standard measurement? You have already seen that we can flip the qubit from the state |0\rangle to the state |1\rangle by using an X gate. Run the example below.

Superposition with X Circuit


Open in IBM Quantum Composer

We find from this experiment that it also makes a uniform superposition. Similar to the case when the qubit was prepared in the |0\rangle state before we applied the H 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 H gates in succession. If we consider the H gate to be analogous to a coin flip, two H 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 Quantum Composer.

Interference Circuit


Open in IBM Quantum 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 |0\rangle 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 H gate makes a new state |+\rangle = H|0\rangle=1/\sqrt{2}\left(|0\rangle+|1\rangle\right) that is a uniform superposition (equal parts) of the |0\rangle and |1\rangle state. The measurement forces the system to be in either the |0\rangle state or the |1\rangle state with an equal probability.

In the second experiment, we made a new state |-\rangle = H|1\rangle=1/\sqrt{2}\left(|0\rangle-|1\rangle\right) that is still a uniform superposition (equal parts) of the |0\rangle and |1\rangle state, but with a different sign.

In the third case, we can think of this experiment as a sum of the two experiments H |0\rangle and H |1\rangle . If we add these two experiments together, the |1\rangle state cancels out because of a minus sign.

Here we see the difference between classical probability p and quantum amplitudes \psi , 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 p=|\psi|^2 , and is known as the Born rule. Even in Born’s original paper, he proposed p=|\psi| , and only corrected it in the proof.

Putting this all together gives

\begin{split}|+\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} ~~~~ |-\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -1 \end{pmatrix},\end{split}

and using |+\rangle = H|0\rangle and |-\rangle = H|1\rangle , uniquely defines the Hadamard gate in the computational basis by the matrix

\begin{split}H =\frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}.\end{split}

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.