The live visualizations in IBM Quantum Composer show you different views of how quantum circuits affect the state of a collection of qubits. Each type of live visualization is explained in detail below.

Randomness in the simulator

The live visualizations come from a single-shot statevector simulator, which is different from the system specified in the Run settings, which can have multiple shots. The simulator creates randomness by generating results based on a seed. The seed is the initial value introduced into the algorithm that generates pseudorandom numbers and simulates quantum randomness. Because the seed is fixed during your circuit session, your live visualizations will be repeatable. However, when you close your circuit and re-open it, the seed will have a new value, so you may see a different visualization. You can set the seed yourself by changing the value in the box (up to four digits) after the words Visualizations seed above the Composer, and observe how the live visualizations for your circuit change.

View visualizations

The live visualizations are shown in windows at the bottom of the Quantum Composer workspace (except the phase disk, which appears at the end of each qubit wire). You can choose any combination of statevector, probabilities, and q-sphere visualizations to appear at the bottom of the workspace. Select or unselect visualizations in the View menu.

Download visualizations

Download one of the visualizations at the bottom of the Quantum Composer workspace by clicking the More options menu in the visualization window. You can download visualizations as an SVG, a PNG, or a CSV of the underlying data. You can also download the visualization images of the measurement probabilities and statevector histograms as a PDF.

Phase disk

As described in the Field Guide, a single-qubit state can be represented as

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

where p is the probability that the qubit is in the |1\rangle state, and \varphi is the quantum phase. p is strongly analogous to a classical probabilistic bit. For p=0 , the qubit is in the |0\rangle state, for p=1 the qubit is in the |1\rangle state, and for p=1/2 the qubit is a 50/50 mixture. We call this a superposition as, unlike classical bits, this mixture can have a quantum phase. The phase disk visualizes this state.

The phase disk at the terminus of each qubit in IBM Quantum Composer gives the local state of each qubit at the end of the computation. The components of the phase disk are described below.

Probability the qubit is in the |1\rangle state

The probability that the qubit is in the |1\rangle state is represented by the blue disk fill.

probability the qubit is in the 1 state

Quantum Phase

The quantum phase of the qubit state is given by the line that extends from the center of the diagram to the edge of the gray disk (which rotates counterclockwise around the center point).

phase of the local qubit state

Example: phase disks for two different qubits

phase disk examples

Two examples of the phase disk visualization. The first example is a |1\rangle state and the second shows the (|0\rangle-|1\rangle)/\sqrt{2} state with a nonzero relative phase.

Connection to the Bloch sphere

The phase disk, which contains all the information in the Bloch sphere, is a two-dimensional representation of a qubit. To convert to the Bloch sphere representation: x=2\sqrt{p(1-p)}\mathrm{Re}[e^{j\varphi} ] , y=2\sqrt{p(1-p)}\mathrm{Im}[e^{j\varphi} ] , and z=1-2p .

N-qubit states: maximum 15 qubits

An N-qubit quantum state takes the form

\begin{split}\vert\psi\rangle = \sqrt{1-p}\vert0...0\rangle + \sum_{k=1}^{2^N-1}e^{j\varphi_k} \sqrt{p_k} \vert k\rangle,\end{split}

where p_k is the probability that the qubits are in the state |k\rangle with quantum phase \varphi_k with respect to the |0...0\rangle state. p=\sum_{k\neq0}p_k is the probability that the qubits are not in the ground state |0...0\rangle . Here it is simple to see that for an N-qubit quantum state there are 2^N-1 probabilities and 2^N-1 phases. The phase disk fails to represent this state, as N-qubit phase disks would only contain N probabilities and N phases; this is because most states are entangled and are not separable into independent single-qubit quantum states. To represent that full information is not contained in this visualization, we introduce the reduced purity as a component in the phase disk.

Reduced purity of the qubit state

