# Quantum phase¶

In the last two sections we covered the NOT and the Hadamard gate. These gates give us the tools to make the single-qubit quantum states , and have introduced us to quantum superpositions. However, a general single-qubit quantum state has even richer qualities. It is represented by a two-dimensional vector space over the complex numbers , which means that a qubit takes two complex numbers to fully describe it. An arbitrary quantum state, denoted , can be any superposition of the basis vectors. The quantum amplitudes and are complex numbers which, from the Born rule, the result 0 is obtained with probability , and the result 1 is obtained with the complementary probability . Note that, from the conservation of probability, , and since the global phase of a quantum state is not detectable ( is the same as ), the single-qubit state can be rewritten as

where is the probability of the bit being in the state, and is the quantum phase.

Circuit Composer has a series of quantum phase-shift gates that allow us to shift this phase by the following: T gate \varphi\rightarrow\varphi+\pi/4 S gate \varphi\rightarrow\varphi+\pi/2 Z gate \varphi\rightarrow\varphi+\pi S^\dagger gate \varphi\rightarrow\varphi-\pi/2 T^\dagger gate \varphi\rightarrow\varphi-\pi/4

and the general phase-shift gate: U_1(\phi) gate \varphi\rightarrow\varphi+\phi ,

which has the matrix form

Here we see that if you wanted to add a quantum phase to a state, the quantum circuit consists of first applying an gate, then adding one or more of these phase gates. As mentioned previously, the quantum phase is hidden and not so simple to detect.

Let’s imagine we have an unknown phase gate, and we want to detect what it was. In the previous section we saw that two repeated gates could be used to first make a superposition, then interfere it back to zero. We can generalize this with what is known as a Ramsey quantum circuit, shown below: In step A, we make the superposition. The unknown phase is applied at step B, creating this state:

Finally, at step C, the second gate interferes the state back to

which from the Born rule will have these probabilities:

Defining the difference (sometimes called the inversion) gives

That is, by simply measuring the inversion, we can determine the real part of .

To find the imaginary part, , we define a second quantum circuit: Following the same math as before, the gate before the final gate shifts the phase by . This rotates the imaginary plane down onto the real plane, giving

From the inversion of this second experiment, we can determine the imaginary part of . Then, by simply using atan2, we can find the phase .

Let’s try this out!

Here we are given the problem where the unknown phase gate is . From the math, you know that this phase is , but let’s see if you can find this answer by doing the experiment in Circuit Composer, using the two quantum circuits below.

Ramsey X Circuit Open in Circuit Composer

Ramsey Y Circuit Open in Circuit Composer

Previously we ran these experiments on the IBM Q Yorktown system for 8192 shots, giving

Experiment

value

x

0.16846

0.83154

-0.663

y

0.85303

0.14697

0.706

Noise makes this vary from having modulus 1 (). As a quick fix, we can define normalized real and imaginary parts by:

Putting this into gives , which is very close to the predicted value of .

You just measured the quantum phase and performed your first quantum tomography experiment!

Note that Circuit Composer has a visualization tool with a statevector where you can explore this phase through simulation. It also has an inspector where you can explore this phase as you step through the circuit. Go back to Circuit Composer with the two experiments above, and explore the visualizations and the inspector to develop your understanding of quantum phases.

## An aside on global phase¶

Global phase is curious thing in quantum computing (and quantum physics as a whole). Textbooks and experts alike will tell you that a global phase can simply be ignored and leave it at that. However, why does something that can be cast aside keep showing up in the equations of quantum physics? Here we explain why, and shed light on an important principle in physics.

Suppose you are on the beach and you drop a ball from a height of one meter. How do you compute the velocity of the ball at the end? Recall that the velocity (kinetic energy) of the ball at the end of this one-meter drop is determined by the change, or difference in the potential energy. One could compute potential energy due to the gravitational field relative to the center of the earth, or they could compute this value relative to sea level. In terms of the dynamics, it does not matter: when computing the dynamics of a physical system, only energy differences, not absolute values, are important. The same is true when looking at, for example, the motion of electrons in wires where only the differences in voltages, as opposed to absolute values, enter the equations.

The same is true for quantum systems. In quantum physics, the quantity that determines the dynamics is the Hamiltonian for the system under consideration. The Hamiltonian has units of energy, and is a Hermitian (self-adjoint) operator whose eigenvalues play a central role in determining the time evolution of the system. These Hermitian operators are also critical in understanding quantum gates, as any quantum gate can be written in terms of an Hermitian operator :

with the action

Now, since absolute values of energy are not important, let’s add a constant amount of energy to the system Hamiltonian: . This has the affect of shifting all of the eigenvalues by an amount . Since all the values are shifted by the same amount, the differences between values remain unchanged; the dynamics should not care about this shift. Let us now form a gate from this new Hamiltonian and apply it to a statevector :

.

We see that the action of the energy-shifted Hamiltonian is the same as the original with an additional pre-factor that is nothing more than a global phase :

We now can see why global phases arise, but can always be ignored. They manifest themselves from uniform shifts in energy that do not affect the dynamics.