Quantum Amplitudes and Probabilities | by Frank Zickert | Quantum Machine Learning | Towards Data Science

This post is part of the book: Hands-On Quantum Machine Learning With Python.
The qubit state vector contains amplitudes rather than measurement probabilities.
The amplitudes belong to waves. Because in quantum mechanics, the behavior of quantum particles is described by wave functions.
Waves have three characteristics.
The wavelength is the distance over which the wave’s shape repeats.
The phase of a wave is the position on the waveform cycle at a certain point.
The amplitude of a wave is the distance between its center and its crest.
The following figure depicts these three characteristics.
As we can see in the figure, amplitudes can be positive or negative. Whether the amplitude is positive or negative depends on the imaginary point x. If you chose a different point x∗, the same wave would have a negative amplitude.
If you take two identical yet shifted waves, one might have a positive amplitude whereas the other has a negative at point x. These two waves differ in their phase. But when you measure either one of these two waves, they are alike. You don’t see any difference. Their effects on the measurement probabilities are the same.
Mathematically, the probability of measuring the qubit as 0 or 1 is the square of the corresponding amplitude. It does not matter whether the amplitude is positive or negative.
with
In fact, the measurement probabilities are the squares of the amplitude absolutes ( |alpha|^2 + |beta|^2 = 1 ).
Though, amplitudes and probabilities are two different things.
Thus far, the measurement probabilities were all we cared about. We only cared about amplitudes inside the math. We didn't yet work with qubit amplitudes and phases.
But we can work with amplitudes, too. For instance, the Z-gate switches the sign of the amplitude.
When we look at the resulting amplitudes of the qubit, we see the qubit has a negative amplitude in state 1. But the measurement probabilities are both positive.
While amplitudes can be negative, probabilities can’t. This is one consequence of the qubit state normalization α^2+β^2=1.
The normalization formula constrains the values the measurement probabilities can obtain. It does not constrain the amplitudes.
But why should we even care about the sign of a state’s amplitude in quantum computing if it doesn’t matter for the resulting probability?
The answer is wave interference. Waves have the distinct characteristic that they interfere with each other. Simply put, they add up. If you have two waves traveling on the same medium, they form a third wave that represents the sum of their amplitudes at each point.
Qubits work accordingly. While the sign of the amplitude and the resulting phase of a qubit do not affect the measurement probabilities, once qubits interfere with each other, their resulting amplitudes may differ and therefore affect the measurement probabilities.
This is known as amplitude amplification. It is an important tool in our quantum computing toolbox.
Let’s have a look at the quantum circuit depicted in the following figure.
We have two qubits. Both are in a balanced state of superposition after we applied the first Hadamard-gate on each of them.
At this time, we have four possible states with equal amplitudes and equal measurement probabilities.
The following controlled Z-gate switches the sign of the amplitude only of the state |11⟩. It works like the other controlled gates we got to know except for the applied gate. Here, it is the Z-gate.
The following sequence of Z-gates and another controlled Z-gate encapsulated in H-gates (HZH) is known as Grover’s iterate. It is a reflection circuit that inverts all states about the mean amplitude (not the mean probability).
For three out of four states have a positive amplitude (0.5) but only one has a negative amplitude (−0.5), the mean amplitude is 0.25.
Those states with the positive amplitude result at an amplitude of 0 because 0.5−(2∗0.25)=0.
The one state with the negative amplitude results in an amplitude of 1 because −0.5−(2∗(−0.75))=1.
Even though the phase of a qubit state vector (the sign of its amplitude) does not matter for the resulting measurement probability, it does matter inside the quantum circuit. Because we can work with the phases.
The following code shows the implementation of this circuit and the measurement probabilities.
The result shows a chance of 1.01.0 to measure the system as 11. Unlike before, when we directly worked with the measurement probabilities, we only change the phase of the qubit.
Qubits resemble the behavior of waves. As such, their amplitudes matter when they interact. Simply put, the circuit we implemented first changes the phase of the state |11⟩ (by negating its amplitude). Then, it adds another wave that shares the same phase as state |11⟩. It doubles the amplitude of this state from (−)0.5 to 1. For this phase is the exact opposite of the phase the other three states have, they cancel out.
This post is part of the book: Hands-On Quantum Machine Learning With Python.
Get the first three chapters for free here.