4.1.6 Measuring some of the qubits only
Naturally, we can also measure only a subset of the qubits. (We didn’t even discuss this for two qubits last week, since there was already plenty to talk about.) For example, assume that you have a three-qubit quantum state , like the one in Eq. 4.1, but instead of measuring all three qubits you measure only the first qubit. What is the probability of obtaining outcome ? It is simply the sum of all probabilities in Eq. 4.6 that correspond to a string that starts with :
For example, if we measure the first qubit of the state +
then we obtain outcome with probability .
We can measure individual qubits using Quirky simply by adding only a single measurement on the wire that we are interested in. To view the probability of measurement outcomes, drag a probability display onto the circuit. Why don’t you give it a try right now? For example, the following sequence of operations prepares the state in Eq. 4.7 and measures only the first qubit:
Indeed, following Eq. 4.8 we should obtain and with equal probability.
Once you measured the first qubit and obtained some outcome , what is the quantum state of the second and the third qubit? Following the same procedure as for probabilistic bits in Section 3.1.3, we first collect all terms of where the first qubit is in the state that corresponds to the outcome of interest:
Next, we leave out the first qubit in all four terms, since it was measured:
Finally, we normalize this so that we obtain a valid two-qubit state. For this, we want to find a number such that is a qubit state, i.e.,
The overall sign is not important, so we can simply use
which is the square root of the probability in Eq. 4.8.
To summarize, if you measure the first qubit of a three-qubit state as in Eq. 4.1, you obtain outcome with probability
and the resulting two-qubit state on the remaining two qubits is
What does this mean in the situation of (4.9), where we prepare the state and then measure the first qubit? If the measurement outcome is (which happens with probability ), the remaining two qubits are in state
If instead the outcome is then the remaining qubits are similarly in state .
Since measuring one qubit out of many can be quite tricky, let us discuss another method for doing this. Consider again a general three-qubit state like the one in Eq. 4.1 and assume that we want to measure the first qubit. We can rewrite the eight terms in the expression of as follows:
We can now rewrite this as
where the are probabilities (namely, the ones from Eq. 4.10) and the are quantum states (the two-qubit states from Eq. 4.11).
In fact, whenever you manage to write your quantum state in the form of Eq. 4.13 then you can simply read off the probabilities of the measurement outcomes in this way, and also see what the state on the remaining two qubits is after the measurement. For example,
This confirms that in our running example (4.9), both outcomes happen with probability and that the state of the remaining qubits is either or , depending on the outcome. This method of first grouping terms and then normalizing them is rather intuitive and generally very useful. However, when using it you should be very careful not to forget to correctly normalize the states! That is, whatever constants you pull out in front of the two basis states in Eqs. 4.12 and 4.13, they should satisfy and the states and on the remaining qubits should be properly normalized, see Eq. 4.3.
We can proceed completely analogously if we have more than three qubits, or we want to measure another qubit than the first, or if we want to measure more than a single qubit! For example, suppose we were to measure the first two qubits of a general three-qubit state from Eq. 4.1. Then the measurement outcome consists of two bits, and , occurring with probabilities
and the remaining qubit after the measurement is in state
Exercise 4.7 (Two out of three).
What are the probabilities of outcomes if you measure the first two qubits of the three-qubit state in Eq. 4.7? Use Quirky to confirm your result.
If we measure some of the qubits but not others, we will often want to use measurement outcomes to determine if an operation should be applied to the remaining qubits or not. For example, suppose that in the situation of (4.9) you want to reset the remaining two qubits to state . Now, if the measurement outcome is zero, nothing needs to be done. But if the measurement outcome is one, then we know that the two remaining qubits are in state and we would like to reset them back to . This can be done by applying a operation to each of them. However, how do we know whether we should really apply this operation or not because this depends on the earlier measurement outcome on the first qubit. Hence, we would like to apply it only when the measurement outcome is . In other words, we want to apply a controlled-NOT gate, where the control is now a classical bit (the outcome of the measurement) but the target is still quantum.
In Quirky we can realize this as you would expect, namely by using a classical bit as the control and a quantum bit as the target, as in the following:
Here, after the first qubit is measured, we apply two further controlled-NOT operations that are controlled by the measurement outcome and then we measure the remaining two qubits. The picture shows that we indeed successfully reset the two qubits, since measuring them yields with 100% probability.
If we liked, we could describe these operations in terms of ‘hybrid’ states that consist of one bit and two qubits, e.g.,
but we will not need this level of formality.