The radius of the black ring represents the reduced purity of the qubit state, which for qubit j in an N -qubit state |\psi\rangle is given by \mathrm{Tr}\left[\mathrm{Tr}_{i\neq j}[\left|\psi\rangle\langle\psi\right|\right]^{2}] . The reduced purity for a single qubit is in the range [0.5, 1] ; a value of one indicates that the qubit is not entangled with any other party. In contrast, a reduced purity of 0.5 shows that the qubit is left in the completely mixed state, and has some level of entanglement over the remaining N-1 qubits, and possibly even the environment.

purity of the qubit state

Probabilities view

8-qubit limit

This view visualizes the probabilities of the quantum state as a bar graph. The horizontal axis labels the computational basis states. The vertical axis measures the probabilities in terms of percentages. In this view the quantum phases are not represented, and is therefore an incomplete representation. However, it is useful for predicting the outcomes if each qubit is measured and the value stored in its own classical bit.

Consider the following quantum circuit and its probabilities view:

a quantum circuit

A circuit consisting of a column of Hadamards that creates an equal superposition of the computational basis states, followed by a two-qubit controlled-Z (CZ) gate.

measurement probabilities view

A quantum circuit and its probabilities view.

The circuit puts the two qubits into the state |\psi\rangle = (|00\rangle + |01\rangle+ |10\rangle-|11\rangle) / 2. The computational basis states are |00\rangle, |10\rangle, |01\rangle, and |11\rangle. The probabilities for each of the computational states is 1/4.

Q-sphere view

5-qubit limit

The q-sphere represents the state of a system of one or more qubits by associating each computational basis state with a point on the surface of a sphere. A node is visible at each point. Each node’s radius is proportional to the probability ( p_k ) of its basis state, whereas the node color indicates the quantum phase ( \varphi_k ).

The nodes are laid out on the q-sphere so that the basis state with all zeros (e.g., |000\rangle) is at its north pole, and the basis state with all ones (e.g., |111\rangle ) is at its south pole. Basis states with the same number of zeros (or ones) lie on a shared latitude of the q-sphere (e.g., |001\rangle, |010\rangle, |100\rangle ). Beginning at the north pole of the q-sphere and progressing southward, each successive latitude has basis states with a greater number of ones; the latitude of a basis state is determined by its Hamming distance from the zero state. The q-sphere contains complete information about the quantum state in a compact representation.

Consider the following quantum circuit and its q-sphere:

a quantum circuit

q-sphere view

A quantum circuit and the q-sphere representing the state the circuit creates.

You can select, hold, and drag to rotate the q-sphere. To return the q-sphere to its default orientation, select the rewind-arrow button to the top right of the q-sphere.

What is the difference between a Bloch sphere and a q-sphere?

It is important to highlight that the q-sphere is not the same as the Bloch sphere, even for a single qubit. Indeed, like the phase disk, the Bloch sphere gives a local view of the quantum state, where each qubit is viewed on its own. When trying to understand how registers of qubits (multi-qubit states) behave upon the application of quantum circuits, it is more insightful to take a global view and look at the quantum state in its entirety. The q-sphere provides a visual representation of the quantum state, and thus this global viewpoint. Therefore, when exploring quantum applications and algorithms on small numbers of qubits, the q-sphere should be the primary visualization method.

Statevector view

6-qubit limit

It is common to call \sqrt{p_k}e^{i\varphi_k} the quantum amplitude. This view visualizes the quantum amplitudes as a bar graph. The horizontal axis labels the computational basis states. The vertical axis measures the magnitude of the amplitudes ( \sqrt{p_k} ) associated with each computational basis state. The color of each bar represents the quantum phase ( {\varphi_k} ).

Consider the following quantum circuit and its statevector view:

a quantum circuit

statevector view

The statevector at the terminus of the above circuit. The color wheel maps phase angle to color. The output state is expressed as a list of complex numbers.

The circuit puts the two qubits into the state |\psi\rangle = (|00\rangle + |01\rangle+ |10\rangle-|11\rangle) / 2 . The computational basis states are |00\rangle , |10\rangle , |01\rangle , and |11\rangle . The magnitudes of the amplitudes are 1/2 , and the quantum phases with respect to the ground state are 0 for |01\rangle and |10\rangle , and \pi for |11\rangle .