Quantum phase

New operations in this topic

Click the name of the operation to see more details in the Operations Glossary.

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 \{|0\rangle, |1\rangle, |+\rangle, |-\rangle\} , 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 \mathbb{C}^2 , which means that a qubit takes two complex numbers to fully describe it. An arbitrary quantum state, denoted |\psi\rangle , can be any superposition |\psi\rangle=\alpha |0\rangle + \beta |1\rangle of the basis vectors. The quantum amplitudes \alpha and \beta are complex numbers which, from the Born rule, the result 0 is obtained with probability |\alpha|^2 , and the result 1 is obtained with the complementary probability |\beta|^2 . Note that, from the conservation of probability, |\alpha|^2+|\beta|^2=1 , and since the global phase of a quantum state is not detectable ( |\psi\rangle is the same as e^{j\gamma}|\psi\rangle ), the single-qubit state can be rewritten as

\begin{split}\vert\psi\rangle = \sqrt{1-p}\vert0\rangle + e^{j\varphi} \sqrt{p} \vert1\rangle,\end{split}

where 0 \leq p \leq 1 is the probability of the bit being in the 1 state, 0\leq \varphi < 2\pi is the quantum phase, and \gamma can be any number between [0, 2 \pi ).

In IBM Quantum Composer, the phase disk at the terminus of each qubit gives the local state of each qubit at the end of the computation. Hovering over a phase disk gives full details. For example:

Phase disks at the end of a circuit.

Quantum Composer has a series of quantum phase-shift gates that allow us to shift this phase by the following:


T gate



S gate



Z gate



T^\dagger gate



S^\dagger gate


and the general phase-shift P(\phi) gate:


P(\phi) gate

\varphi\rightarrow\varphi+\phi ,

which has the matrix form

\begin{split}P(\phi) =\begin{pmatrix} 1 & 0 \\ 0 & e^{j\phi} \end{pmatrix}.\end{split}

Here we see that if you wanted to add a quantum phase to a state, the quantum circuit consists of first applying an H 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 H 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:

\begin{split}\vert\psi\rangle = \frac{1}{\sqrt{2}}(\vert0\rangle + e^{j\varphi} \vert1\rangle)\end{split}

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

\begin{split}\vert\psi\rangle = \frac{1}{{2}}[(1+e^{j\varphi})\vert0\rangle + (1-e^{j\varphi}) \vert1\rangle],\end{split}

which from the Born rule will have these probabilities:

\begin{split}p_0 = \frac{1}{{2}} [1+\cos(\varphi)] ~~~~~~ p_1 = \frac{1}{{2}} [1-\cos(\varphi)].\end{split}

Defining the difference (sometimes called the inversion) d = p_0-p_1 gives


That is, by simply measuring the inversion, we can determine the real part of x=\mathrm{Re}[e^{j\varphi}] .

To find the imaginary part, y=\mathrm{Im}[e^{j\varphi}] , we define a second quantum circuit:


Following the same math as before, the S^\dagger gate before the final H gate shifts the phase by -\pi/2 . 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 y=\mathrm{Im}[e^{j\varphi}] . Then, by simply using atan2, we can find the phase \varphi .

Let’s try this out!

Here we are given the problem where the unknown phase gate is 3\pi/4 . 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 IBM Quantum Composer

Ramsey Y Circuit


Open in IBM Quantum Composer

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













Noise makes this vary from having modulus 1 ( \sqrt{x^2+y^2}\neq 1 ). As a quick fix, we can define normalized real and imaginary parts by:

\begin{split}\bar x = \frac{x}{\sqrt{x^2+y^2}} ~~~~~~ \bar y = \frac{y}{\sqrt{x^2+y^2}}\end{split}

Putting this into atan2(\bar y,\bar x) gives 0.74\pi , which is very close to the predicted value of 3\pi/4 .

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

Note that Quantum 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 Quantum 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 a 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 H :

U = e^{\frac{-jHt}{\hbar}},

with the action

U|\psi\rangle = e^{\frac{-jHt}{\hbar}}|\psi\rangle = |\psi'\rangle.

Now, since absolute values of energy are not important, let’s add a constant amount of energy to the system Hamiltonian: H\rightarrow H+\lambda I . This has the affect of shifting all of the eigenvalues by an amount \lambda . 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 |\psi\rangle :

\begin{eqnarray} \tilde{U}|\psi\rangle &= \exp\left[\frac{-j\left(H+\lambda I\right)t}{\hbar}\right]|\psi\rangle \ &= \exp\left(\frac{-j\lambda It}{\hbar}\right)\exp\left(\frac{-jHt}{\hbar}\right)|\psi\rangle \end{eqnarray} .

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 \gamma = -\lambda t/\hbar :

\tilde{U}|\psi\rangle = e^{j\gamma}\left(U|\psi\rangle\right) = e^{j\gamma}|\psi'\rangle.

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.