Intuitively Analyzing the Quantum Gate Matrix

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:

images/_pragprog/svg-block-183.png

We want to see how this gate affects the following qubit:

images/quantum_gates_algebra/One_Pentagon_One_Triangle_Both_Rotated.png

Both types of qubelets are rotated from their non-inverted orientations: the pentagon images/_pragprog/svg-17.png qubelet is rotated 90° anticlockwise and the triangle images/_pragprog/svg-18.png qubelet is inverted upside down 180°. The relative difference in their orientations, images/_pragprog/svg-97.png, is images/_pragprog/svg-242.png. We can compute the equation for its quantum state, but we’ll hold off for a bit.

Angles Are Measured Anticlockwise

images/aside-icons/note.png

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.

S Gate on the images/_pragprog/svg-17.png Qubit

When this gate acts on the images/_pragprog/svg-17.png qubit having a pentagon images/_pragprog/svg-17.png qubelet, the first column of the images/_pragprog/svg-240.png matrix defines how it changes the qubit’s state:

images/_pragprog/svg-block-184.png

In other words, this gate leaves the pentagon images/_pragprog/svg-17.png qubelets alone.

S Gate on the images/_pragprog/svg-18.png Qubit

When a images/_pragprog/svg-18.png qubit holding a triangle images/_pragprog/svg-18.png qubelet is fed to this gate, the second column of the images/_pragprog/svg-240.png matrix governs how it changes the qubit’s quantum state:

images/_pragprog/svg-block-185.png

The modified quantum state only has a triangle images/_pragprog/svg-18.png qubelet. But the presence of the complex number images/_pragprog/svg-106.png hints that something else is going on with the triangle images/_pragprog/svg-18.png qubelet.

Deciphering the Presence of the Complex Number

Recall from Rotating Qubelets Through Any Angle, the vector for a general quantum state and equate it with the vector obtained previously. That is:

images/_pragprog/svg-block-186.png

The angle images/_pragprog/svg-97.png is the relative difference in orientations between the pentagon images/_pragprog/svg-17.png and triangle images/_pragprog/svg-18.png 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:

images/_pragprog/svg-block-187.png

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:

images/_pragprog/svg-block-188.png

Using Euler’s formula,[42] expand images/_pragprog/svg-243.png:

images/_pragprog/svg-block-189.png

The expanded form of the vector for the quantum state is:

images/_pragprog/svg-block-190.png

Since the bottom term of the vector is a “pure” complex number, namely, images/_pragprog/svg-106.png, experiment with values that force images/_pragprog/svg-244.png to 0. In fact, it’s easy to see that if images/_pragprog/svg-245.png or 90°, images/_pragprog/svg-141.png. Moreover, images/_pragprog/svg-246.png.

In other words, the S gate rotates the triangle images/_pragprog/svg-18.png qubelet by 90° anticlockwise:

images/quantum_gates_algebra/S_Gate_One_Triangle.png

(Note that since there are no pentagon images/_pragprog/svg-17.png qubelets in the idealized images/_pragprog/svg-18.png qubit, the relative angle images/_pragprog/svg-97.png is computed from the position of the triangle images/_pragprog/svg-18.png before the S gate acts on the qubit.)

Now, we can put together the action of the S gate on the original blended qubit:

  • The pentagon images/_pragprog/svg-17.png qubelets are left alone.
  • The triangle images/_pragprog/svg-18.png qubelets are rotated 90° anticlockwise.

Pictorially, the action of the S gate on the blended qubit is shown in the following figure:

images/quantum_gates_algebra/S_Gate_One_Quarter_Rotated_Pentagon_One_Half_Rotated_Triangle.png

Since only the relative difference between the orientations of the pentagon images/_pragprog/svg-17.png and triangle images/_pragprog/svg-18.png qubelets determine the angle images/_pragprog/svg-97.png, you could just as well first rotate both qubelets by 90° clockwise so that the pentagon images/_pragprog/svg-17.png qubelet is non-inverted, and then apply the S gate, as shown in the following figure:

images/quantum_gates_algebra/S_Gate_One_Pentagon_One_Quarter_Rotated_Triangle.png

If this action of the S gate meets your needs, then proceed to quantitatively verify the operation and confirm your hunch.

Precisely Calculating the S Gate Action

To apply the S gate matrix to the blended qubit, you need to compute its quantum state vector. Again, we’ll do this quickly:

Calculating the Qubelet Amplitudes

Since the qubit has one pentagon images/_pragprog/svg-17.png and one triangle images/_pragprog/svg-18.png 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:

images/_pragprog/svg-block-191.png

Or, writing as a vector:

images/_pragprog/svg-block-192.png

Note the images/_pragprog/svg-243.png term on the bottom element associated with the triangle images/_pragprog/svg-18.png qubelet. At this point, we just know the probabilities of choosing a pentagon images/_pragprog/svg-17.png or triangle images/_pragprog/svg-18.png qubelet from the blended qubit. We still don’t know how they’re oriented.

Calculating the Qubelet Orientations

Since images/_pragprog/svg-97.png measures the relative difference in rotations, it helps to rotate both types of qubelets by 90° clockwise so that the pentagon images/_pragprog/svg-17.png qubelet is non-inverted:

images/quantum_gates_algebra/One_Pentagon_One_Triangle_Quarter_Rotated.png

In this quantum state, the relative difference images/_pragprog/svg-97.png between the rotations of the pentagon images/_pragprog/svg-17.png and triangle images/_pragprog/svg-18.png qubelets is still 90° or images/_pragprog/svg-148.png. Thus, the term images/_pragprog/svg-243.png:

images/_pragprog/svg-block-193.png

And this qubit’s quantum state expressed as a vector is:

images/_pragprog/svg-block-194.png

Now that we have the quantum state as a vector, multiply it by the S gate’s matrix images/_pragprog/svg-240.png to get the resultant state:

images/_pragprog/svg-block-195.png

The negative sign in the bottom term comes from images/_pragprog/svg-243.png with images/_pragprog/svg-247.png. That is,

images/_pragprog/svg-block-196.png

This vector corresponds to a quantum state in which the pentagon images/_pragprog/svg-17.png qubelet is non-inverted and the triangle images/_pragprog/svg-18.png qubelet is inverted upside down, as shown in the following figure:

images/quantum_gates_algebra/One_Pentagon_One_Triangle_Half_Rotated.png

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.

Try Your Hand

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"​;
  1. 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.

    1. Specify a Universal gate, images/_pragprog/svg-231.png, that puts a images/_pragprog/svg-17.png qubit into a quantum state, images/_pragprog/svg-194.png, defined by the following vector:

      images/_pragprog/svg-block-197.png
    2. Write a program using this gate and confirm that the quantum state collapses to images/_pragprog/svg-17.png and images/_pragprog/svg-18.png as you’d expect.

    3. Using the parameters for the images/_pragprog/svg-231.png gate you calculated previously, write a program that implements the following quantum circuit:

      images/quantum_gates_algebra/0_U3_90_90_0_S_Measure.png

      Use the following statement to declare the S gate:

       s q[0];
    4. By looking at the output of your program, can you confirm that the pentagon images/_pragprog/svg-18.png qubelets are rotated as you calculated?

  2. Which gate would you use to rotate the pentagon images/_pragprog/svg-17.png qubelets by 90° clockwise while leaving the triangle images/_pragprog/svg-18.png qubelets alone, as shown in the following circuit:

    images/quantum_gates_algebra/Which_Gate_to_Rotate_Pentagon_Qubelets.png

    Intuitively reason out the type of gate you’d use in this circuit.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.26.246