4.1.4 Circuit identities
When you are dealing with a very complicated quantum circuit, it is good to know some tricks for simplifying things. Such tricks can not only make it easier to understand what the circuit does but also make the circuit more efficient and thus faster to execute on a quantum computer. Let us look at a few simple examples of such tricks involving just a single qubit.
Recall from Section 2.4.3 that each single-qubit operation is either a rotation or a reflection.
It is convenient to represent the action of these operations visually by recalling from Section 2.1.2 that qubit states form a circle.
One immediate observation you can make is that if any fixed reflection is applied twice on the same qubit, then you end up back with the original state.
Indeed, this is visually clear since reflecting about the same axis twice restores everything as it was (for example, you can see this in Fig. 2.4 for the
Exercise 4.5 (Z and NOT).
Solution.
-
1.
By applying
to and we get -
2.
To show this identity, we only need to check that
acts the same way as on the basis vectors (by linearity, this would mean that they act the same way on all qubit states):In both cases
inverts the bit, so it is implementing the same operation as . -
3.
The first part of the exercise shows that applying the Hadamard gate twice does nothing:
. Thus,where the last step is by part 2 of the exercise.
Another interesting question to ask is what happens if you apply two arbitrary rotations or reflections consecutively?
We know that what you get should again be either a rotation or a reflection.
But which one is it and what is the new angle?
Two consecutive rotations are simply the same as a single rotation by the sum of the two angles, i.e.,
Exercise 4.6 (Reflections and rotations (optional)).
Verify that a product of two reflections is a rotation. That is, show that
for some angle
Hint: Use Eq. 2.33 and use that
Solution.
-
1.
Using Eq. 2.29,
This holds for any state
, implying that where . This is also clear geometrically: if you first rotate by angle and then by angle , together this amounts to a rotation by angle . -
2.
Here is an elegant solution. Recall from Eq. 2.33 that we can express a general reflection in two different forms:
. If use the first expression for and the second expression for , we getwhere we used the fact that doing two consecutive
s amounts to doing nothing and that two consecutive rotations amount to a single rotation with the two angles being added, as shown above.
You can work out the remaining two cases that involve one rotation and one reflection on your own, and check that they both result in a reflection