Superposition
While the X gate seemed not too new, you will have noticed that the so-called Hadamard gate H ensures that we measure \(\ket{0}\) in about 50% of the cases and \(\ket{1}\) in the other 50%.
The application of the Hadamard gate thus brings the qubit into a state in which the probability of measuring \(\ket{0}\) or \(\ket{1}\) is 50% in each case. With this, you have discovered one of the special features of the world of quantum computers:
A qubit can be in state \(\ket{0}\), in state \(\ket{1}\), or be in something called a superposition of \(\ket{0}\) and \(\ket{1}\). Then it has a certain probability to be measured as \(\ket{0}\) or \(\ket{1}\). However, a measurement destroys the superposition – i.e. all the subsequent measurements will give you the same result that you have obtained in the first place.
This is different from how a bit behaves, so let’s try to understand it little more with a color analogy.
Let’s represent the state \(\ket{0}\) with the color red ■ and the state \(\ket{1}\) with the color blue ■. A superposition of \(\ket{0}\) and \(\ket{1}\) would be a mixture of the two. That is, some color on the spectrum below:
A fifty-fifty mixture would look purple ■, but if there were an unequal superposition then we would see a different color. For example, if I mix 80% blue ■ with 20% red ■, I get violet ■.
Here’s where the quantum world differs from the classical world. If I ask you to measure the color of a mixture (that is, a superposition of colors) in the classical world, you can easily do so and say that the mixture is violet ■ or purple ■ etc.
However, in quantum mechanics, a measurement destroys the superposition. If you are asked to measure a superposition of colors in quantum mechanics, your answer will always be either red ■ or blue ■, which are the two primary colors (states) of the system. The proportion of the two colors still matters, though. This proportion will determine how often you get each answer.
So, if you measure the color of a purple ■ state, 50% of the time, your measurement would be blue ■ and 50% of the time, your measurement would be red ■. For violet ■ (that is 80% blue ■ and 20% red ■), you would measure blue ■ 80% of the time and red ■ 20% of the time.
You can try it out with the colors below.
A model for qubits
As the model of a light bulb we used with bits is not sufficient for qubits, we need a different way of visualizing qubits. A convenient way to represent superposition, probabilities, and the effect of a measurement is using the Bloch sphere, which describes the surface of a globe with the north and south poles representing \(\ket{0}\) and \(\ket{1}\).
To allow our mental model to process what we just experienced with the H gate, we can allow the arrow to point in a direction other than up or down. For example, after applying the Hadamard gate to a qubit in state \(\ket{0}\), the arrow points towards the equator. If we measure the qubit, its state falls back to the base state up (representing \(\ket{0}\)) or to the base down (representing \(\ket{1}\)) with a certain probability.
The animation will prepare a qubit in an equal superposition of \(\ket{0}\) and \(\ket{1}\) before each measurement. You can try out how a measurement affects the state of the qubit by hitting Measure.
-
A
\(\ket{0}\)
-
B
\(\ket{1}\)
-
C
A superposition of \(\ket{0}\) and \(\ket{1}\)
Well done! Measuring a qubit, destroys its superposition. Therefore, a second measurement will again result in \(\ket{0}\).
Not quite! Measuring a qubit, destroys its superposition. Therefore, a second measurement will again result in \(\ket{0}\).