By this point, you’ve topped up your toolkit with the equation for the quantum state, the Bloch sphere, Universal gates, and quantum gate matrices. Given any quantum gate, you can work out how it’ll modify any arbitrary quantum state. But before reaching into your arsenal, it is always worth trying to see if you can intuitively reason out how the gate acts on the qubit. This will come in handy when you’re designing your own quantum algorithms and want to quickly determine if the gate modifies the qubelets as you want, without getting distracted by the mathematics.
To demonstrate this way of thinking, we’ll work with the S gate defined by the following matrix:
We want to see how this gate affects the following qubit:
Both types of qubelets are rotated from their non-inverted orientations: the pentagon qubelet is rotated 90° anticlockwise and the triangle qubelet is inverted upside down 180°. The relative difference in their orientations, , is . We can compute the equation for its quantum state, but we’ll hold off for a bit.
Angles Are Measured Anticlockwise | |
---|---|
In mathematics, positive angles are measured by going in the anticlockwise direction. Thus, an angle of 270° means rotating three-quarters of a complete rotation anticlockwise. This angle is equivalent to –90°, a quarter-circle rotation in the clockwise direction. |
Before working out how the S gate affects these qubelets, let’s first see how the gate modifies each idealized state.
When this gate acts on the qubit having a pentagon qubelet, the first column of the matrix defines how it changes the qubit’s state:
In other words, this gate leaves the pentagon qubelets alone.
When a qubit holding a triangle qubelet is fed to this gate, the second column of the matrix governs how it changes the qubit’s quantum state:
The modified quantum state only has a triangle qubelet. But the presence of the complex number hints that something else is going on with the triangle qubelet.
Recall from Rotating Qubelets Through Any Angle, the vector for a general quantum state and equate it with the vector obtained previously. That is:
The angle is the relative difference in orientations between the pentagon and triangle qubelets, the quantity that we’re most concerned with.
In keeping with our “down-home” analysis, let’s restate the general quantum state vector as:
Here, the “something” terms indicate values we’re not interested in at the moment. In fact, we can go one step further: since the top term of the vector is 0, we can express the right-hand side of the previous equation as:
Using Euler’s formula,[42] expand :
The expanded form of the vector for the quantum state is:
Since the bottom term of the vector is a “pure” complex number, namely, , experiment with values that force to 0. In fact, it’s easy to see that if or 90°, . Moreover, .
In other words, the S gate rotates the triangle qubelet by 90° anticlockwise:
(Note that since there are no pentagon qubelets in the idealized qubit, the relative angle is computed from the position of the triangle before the S gate acts on the qubit.)
Now, we can put together the action of the S gate on the original blended qubit:
Pictorially, the action of the S gate on the blended qubit is shown in the following figure:
Since only the relative difference between the orientations of the pentagon and triangle qubelets determine the angle , you could just as well first rotate both qubelets by 90° clockwise so that the pentagon qubelet is non-inverted, and then apply the S gate, as shown in the following figure:
If this action of the S gate meets your needs, then proceed to quantitatively verify the operation and confirm your hunch.
To apply the S gate matrix to the blended qubit, you need to compute its quantum state vector. Again, we’ll do this quickly:
Since the qubit has one pentagon and one triangle qubelet, the probability of it collapsing to either one of these is half. Take the square root to get the amplitudes and write the state as follows:
Or, writing as a vector:
Note the term on the bottom element associated with the triangle qubelet. At this point, we just know the probabilities of choosing a pentagon or triangle qubelet from the blended qubit. We still don’t know how they’re oriented.
Since measures the relative difference in rotations, it helps to rotate both types of qubelets by 90° clockwise so that the pentagon qubelet is non-inverted:
In this quantum state, the relative difference between the rotations of the pentagon and triangle qubelets is still 90° or . Thus, the term :
And this qubit’s quantum state expressed as a vector is:
Now that we have the quantum state as a vector, multiply it by the S gate’s matrix to get the resultant state:
The negative sign in the bottom term comes from with . That is,
This vector corresponds to a quantum state in which the pentagon qubelet is non-inverted and the triangle qubelet is inverted upside down, as shown in the following figure:
This state is identical to the one we informally calculated earlier.
This exercise was, of course, a simple one, and it may have been easier to use the S gate matrix. In general, though, the qubelets could be arbitrarily rotated, and you may need to apply a sequence of gates to get them to the desired state. In these cases, you may often find it easier to work with pictures and identify which rotations of the qubelets you need to apply before validating the operations with precise mathematical calculations.
Before learning to use these matrices when the qubit is acted on by several gates in sequence, it’s helpful to have a handy cheat sheet listing the pertinent details for gates you’ll see in practice.
Solutions to these exercises are given in Analyzing Quantum Gate Matrices Solutions.
For any code listing in the exercises, assume the following header lines:
| OPENQASM 2.0; |
| include "qelib1.inc"; |
In problems and programming exercises so far, you’ve approached them using qubelets. When you’re working as part of a team, however, the other members may not be familiar with this model.[43] So in this exercise, you’ll work through the example in the previous section, but stated using the language and terms you’ll encounter in the workplace.
Specify a Universal gate, , that puts a qubit into a quantum state, , defined by the following vector:
Write a program using this gate and confirm that the quantum state collapses to and as you’d expect.
Using the parameters for the gate you calculated previously, write a program that implements the following quantum circuit:
Use the following statement to declare the S gate:
| s q[0]; |
By looking at the output of your program, can you confirm that the pentagon qubelets are rotated as you calculated?
Which gate would you use to rotate the pentagon qubelets by 90° clockwise while leaving the triangle qubelets alone, as shown in the following circuit:
Intuitively reason out the type of gate you’d use in this circuit.
3.149.26.246